private void Clear() { txt_AccountID.Text = string.Empty; txt_Ref.Text = string.Empty; txt_Name.Text = string.Empty; txt_CustomerID.Text = string.Empty; oSelectedCustomer = null; lookUEdit_Account_GL.EditValue = string.Empty; oSelectedAccountGL = null; lookUEdit_BranchID.EditValue = string.Empty; oSelectedBranch = null; txt_BranchName.Enabled = false; dtOpenDate.DateTime = System.DateTime.Now; dtLastDate.DateTime = System.DateTime.Now; dtApprovedTime.Text = string.Empty; cbo_Approved.SelectedIndex = 0; dtClosedDate.DateTime = System.DateTime.Now; cbo_Closed.SelectedIndex = 0; cbo_Locked.SelectedIndex = 0; cbo_CreditDebit.Text = string.Empty; lookUEdit_Categories.EditValue = string.Empty; oSelectedCate = null; cbo_Ccy.SelectedIndex = 0; txt_UserCreate.Text = Program.CurrentUser.User_ID; txt_bCredit.Text = string.Empty; txt_dCredit.Text = string.Empty; txt_dDebit.Text = string.Empty; txt_qCredit.Text = string.Empty; txt_qDebit.Text = string.Empty; txt_mCredit.Text = string.Empty; txt_mDebit.Text = string.Empty; txt_yCredit.Text = string.Empty; txt_yDebit.Text = string.Empty; txt_AmountBlock.Text = string.Empty; txt_Bal.Text = string.Empty; txt_BalAvai.Text = string.Empty; }
private void Delete_Customer(Account.Common.Entities.Customer_Info oCustomer) { DialogResult dlg = MessageBox.Show("Bạn có thật sự muốn xóa khách hàng có mã " + oCustomer.ID + " ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dlg == DialogResult.Yes) { if (Account.UIProviders.UICustomer.Delete(oCustomer.ID) == 0) { MessageBox.Show("Xóa khách hàng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCustomerList.lstCustomerInfo.Remove(frmCustomerList.oSelectedCustomerInfo); Enable(false); Program.eButton = Program.Button.None; this.Close(); } else { MessageBox.Show(Account.UIProviders.UICustomer.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); //Enable(true); } } else { Program.eButton = Program.Button.None; Enable(true); } }
private void Detail_Customer(Account.Common.Entities.Customer_Info oCurCustomer) { txt_ID.Text = oCurCustomer.ID; txt_Ref.Text = oCurCustomer.Reference; txt_Name.Text = oCurCustomer.Name; txt_FamilyName.Text = oCurCustomer.FamilyName; txt_ShortName.Text = oCurCustomer.ShortName; txt_Address.Text = oCurCustomer.Address; txt_Address1.Text = oCurCustomer.Address1; txt_EName.Text = oCurCustomer.EName; txt_EAddress.Text = oCurCustomer.EAddress; txt_Cust_Cert.Text = oCurCustomer.Cust_Cert; txt_Cust_Cert_Type.Text = oCurCustomer.Cust_Cert_Type; dt_Cust_Cert_Dated.EditValue = oCurCustomer.Cust_Cert_Dated; txt_Cust_Cert_By.Text = oCurCustomer.Cust_Cert_By; txt_Tell.Text = oCurCustomer.Tel; txt_Handphone.Text = oCurCustomer.Handphone; txt_Tel1.Text = oCurCustomer.Tel1; txt_Fax.Text = oCurCustomer.Fax; txt_Email.Text = oCurCustomer.Email; txt_WebSite.Text = oCurCustomer.Website; //if (oCurCustomer.Locked == true) cbo_Locked.SelectedIndex = 0; //else cbo_Locked.SelectedIndex = 1; //txt_UserCreate.Text = Program.User.User_ID; txt_VATCode.Text = oCurCustomer.VATCode; oSelectedBranch = Program.FindBranch(oCurCustomer.Branch_ID); if (oSelectedBranch != null) { lookUEdit_BranchID.EditValue = oSelectedBranch.ID; txt_BranchName.Text = oSelectedBranch.Name; } dt_ApprovedTime.EditValue = oCurCustomer.ApprovedTime; dt_Last_Date.EditValue = oCurCustomer.LastUpdate; if (oCurCustomer.Approved == true) { cbo_Approved.SelectedIndex = 0; } else { cbo_Approved.SelectedIndex = 1; } dt_DateCreated.EditValue = oCurCustomer.DateCreated; oSelectedSector = new Account.Common.Entities.Sector_Info(); oSelectedSector = Program.FindSector(oCurCustomer.Sector); if (oSelectedSector != null) { lookUEdit_Sector.EditValue = oSelectedSector.ID + "-" + oSelectedSector.Name; } oSelectedIndustry = new Account.Common.Entities.Industry_Info(); oSelectedIndustry = Program.FindIndustry(oCurCustomer.Industry); if (oSelectedIndustry != null) { lookUEdit_Industry.EditValue = oSelectedIndustry.ID + "-" + oSelectedIndustry.Name; } }
private bool CheckValue() { if (txt_CustomerID.Text.Trim() == string.Empty) { return(DialogMess("Bạn chưa nhập mã khách hàng!", MessageBoxIcon.Stop, txt_CustomerID)); } else { oSelectedCustomer = Program.FindCustomer(txt_CustomerID.Text.Trim()); if (oSelectedCustomer == null || oSelectedCustomer.ID == null) { return(DialogMess("Mã khách hàng chưa đúng!", MessageBoxIcon.Stop, txt_CustomerID)); } } if (txt_Name.Text.Trim() == string.Empty) { return(DialogMess("Bạn chưa nhập tên tài khoản!", MessageBoxIcon.Stop, txt_Name)); } if (oSelectedAccountGL == null) { return(DialogMess("Bạn chưa chọn sổ cái!", MessageBoxIcon.Stop, lookUEdit_Account_GL)); } if (oSelectedCate == null) { return(DialogMess("Bạn chưa chọn Categories!", MessageBoxIcon.Stop, lookUEdit_Categories)); } //if (dtOpenDate.DateTime == null || dtOpenDate.Text.Trim() == string.Empty) // return DialogMess("Bạn chưa chọn thời gian mở tài khoản!", MessageBoxIcon.Stop, dtOpenDate); //if (dtClosedDate.DateTime == null || dtClosedDate.Text.Trim() == string.Empty) // return DialogMess("Bạn chưa chọn ngày đóng hồ sơ!", MessageBoxIcon.Stop, dtClosedDate); //if (dtLastDate.DateTime == null || dtLastDate.Text.Trim() == string.Empty) // return DialogMess("Bạn chưa chọn ngày cuối cùng cập nhật hồ sơ!", MessageBoxIcon.Stop, dtLastDate); //if (dtLastDate.DateTime < dtOpenDate.DateTime) // return DialogMess("Thời gian cập nhật cuối cùng chưa phù hợp!", MessageBoxIcon.Stop, dtLastDate); //if (dtApprovedTime.DateTime != null && dtApprovedTime.DateTime >= dtOpenDate.DateTime) // return DialogMess("Thời gian phê duyệt không hợp lệ!", MessageBoxIcon.Stop, dtApprovedTime); if (cbo_Approved.SelectedIndex < 0) { return(DialogMess("Bạn chưa chọn trạng thái phê duyệt tài khoản!", MessageBoxIcon.Stop, cbo_Approved)); } if (oSelectedCustomer == null) { return(DialogMess("Bạn chưa chọn khách hàng!", MessageBoxIcon.Stop, txt_CustomerID)); } if (oSelectedBranch == null) { return(DialogMess("Bạn chưa chọn chi nhánh!", MessageBoxIcon.Stop, lookUEdit_Account_GL)); } if (oSelectedCcy == null) { return(DialogMess("Bạn chưa chọn loại tiền tệ!", MessageBoxIcon.Stop, cbo_Ccy)); } return(true); }
private void sbtnDel_Click(object sender, EventArgs e) { Program.eButton = Program.Button.Del; oCustomer = frmCustomerList.oSelectedCustomerInfo; if (UIProviders.UICustomer.Delete_Auth(oCustomer.ID) != 0) { MessageBox.Show(UIProviders.UICustomer.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Delete_Customer(oCustomer); }
private void sbtnNew_Click(object sender, EventArgs e) { Program.eButton = Program.Button.New; oCustomer = new Account.Common.Entities.Customer_Info(); Clear(); txt_UserCreate.Text = Program.CurrentUser.User_ID; dt_DateCreated.DateTime = DateTime.Now; dt_Last_Date.DateTime = DateTime.Now; Enable(true); txt_Ref.Focus(); }
private void sbtnEdit_Click(object sender, EventArgs e) { Program.eButton = Program.Button.Edit; oCustomer = frmCustomerList.oSelectedCustomerInfo; if (UIProviders.UICustomer.Update_Auth(oCustomer) != 0) { MessageBox.Show(UIProviders.UICustomer.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } txt_UserCreate.Text = Program.CurrentUser.User_ID; dt_Last_Date.DateTime = DateTime.Now; Enable(true); txt_Ref.Focus(); }
private void Update_Customer(Account.Common.Entities.Customer_Info oCustomer) { if (Account.UIProviders.UICustomer.Update(oCustomer) == 0) { MessageBox.Show("Cập nhật thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCustomerList.lstCustomerInfo.Remove(frmCustomerList.oSelectedCustomerInfo); frmCustomerList.lstCustomerInfo.Insert(frmCustomerList.lstCustomerInfo.Count, oCustomer); Enable(false); Program.eButton = Program.Button.None; } else { MessageBox.Show(Account.UIProviders.UICustomer.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Enable(true); } }
private void txt_CustomerID_LostFocus(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_CustomerID.Text)) { return; } else { oSelectedCustomer = Program.FindCustomer(txt_CustomerID.Text); if (oSelectedCustomer == null) { DialogMess("Mã khách hàng không có", MessageBoxIcon.Error, txt_CustomerID); } else { txt_Name.Text = oSelectedCustomer.Name; } } }
private void Insert_Customer(Account.Common.Entities.Customer_Info oCustomer) { oCustomer.ID = Account.UIProviders.UICustomer.GenerateID(); if (oCustomer.ID == string.Empty) { MessageBox.Show("Xảy ra lỗi trong quá trình tạo khách hàng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (Account.UIProviders.UICustomer.Insert(oCustomer) == 0) { MessageBox.Show("Thêm mới thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); oCustomer = Account.UIProviders.UICustomer.GetCustomerByID(oCustomer.ID); frmCustomerList.lstCustomerInfo.Insert(frmCustomerList.lstCustomerInfo.Count, oCustomer); Enable(false); Program.eButton = Program.Button.None; } else { MessageBox.Show(Account.UIProviders.UICustomer.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); Enable(true); } }
private void sbtnDetail_Click(object sender, EventArgs e) { if (gridView1.FocusedRowHandle < 0) { return; } else { string ID = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gcolID).ToString(); for (int i = 0; i < lstCustomerInfo.Count; i++) { if (lstCustomerInfo[i].ID == ID) { oSelectedCustomerInfo = lstCustomerInfo[i]; frmCustomer ofrm = new frmCustomer(); ofrm.ShowDialog(); SetDataSource(); break; } } } }
private void txt_CustomerId_LostFocus(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_CustomerId.Text)) { return; } else { Account.Common.Entities.Customer_Info custInfo = Program.FindCustomer(txt_CustomerId.Text); if (custInfo == null) { MessageBox.Show("Không tìm thấy mã khách hàng này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); txt_CustomerId.Text = string.Empty; txt_CustomerId.Focus(); txt_Name.Text = string.Empty; return; } else { txt_Name.Text = custInfo.Name; } } }
private void Detail_Account(Account.Common.Entities.Account_Info oCurAccount) { txt_AccountID.Text = oCurAccount.Account_ID; txt_Ref.Text = oCurAccount.Reference; txt_Name.Text = oCurAccount.Name; oSelectedCustomer = Program.FindCustomer(oCurAccount.Customer_ID); if (oSelectedCustomer != null) { txt_CustomerID.Text = oSelectedCustomer.ID; } oSelectedAccountGL = Program.FindAccount_GL(oCurAccount.Account_GL); if (oSelectedAccountGL != null) { lookUEdit_Account_GL.EditValue = oSelectedAccountGL.Account_ID; lookUEdit_Account_GL.Text = oSelectedAccountGL.Name; } oSelectedBranch = Program.FindBranch(oCurAccount.Branch_ID); if (oSelectedBranch != null) { lookUEdit_BranchID.EditValue = oSelectedBranch.ID; txt_BranchName.Text = oSelectedBranch.Name; } dtOpenDate.EditValue = oCurAccount.Open_Date; dtLastDate.EditValue = oCurAccount.Last_Date; dtApprovedTime.EditValue = oCurAccount.ApprovedTime; if (oCurAccount.Approved == true) { cbo_Approved.SelectedIndex = 0; } else { cbo_Approved.SelectedIndex = 1; } dtClosedDate.EditValue = oCurAccount.Closed_date; if (oCurAccount.Closed == true) { cbo_Closed.SelectedIndex = 0; } else { cbo_Closed.SelectedIndex = 1; } if (oCurAccount.Locked == true) { cbo_Locked.SelectedIndex = 0; } else { cbo_Locked.SelectedIndex = 1; } oSelectedCate = Program.FindCategories(oCurAccount.Categories); if (oSelectedCate != null) { lookUEdit_Categories.EditValue = oSelectedCate.ID; lookUEdit_Categories.Text = oSelectedCate.Name; } txt_UserCreate.Text = oCurAccount.UserCreate; txt_bCredit.EditValue = oCurAccount.b_Credit; for (int i = 0; i < arrAccType.Length; i++) { if (arrAccType[i].ToString() == oCurAccount.CreditDebit.ToString()) { cbo_CreditDebit.SelectedIndex = i; break; } } oSelectedCcy = Program.FindCcy(oCurAccount.Ccy); if (oSelectedCcy != null) { cbo_Ccy.SelectedValue = oSelectedCcy; cbo_Ccy.SelectedValue = oSelectedCcy.Code; } txt_dCredit.EditValue = oCurAccount.d_Credit; txt_dDebit.EditValue = oCurAccount.d_Debit; txt_qCredit.EditValue = oCurAccount.q_Credit; txt_qDebit.EditValue = oCurAccount.q_Debit; txt_mCredit.EditValue = oCurAccount.m_Credit; txt_mDebit.EditValue = oCurAccount.m_Debit; txt_yCredit.EditValue = oCurAccount.y_Credit; txt_yDebit.EditValue = oCurAccount.y_Debit; txt_AmountBlock.EditValue = oCurAccount.Amount_Blocked; txt_Bal.EditValue = oCurAccount.Balance; txt_BalAvai.EditValue = oCurAccount.BalanceAvaiable; if (oCurAccount.Locked == true) { sbtnLocked.Text = "Bỏ khóa"; } else { sbtnLocked.Text = "Khóa"; } }