private void but_CreatePaymentStore_Click(object sender, EventArgs e)
        {
            QuayGiaoDichDto _qgdDTO = new QuayGiaoDichDto();

            _qgdDTO.TenQuayGiaoDich = txt_PaymentStoreAddress.Text;
            _qgdDTO.DiaChi          = txt_PaymentStoreName.Text;
            QuayGiaoDichBUS _qgdBUS     = new QuayGiaoDichBUS();
            string          _qgdMessage = string.Empty;

            if (!_qgdBUS.CreatePaymentStore(_qgdDTO, out _qgdMessage))
            {
                MessageBox.Show(_qgdMessage, "Lỗi tạo chi nhánh", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult dialogResult = MessageBox.Show(_qgdMessage + "\nBạn có tiếp tục tạo chi nhánh", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dialogResult == DialogResult.Yes)
                {
                    txt_PaymentStoreAddress.Text = "";
                    txt_PaymentStoreName.Text    = "";
                }
                else if (dialogResult == DialogResult.No)
                {
                    RenderForm();
                    HideControlSupportPaymentStore();
                    but_CreateStaff.Enabled        = true;
                    but_CreatePermission.Enabled   = false;
                    but_CreatePaymentStore.Enabled = false;
                    this.ClientSize = new System.Drawing.Size(500, 240);
                }
            }
        }
 public static bool CreatePaymentStore(QuayGiaoDichDto _paymentStore)
 {
     try
     {
         using (QLSoTietKiemDBContext ql = new QLSoTietKiemDBContext())
         {
             ql.QuayGiaoDich.Add(_paymentStore);
             ql.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         Logger.WriteLogError("QuayGiaoDichDAO CreatePaymentStore", ex.Message);
         return(false);
     }
 }
Beispiel #3
0
 public bool CreatePaymentStore(QuayGiaoDichDto _paymentStore, out string Message)
 {
     if (string.IsNullOrEmpty(_paymentStore.TenQuayGiaoDich))
     {
         Message = "Tên chi nhánh không được rỗng";
         return(false);
     }
     else if (string.IsNullOrEmpty(_paymentStore.DiaChi))
     {
         Message = "Địa chỉ chi nhánh không được rỗng";
         return(false);
     }
     else if (!QuayGiaoDichDAO.CreatePaymentStore(_paymentStore))
     {
         Message = "Lỗi tạo chi nhánh";
         return(false);
     }
     else
     {
         Message = "Tạo chi nhánh thành công";
         return(true);
     }
 }