public EntClsCustomer CustomerSearch(string identificationCard) { EntClsCustomer ent_customer = new EntClsCustomer(); string storeProcedure = "CustomerSearch"; using (DbConnection con = dpf.CreateConnection()) { con.ConnectionString = constr; using (DbCommand cmd = dpf.CreateCommand()) { cmd.Connection = con; cmd.CommandText = storeProcedure; cmd.CommandType = CommandType.StoredProcedure; DbParameter param = cmd.CreateParameter(); param.DbType = DbType.String; param.ParameterName = "identificationCard"; param.Value = identificationCard; cmd.Parameters.Add(param); con.Open(); using (DbDataReader dr = cmd.ExecuteReader()) { if (dr.Read()) { ent_customer = new EntClsCustomer((string)dr["identificationCard"], (string)dr["name"], (string)dr["lastname"], (string)dr["phone"], (string)dr["celphone"], (string)dr["addres"], (string)dr["mail"]); } } } } return ent_customer; }
protected void btnCustomerSearch_Click(object sender, EventArgs e) { ent_customer = bsn_customer.CustomerSearch(txtIdCustomer.Text); if (ent_customer.Cedula == null) { if (cedulavalidation(txtIdCustomer.Text)) { Response.Redirect("RegistroCliente.aspx"); } else { errorCiNonV(); } } else { txtIdentificationCard.Enabled = true; txtName.Enabled = true; txtLastName.Enabled = true; txtPhone.Enabled = true; txtCellPhone.Enabled = true; txtAddress.Enabled = true; txtEmail.Enabled = true; showCustomer(ent_customer); btnNextBook.Enabled = true; } }
protected void btnCustomerSearch_Click(object sender, EventArgs e) { string search = txtIdCustomer.Text; ent_customer = bsn_customer.CustomerSearch(search); if (ent_customer.IdentificationCard == null) { Response.Redirect("RegistroCliente.aspx"); } else { txtIdentificationCard.Enabled = true; txtName.Enabled = true; txtLastName.Enabled = true; txtPhone.Enabled = true; txtCellPhone.Enabled = true; txtAddress.Enabled = true; txtEmail.Enabled = true; showCustomer(ent_customer); btnUpdateCustomer.Enabled = true; btnDeleteCustomer.Enabled = true; btnNextBook.Enabled = true; } }
protected void showCustomer(EntClsCustomer ent_customer) { txtIdentificationCard.Text = ent_customer.Cedula; txtName.Text = ent_customer.Nombre; txtLastName.Text = ent_customer.Apellido; txtPhone.Text = ent_customer.Telefono; txtCellPhone.Text = ent_customer.Celular; txtAddress.Text = ent_customer.Direccion; txtEmail.Text = ent_customer.Email; }
protected void showCustomer(EntClsCustomer ent_customer) { txtIdentificationCard.Text = ent_customer.IdentificationCard; txtName.Text = ent_customer.Name; txtLastName.Text = ent_customer.Lastname; txtPhone.Text = ent_customer.Phone; txtCellPhone.Text = ent_customer.Celphone; txtAddress.Text = ent_customer.Addres; txtEmail.Text = ent_customer.Mail; }
protected void btnRegister_Click(object sender, EventArgs e) { EntClsCustomer obj_customer = new EntClsCustomer(); BsnClsCustomer bsn_customer = new BsnClsCustomer(); obj_customer = bsn_customer.CustomerSearch(textIdentificationCard.Text); if (obj_customer.IdentificationCard == null) { if (cedulavalidation(textIdentificationCard.Text)) { bsn_customer.RegisterCustomer(textIdentificationCard.Text, textName.Text, textLastName.Text, textphone.Text, textCelphone.Text, textAddres.Text, textMail.Text); clear(); } else { errorCiNonV(); } } else { errorExistCus(); } }