protected void CreateUser_Click(object sender, EventArgs e) { SqlConnection connection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["lrbdConnectionString"].ConnectionString); connection.Open(); SqlCommand command = new SqlCommand("SELECT * FROM CustomerMaster WHERE username='******'", connection); SqlDataReader reader = command.ExecuteReader(); //while (reader.Read()) //{ if (reader.Read()) { ErrorMessage.Text = reader["username"].ToString() + " User already exist"; } else { Lrbd.BusinessEntity.CustomerBase objcu = new Lrbd.BusinessEntity.CustomerBase(); objcu.username = UserName.Text; objcu.password = Password.Text; objcu.name = Name.Text; objcu.email = Email.Text; objcu.phone = Phone.Text; Lrbd.Business.Customer objcustomer = new Lrbd.Business.Customer(); objcustomer.CreateCustomer(objcu); Response.Redirect("Login.aspx"); } //} connection.Close(); //ErrorMessage.Text = result.Errors.FirstOrDefault(); }
public void CreateCustomer(CustomerBase objcu) { List<SqlParameter> paramColl = new List<SqlParameter>(); paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.String, Value = objcu.username, ParameterName = "@username" }); paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.String, Value = objcu.password, ParameterName = "@password" }); paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.String, Value = objcu.name, ParameterName = "@name" }); paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.String, Value = objcu.email, ParameterName = "@email" }); paramColl.Add(new SqlParameter() { DbType = System.Data.DbType.String, Value = objcu.phone, ParameterName = "@phone" }); LrbdDAL.ExecuteUpdateStatement("CustomerMasteradd", paramColl); }
protected void Button1_Click(object sender, EventArgs e) { Lrbd.Business.Customer objcu = new Lrbd.Business.Customer(); Lrbd.BusinessEntity.CustomerBase objcust = new Lrbd.BusinessEntity.CustomerBase(); objcust.username = Username.Text; objcust.password = Password.Text; objcust.name = Name.Text; objcust.email = Email.Text; objcust.phone = Phone.Text; objcu.CreateCustomer(objcust); Response.Redirect("Customerlisting.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { Lrbd.BusinessEntity.CustomerBase objcu = new Lrbd.BusinessEntity.CustomerBase(); objcu.customer_id = Int32.Parse(CustomerId.Value); objcu.username = Username.Text; objcu.password = Password.Text; objcu.name = Name.Text; objcu.email = Email.Text; objcu.phone = Phone.Text; Lrbd.Business.Customer objcustomer = new Lrbd.Business.Customer(); objcustomer.EditCustomer(objcu); Response.Redirect("Dashboard.aspx"); }
public void CreateCustomer(CustomerBase cusdata) { cusdata.password = GetMD5HashData(cusdata.password); objcustomer.CreateCustomer(cusdata); }
public void EditCustomer(CustomerBase cusdata) { cusdata.password = GetMD5HashData(cusdata.password); objcustomer.EditCustomer(cusdata); }