public void add(ModelCustomer MC)
        {
            if (MC == null) return;

            DLCustomer DC = new DLCustomer();
            DC.add(MC);
        }
        public void update(ModelCustomer MC)
        {
            if (MC == null) return;

            DLCustomer DC = new DLCustomer();
            DC.update(MC);
        }
Exemplo n.º 3
0
 public void add(ModelCustomer MC)
 {
     using (DBAccess.DBAccess db = new DBAccess.DBAccess())
     {
         string[,] param =   {
                                 {"@NAME", MC.Name},
                                 {"@ADDRESS", MC.Address}
                             };
         db.ExecuteNonQuery("sprInsertCustomer", param);
     }
 }
Exemplo n.º 4
0
 public ModelCustomer getCustomerByID(string ID)
 {
     using (DBAccess.DBAccess db = new DBAccess.DBAccess())
     {
         string[,] param = { { "@Id", ID } };
         using (SqlDataReader rdr = db.ExecuteReader("sprSelectCustomerByID", param))
         {
             ModelCustomer item = new ModelCustomer();
             while (rdr.Read())
             {
                 item.Id = Convert.ToInt32(rdr["Id"]);
                 item.Name = rdr["Name"].ToString();
                 item.Address = rdr["Address"].ToString();
             }
             return item;
         }
     }
 }
Exemplo n.º 5
0
 public void update(ModelCustomer MC)
 {
     using (DBAccess.DBAccess db = new DBAccess.DBAccess())
     {
         string[,] param =   {
                                 {"@ID", MC.Id.ToString()},
                                 {"@NAME", MC.Name},
                                 {"@ADDRESS", MC.Address}
                             };
         db.ExecuteNonQuery("sprUpdateCustomer", param);
     }
 }
Exemplo n.º 6
0
        private ModelCustomer GetFieldValuesCustomer()
        {
            string ErrMsg = "";
            ModelCustomer MC = new ModelCustomer();

            try
            {
                if (txtID.Text != "") MC.Id = Convert.ToInt32(txtID.Text);
                MC.Name = txtName.Text;
                MC.Address = txtAddress.Text;

                return MC;
            }
            catch (Exception ex)
            {
                ErrMsg = ex.Message.ToString();
                ViewState["WithErrorCustomer"] = true;
                return null;
            }
            finally
            {
                MC.Dispose();
            }
        }
Exemplo n.º 7
0
 private void FillFieldsCustomer(ModelCustomer MC)
 {
     txtID.Text = MC.Id.ToString();
     txtName.Text = MC.Name;
     txtAddress.Text = MC.Address;
 }