*{margin:0;padding:0}
* html,body{height:100%;width:100%;}
a{color:#000000;text-decoration:none; height :26px;}
a:link{ color: #000000;text-decoration:none; }
a:visited{ color: #0000ff;text-decoration:none;}
a:hover{color: #0000ff; text-decoration:underline; height :26px; padding:0px 0px 0px 0px; }
a:active{ color: #0000ff; text-decoration:none;padding:0px 0px 0px 0px;}
body
{
margin:0px auto;
padding:0px auto;
background-color: #FFFFFF;
text-align:center;
/*min-height:468px; for good browsers*/
/*min-width:916px; for good browsers*/
font-family: verdana, sans-serif;
font-size: 11px;
}
.Outer
{
clear:both;
width:950px;
min-width:950px;
min-height:468px;
margin:0px auto;
margin-top:auto;
margin-bottom:auto;
text-align:center;
border:1px solid #CCCCCC;
position:relative;
top:auto;
display:table;
vertical-align: middle;
}
.Menu
{
clear:both;
width:916px;
height:88px;
margin:0px auto;
/*border:1px solid #000000;min-width:916px;*/
background:url(Images/icon_bg.jpg) no-repeat;
}
.TopHeader
{
clear:both;
width:952px;
height:160px;
background-color: #f9f9f9;
background:url(buttons/Top_Banner.jpg) no-repeat;
}
.LeftSubMenu
{
clear:both;
float:left;
text-align:left;
/*line-height:20px;*/
padding:20px 0px 0px 17px;
width:223px;
vertical-align:middle;
/*background-color:#d6d6d6;
border:1px solid #000000;*/
background-color:#f9f9f9;
min-width:223px;
}
.LeftMenuHeader
{
margin:0px auto;
padding:0px auto;
height:31px;
width:223px;
text-align:center;
background:url(Images/left_menu_top.jpg) no-repeat;
}
.LeftMenuBottom
{
margin:0px auto;
padding:0px auto;
height:31px;
width:223px;
text-align:center;
background:url(Images/left_menu_bottom.jpg) no-repeat;
}
.Separater
{
margin:0px auto;
padding:0px auto;
height:24px;
width:223px;
text-align:center;
background:url(Images/Line_Image.jpg) no-repeat;
}
.RightContent
{
float:right;
padding:20px 5px 0px 0px;
margin:0px auto;
min-height:324px;
width:680px;
background-color:#f9f9f9;
}
.ContentTopBar
{
margin:0px auto;
padding:0px 0px 0px 0px;
height:31px;
width:660px;
text-align:center;
background:url(Images/Content_top_bg.jpg) no-repeat;
}
.Form
{
clear:both;
width:950px;
min-height:340px;
background-color:#FBFBFB;
/*background:url(Home/border.jpg) repeat-y;
border-left:2px solid #cccccc;
border-right:2px solid #cccccc;*/
}
.LeftTop
{
margin:0px auto;
float:left;
vertical-align:middle;
height:150px;
width:730px;
}
.RightTop
{
float:right;
height:150px;
width:200px;
}
.content
{
clear:both;
width:100%;
min-height:340px;
}
.ContentTopBg
{
height:29px;
width:660px;
background:url(buttons/ContentTopBg.jpg) no-repeat;
}
.ContentMidBg
{
width:660px;
background:url(buttons/ContentMidBg.jpg) repeat-y ;
}
.ContentFooterBg
{
height:5px;
width:660px;
background:url(buttons/ContentFooterBg.jpg) no-repeat;
}
.HomeFooter
{
clear:both;
width:952px;
height:80px;
background-color: #f9f9f9;
background:url(buttons/Bottom_Banner.jpg) no-repeat;
}
.Footer
{
text-align:right;
padding:0px 0px 0px 0px;
clear:both;
width:952px;
height:20px;
background-color: #f9f9f9;
/*background:url(buttons/Bottom_Banner.jpg) no-repeat;*/
}
.login_bg
{
margin:0px auto;
margin-top:15px;
width:311px;
height:232px;
background-color: #f9f9f9;
background:url(buttons/Login_Window.jpg) no-repeat;
}
.form_top_bg
{
margin:0px auto;
margin-top:15px;
width:731px;
height:32px;
background-color: #f9f9f9;
background:url(buttons/Form_Topbg.jpg) no-repeat;
}
.form_middle_bg
{
margin:0px auto;
margin-top:15px;
width:731px;
height:18px;
background-color: #f9f9f9;
background:url(buttons/Form_middlebg.jpg) repeat-y;
}
.form_bottom_bg
{
margin:0px auto;
margin-top:15px;
width:731px;
height:20px;
background-color: #f9f9f9;
background:url(buttons/Form_Bottombg.jpg) no-repeat;
}
/*watermark text box*/
.watermarked {
/*height:20px;*/
width:150px;
padding:2px 0px 0px 2px;
border:1px solid #BEBEBE;
background-color:#F0F8FF;
color:gray;
}
/* normal text */
.ContentHeaderTop
{
width:660px;
height:29px;
background:url(buttons/Content_Top_Header.jpg) no-repeat;
}
.ContentMiddleBg
{
width:660px;
background:url(buttons/Content_Middle_BG.jpg) repeat-y;
}
.TextStyle
{
clear:both;
margin :0px auto;
width:90%;
line-height:25px;
text-align:justify;
color :#000000;
}
.CountentFooter
{
width:660px;
height:5px;
background:url(buttons/Content_Bottom_Bg.jpg) no-repeat;
}
/* by Aatish Jadhav on 25 jan 2010 */
/*For Dashboard*/
.Dashboard_top_bg
{
margin:0px auto;
margin-top:15px;
width:248px;
height:44px;
background-color: #f9f9f9;
background:url(buttons/Dashboard_top_bg.jpg) no-repeat;
}
.Dashboard_middle_bg
{
margin:0px auto;
margin-top:15px;
width:248px;
height:20px;
background-color: #f9f9f9;
background:url(buttons/Dashboard_middle_bg.jpg) repeat-y;
text-align:center;
}
.Dashboard_bottom_bg
{
margin:0px auto;
margin-top:15px;
width:248px;
height:15px;
background-color: #f9f9f9;
background:url(buttons/Dashboard_bottom_bg.jpg) no-repeat;
}
Thursday, February 4, 2010
HOW TO CREATE ERRORLOG FILE
catch(Exception ex)
{
String errorMessage;
errorMessage = "Error: ";
errorMessage = String.Concat(errorMessage, ex.Message);
errorMessage = String.Concat(errorMessage, " Line: ");
errorMessage = String.Concat(errorMessage, ex.Source);
LCE.Configuration.ErrorLog("Payment/PaymentList.cs", errorMessage);
}
CONFIGURATION.CS IN APP_Code folder FOR Database connection and ERROR LOGS and GET ROOT PATH
CREAe ERROR LOGS FOLDER IN ROOT PATH
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
//
using System.IO;
using System.Collections;
namespace LCE
{
using System.Web.UI;
using System.IO;
using System.Collections;
using System.Web.Security;
using System.Web;
using System.Data;
using System.Configuration;
using System;
public class Configuration
{
public static string GetConnnectionString()
{
return ConfigurationSettings.AppSettings["ConnectionString"];
}
public static string GetCurrentUSerID()
{
return HttpContext.Current.User.Identity.Name;
}
public static string GetRootPath()
{
return ConfigurationSettings.AppSettings["rootPath"];
}
public static void ErrorLog(string sFilename, string sErrMsg)
{
string sPathName="";
sPathName = System.AppDomain.CurrentDomain.BaseDirectory;
sPathName = sPathName + "ErrorLogs" + "\\ErrorLog_";
string sErrorTime;
string sYear = DateTime.Now.Year.ToString();
string sMonth = DateTime.Now.Month.ToString();
string sDay = DateTime.Now.Day.ToString();
sErrorTime = sYear +"_"+ sMonth +"_"+ sDay+".txt";
if (File.Exists(sPathName + sErrorTime))
{
File.SetAttributes(sPathName + sErrorTime, FileAttributes.Normal);//set file attributes readonly to normal.
}
using (StreamWriter objsw = new StreamWriter(sPathName + sErrorTime, true))
{
objsw.WriteLine("*****************Start*****************");
objsw.WriteLine();
objsw.WriteLine("Date/Time: " + System.DateTime.Now.ToString());
objsw.WriteLine("File Name :" + sFilename);
objsw.WriteLine("Error Msg :" + sErrMsg);
objsw.WriteLine();
objsw.WriteLine("******************End********************");
objsw.Flush();
objsw.Close();
}
}
}
}
{
String errorMessage;
errorMessage = "Error: ";
errorMessage = String.Concat(errorMessage, ex.Message);
errorMessage = String.Concat(errorMessage, " Line: ");
errorMessage = String.Concat(errorMessage, ex.Source);
LCE.Configuration.ErrorLog("Payment/PaymentList.cs", errorMessage);
}
CONFIGURATION.CS IN APP_Code folder FOR Database connection and ERROR LOGS and GET ROOT PATH
CREAe ERROR LOGS FOLDER IN ROOT PATH
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
//
using System.IO;
using System.Collections;
namespace LCE
{
using System.Web.UI;
using System.IO;
using System.Collections;
using System.Web.Security;
using System.Web;
using System.Data;
using System.Configuration;
using System;
public class Configuration
{
public static string GetConnnectionString()
{
return ConfigurationSettings.AppSettings["ConnectionString"];
}
public static string GetCurrentUSerID()
{
return HttpContext.Current.User.Identity.Name;
}
public static string GetRootPath()
{
return ConfigurationSettings.AppSettings["rootPath"];
}
public static void ErrorLog(string sFilename, string sErrMsg)
{
string sPathName="";
sPathName = System.AppDomain.CurrentDomain.BaseDirectory;
sPathName = sPathName + "ErrorLogs" + "\\ErrorLog_";
string sErrorTime;
string sYear = DateTime.Now.Year.ToString();
string sMonth = DateTime.Now.Month.ToString();
string sDay = DateTime.Now.Day.ToString();
sErrorTime = sYear +"_"+ sMonth +"_"+ sDay+".txt";
if (File.Exists(sPathName + sErrorTime))
{
File.SetAttributes(sPathName + sErrorTime, FileAttributes.Normal);//set file attributes readonly to normal.
}
using (StreamWriter objsw = new StreamWriter(sPathName + sErrorTime, true))
{
objsw.WriteLine("*****************Start*****************");
objsw.WriteLine();
objsw.WriteLine("Date/Time: " + System.DateTime.Now.ToString());
objsw.WriteLine("File Name :" + sFilename);
objsw.WriteLine("Error Msg :" + sErrMsg);
objsw.WriteLine();
objsw.WriteLine("******************End********************");
objsw.Flush();
objsw.Close();
}
}
}
}
HOW TO USE VALIDATOR CALL OUT
Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" Display="None">plz enter
username.
REGISTRATION PAGE
protected void btnsubmit_Click(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
BLL_Users objReg = new BLL_Users();
objReg.CollegeName = txtCollegename.Text.Trim();
objReg.UserName = txtUsername.Text.Trim();
objReg.Password = txtPassword.Text.Trim();
objReg.RollNumber = txtrollnumber.Text.Trim();
objReg.FirstName = txtFirstname.Text.Trim();
objReg.MiddleName = txtMiddlename.Text.Trim();
objReg.LastName = txtLastname.Text.Trim();
objReg.Sex = RadioBtnSex.SelectedItem.Text.Trim();
//objReg.BirthDate = Convert.ToDateTime(txtBirthdate.Text.Trim());
objReg.BirthDate = DateTime.Parse(txtBirthdate.Text.Trim(),
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat);
objReg.Faculty = drpdFaculty.SelectedValue;
objReg.Qualification = txtQualification.Text.Trim();
objReg.MobileNumber = txtMobileNumber.Text.Trim();
objReg.EmailId = txtEmailid.Text.Trim();
objReg.Address = txtAddress.Text.Trim();
int CheckUserExist = objReg.User_Registration();
if (CheckUserExist == 0)
{
txtCollegename.Text = "";
txtUsername.Text = "";
txtPassword.Text = "";
txtFirstname.Text = "";
txtMiddlename.Text = "";
txtLastname.Text = "";
RadioBtnSex.SelectedItem.Selected = false;
txtBirthdate.Text = "";
drpdFaculty.SelectedValue = "--Select--";
txtQualification.Text = "";
txtMobileNumber.Text = "";
txtEmailid.Text = "";
txtAddress.Text = "";
Session["msg"] = "Thanks for registration to the course.";
Response.Redirect("Login.aspx", false);
}
else if (CheckUserExist == 1)
{
lbl_success.Font.Bold = true;
lbl_success.ForeColor = Color.Red;
lbl_success.Text = "This UserName is already present. Please enter another UserName.";
txtUsername.Text = "";
txtUsername.Focus();
}
else if (CheckUserExist == 2)
{
lbl_success.Font.Bold = true;
lbl_success.ForeColor = Color.Red;
lbl_success.Text = "This EmailID is already present. Please enter another EmailID.";
txtEmailid.Text = "";
txtEmailid.Focus();
}
else if (CheckUserExist == 3)
{
lbl_success.Font.Bold = true;
lbl_success.ForeColor = Color.Red;
lbl_success.Text = "This rollnumber is already present. Please enter correct rollnumber.";
txtrollnumber.Text = "";
txtrollnumber.Focus();
}
}
}
BLL_REgistration.cs
public int User_Registration()
{
int CheckUserExist;
try
{
CheckUserExist = DAL_Users.User_Registration(this);
return CheckUserExist;
}
catch (Exception ex)
{
ex = ex;
return 5;
}
}
DAL_registration.cs
public static int User_Registration(BLL_Users objRegister)
{
string strCon = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection conn = new SqlConnection(strCon);
conn.Open();
SqlCommand cmd = new SqlCommand("Select UserName,EmailID,RollNumber from [360LMS_Users] where UserName = '" +
objRegister.UserName + "' or EmailID='" + objRegister.EmailId + "'or RollNumber='" + objRegister.RollNumber + "'", conn);
SqlDataReader dr = cmd.ExecuteReader();
try
{
if (!dr.HasRows)
{
dr.Close();
SqlHelper.ExecuteScalar(conn, CommandType.StoredProcedure, "360LMS_User_Registration", new
SqlParameter("@college_name", objRegister.CollegeName), new SqlParameter("@user_name", objRegister.UserName), new
SqlParameter("@password", objRegister.Password),new SqlParameter("@rollnumber",objRegister.RollNumber), new
SqlParameter("@first_name", objRegister.FirstName), new SqlParameter("@middle_name", objRegister.MiddleName), new
SqlParameter("@last_name", objRegister.LastName), new SqlParameter("@sex", objRegister.Sex), new SqlParameter("@birth_date",
objRegister.BirthDate), new SqlParameter("@faculty", objRegister.Faculty), new SqlParameter("@qualification",
objRegister.Qualification), new SqlParameter("@mobile_number", objRegister.MobileNumber), new SqlParameter("@email_id",
objRegister.EmailId), new SqlParameter("@address ", objRegister.Address));
return 0;
}
else
{
while (dr.Read())
{
if(dr.GetString(0)== objRegister.UserName)
{
return 1;
}
else if(dr.GetString(1) == objRegister.EmailId)
{
return 2;
}
else if (dr.GetString(2) == objRegister.RollNumber)
{
return 3;
}
}
}
}
catch(Exception ex)
{
ex = ex;
return 4;
}
return 5;
}
{
if (Page.IsPostBack)
{
BLL_Users objReg = new BLL_Users();
objReg.CollegeName = txtCollegename.Text.Trim();
objReg.UserName = txtUsername.Text.Trim();
objReg.Password = txtPassword.Text.Trim();
objReg.RollNumber = txtrollnumber.Text.Trim();
objReg.FirstName = txtFirstname.Text.Trim();
objReg.MiddleName = txtMiddlename.Text.Trim();
objReg.LastName = txtLastname.Text.Trim();
objReg.Sex = RadioBtnSex.SelectedItem.Text.Trim();
//objReg.BirthDate = Convert.ToDateTime(txtBirthdate.Text.Trim());
objReg.BirthDate = DateTime.Parse(txtBirthdate.Text.Trim(),
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat);
objReg.Faculty = drpdFaculty.SelectedValue;
objReg.Qualification = txtQualification.Text.Trim();
objReg.MobileNumber = txtMobileNumber.Text.Trim();
objReg.EmailId = txtEmailid.Text.Trim();
objReg.Address = txtAddress.Text.Trim();
int CheckUserExist = objReg.User_Registration();
if (CheckUserExist == 0)
{
txtCollegename.Text = "";
txtUsername.Text = "";
txtPassword.Text = "";
txtFirstname.Text = "";
txtMiddlename.Text = "";
txtLastname.Text = "";
RadioBtnSex.SelectedItem.Selected = false;
txtBirthdate.Text = "";
drpdFaculty.SelectedValue = "--Select--";
txtQualification.Text = "";
txtMobileNumber.Text = "";
txtEmailid.Text = "";
txtAddress.Text = "";
Session["msg"] = "Thanks for registration to the course.";
Response.Redirect("Login.aspx", false);
}
else if (CheckUserExist == 1)
{
lbl_success.Font.Bold = true;
lbl_success.ForeColor = Color.Red;
lbl_success.Text = "This UserName is already present. Please enter another UserName.";
txtUsername.Text = "";
txtUsername.Focus();
}
else if (CheckUserExist == 2)
{
lbl_success.Font.Bold = true;
lbl_success.ForeColor = Color.Red;
lbl_success.Text = "This EmailID is already present. Please enter another EmailID.";
txtEmailid.Text = "";
txtEmailid.Focus();
}
else if (CheckUserExist == 3)
{
lbl_success.Font.Bold = true;
lbl_success.ForeColor = Color.Red;
lbl_success.Text = "This rollnumber is already present. Please enter correct rollnumber.";
txtrollnumber.Text = "";
txtrollnumber.Focus();
}
}
}
BLL_REgistration.cs
public int User_Registration()
{
int CheckUserExist;
try
{
CheckUserExist = DAL_Users.User_Registration(this);
return CheckUserExist;
}
catch (Exception ex)
{
ex = ex;
return 5;
}
}
DAL_registration.cs
public static int User_Registration(BLL_Users objRegister)
{
string strCon = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection conn = new SqlConnection(strCon);
conn.Open();
SqlCommand cmd = new SqlCommand("Select UserName,EmailID,RollNumber from [360LMS_Users] where UserName = '" +
objRegister.UserName + "' or EmailID='" + objRegister.EmailId + "'or RollNumber='" + objRegister.RollNumber + "'", conn);
SqlDataReader dr = cmd.ExecuteReader();
try
{
if (!dr.HasRows)
{
dr.Close();
SqlHelper.ExecuteScalar(conn, CommandType.StoredProcedure, "360LMS_User_Registration", new
SqlParameter("@college_name", objRegister.CollegeName), new SqlParameter("@user_name", objRegister.UserName), new
SqlParameter("@password", objRegister.Password),new SqlParameter("@rollnumber",objRegister.RollNumber), new
SqlParameter("@first_name", objRegister.FirstName), new SqlParameter("@middle_name", objRegister.MiddleName), new
SqlParameter("@last_name", objRegister.LastName), new SqlParameter("@sex", objRegister.Sex), new SqlParameter("@birth_date",
objRegister.BirthDate), new SqlParameter("@faculty", objRegister.Faculty), new SqlParameter("@qualification",
objRegister.Qualification), new SqlParameter("@mobile_number", objRegister.MobileNumber), new SqlParameter("@email_id",
objRegister.EmailId), new SqlParameter("@address ", objRegister.Address));
return 0;
}
else
{
while (dr.Read())
{
if(dr.GetString(0)== objRegister.UserName)
{
return 1;
}
else if(dr.GetString(1) == objRegister.EmailId)
{
return 2;
}
else if (dr.GetString(2) == objRegister.RollNumber)
{
return 3;
}
}
}
}
catch(Exception ex)
{
ex = ex;
return 4;
}
return 5;
}
Subscribe to:
Posts (Atom)
