Esempio n. 1
0
 public void CreatePhoneBook(PhoneBook _phoneBook)
 {
     using (SqlConnection connection = base.GetConnection())
     {
         SqlCommand command = new SqlCommand("CreatePhoneBook", connection) {
             CommandType = CommandType.StoredProcedure
         };
         command.Parameters.AddWithValue("@FullName", _phoneBook.FullName);
         command.Parameters.AddWithValue("@Email", _phoneBook.Email);
         command.Parameters.AddWithValue("@Phone1", _phoneBook.Phone1);
         command.Parameters.AddWithValue("@Phone2", _phoneBook.Phone2);
         command.Parameters.AddWithValue("@HomePhone", _phoneBook.HomePhone);
         command.Parameters.AddWithValue("@Officephone", _phoneBook.Officephone);
         command.Parameters.AddWithValue("@Address", _phoneBook.Address);
         command.Parameters.AddWithValue("@ParentId", _phoneBook.ParentId);
         command.Parameters.AddWithValue("@CreatorId", _phoneBook.CreatorId);
         command.Parameters.AddWithValue("@Orders", _phoneBook.Orders);
         connection.Open();
         if (command.ExecuteNonQuery() <= 0)
         {
             throw new DataAccessException("Lỗi kh\x00f4ng thể tao moi");
         }
         command.Dispose();
     }
 }
Esempio n. 2
0
 public void UpdatePhoneBook(PhoneBook _phoneBook)
 {
     this.objDAO.UpdatePhoneBook(_phoneBook);
 }
Esempio n. 3
0
 public void CreatePhoneBook(PhoneBook _obj)
 {
     this.objDAO.CreatePhoneBook(_obj);
 }
 private ETO.PhoneBook SetData()
 {
     ETO.PhoneBook obj = new PhoneBook();
     obj.FullName = txtFullName.Text;
     obj.Phone1 = txtPhone1.Text;
     obj.Phone2 = txtPhone2.Text;
     obj.Officephone = txtofficePhone.Text;
     obj.HomePhone = txtHomePhone.Text;
     obj.Email = txtEmail.Text;
     obj.Address = txtAddress.Text;
     int _order = 0;
     if (!String.IsNullOrEmpty(txtOrder.Text))
         int.TryParse(txtOrder.Text.Replace(",", ""), out _order);
     obj.Orders = _order;
     try
     {
         obj.ParentId = Convert.ToInt32(ddlDepartment.SelectedValue);
     }
     catch { }
     obj.CreatorId = Session["Admin_UserName"].ToString();
     return obj;
 }