Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            String cusID     = this.txtCusID.Text;
            String cusName   = this.txtCusName.Text;
            String cusAddr   = this.txtCusAddr.Text;
            String cusGender = this.cbGender.SelectedItem.ToString();
            String cusPhone  = this.txtCusPhone.Text;

            if (isValid(cusID, cusName, cusAddr, cusPhone))
            {
                DTO_CCustomer customer = new DTO_CCustomer(cusID, cusName, cusAddr, cusPhone, cusGender);

                new BUS_CCustomer().addCustomer(customer);
                this.loadCusList();
            }
        }
Ejemplo n.º 2
0
 public void pr_ThemKH(DTO_CCustomer C)
 {
     try
     {
         SqlCommand cmd = new SqlCommand("pr_ThemKH", DAL_CDBConnect.myconn);
         cmd.CommandType = System.Data.CommandType.StoredProcedure;
         cmd.Parameters.Add("@MsKH", System.Data.SqlDbType.Char, 10).Value         = C.MsKH;
         cmd.Parameters.Add("@TENKH", System.Data.SqlDbType.NVarChar, 30).Value    = C.TENKH;
         cmd.Parameters.Add("@PHAI", System.Data.SqlDbType.NVarChar, 50).Value     = C.PHAI;
         cmd.Parameters.Add("@DIACHI", System.Data.SqlDbType.NVarChar, 100).Value  = C.DIACHI;
         cmd.Parameters.Add("@DIENTHOAI", System.Data.SqlDbType.VarChar, 10).Value = C.DIENTHOAI;
         cmd.ExecuteNonQuery();
         cmd.Parameters.Clear();
     }
     catch (Exception X)
     {
         MessageBox.Show(X.Message.ToString());
     }
 }
Ejemplo n.º 3
0
        public bool addCustomer(DTO_CCustomer customer)
        {
            try
            {
                SqlCommand command = new SqlCommand("pr_ThemKH", DAL_CDBConnect.myconn);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.Add("@MsKH", System.Data.SqlDbType.Char, 10).Value         = customer.CusID;
                command.Parameters.Add("@TENKH", System.Data.SqlDbType.NVarChar, 30).Value    = customer.CusName;
                command.Parameters.Add("@PHAI", System.Data.SqlDbType.NChar, 10).Value        = customer.CusGender;
                command.Parameters.Add("@DIACHI", System.Data.SqlDbType.NVarChar, 50).Value   = customer.CusAddr;
                command.Parameters.Add("@DIENTHOAI", System.Data.SqlDbType.VarChar, 10).Value = customer.CusPhone;

                bool success = command.ExecuteNonQuery() >= 0;
                command.Parameters.Clear();

                command.Dispose();
                return(success);
            }catch (SqlException ex)
            {
                MessageBox.Show(ex.Message.ToString());
                return(false);
            }
        }
Ejemplo n.º 4
0
 public void pr_ThemKH(DTO_CCustomer C)
 {
 }
Ejemplo n.º 5
0
 public bool addCustomer(DTO_CCustomer customer)
 {
     return(new DAL_CCustomer().addCustomer(customer));
 }