private void btn_AddNew_Click(object sender, RoutedEventArgs e) { if (!CheckValidate.checkForType(txt_Type.Text.ToString())) { MessageBox.Show("Type must be characters.", "Error!"); } if (!CheckValidate.checkForPrice(txt_Price.Text.ToString())) { MessageBox.Show("Price must be numbers, can use Comma and Decimal.", "Error!"); } if (!CheckValidate.checkForInventory(txt_Inventory.Text.ToString())) { MessageBox.Show("Inventory must be natural numbers.", "Error!"); } if (CheckValidate.checkForType(txt_Type.Text.ToString()) && CheckValidate.checkForPrice(txt_Price.Text.ToString()) && CheckValidate.checkForInventory(txt_Inventory.Text.ToString())) { cmd = new SqlCommand("INSERT INTO tbl_product(type, description, price, inventory) values(@type, @description, @price, @inventory)", sqlCon); sqlCon.Open(); cmd.Parameters.AddWithValue("@type", txt_Type.Text); cmd.Parameters.AddWithValue("@description", txt_Description.Text); cmd.Parameters.AddWithValue("@price", txt_Price.Text); cmd.Parameters.AddWithValue("@inventory", txt_Inventory.Text); cmd.ExecuteNonQuery(); sqlCon.Close(); MessageBox.Show("Data Inserted Successfully !!!", "Message"); LoadData(); RefreshTextFields(); } }
private void dgrFee_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { try { string tem = ""; if (e.EditingElement.ToString() != "") { tem = ((System.Windows.Controls.TextBox)(e.EditingElement)).Text; } if (tem == "") { c_ok = false; DataGridHelper.NVSFocus(dgrFee, 0, 2); } tem = tem.Replace(",", "").Trim(); if (!CheckValidate.CheckGiaDuong(tem)) { c_ok = false; DataGridHelper.NVSFocus(dgrFee, 0, 2); } else { c_ok = true; } } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
private void btn_Update_Click(object sender, RoutedEventArgs e) { if (!CheckValidate.checkForType(txt_Type.Text.ToString())) { MessageBox.Show("Type must be characters with start by Uppercase.", "Error!"); } if (!CheckValidate.checkForPrice(txt_Price.Text.ToString())) { MessageBox.Show("Price must be numbers, can use Comma and Decial.", "Error!"); } if (!CheckValidate.checkForInventory(txt_Inventory.Text.ToString())) { MessageBox.Show("Inventory must be natural numbers.", "Error!"); } if (CheckValidate.checkForType(txt_Type.Text.ToString()) && CheckValidate.checkForPrice(txt_Price.Text.ToString()) && CheckValidate.checkForInventory(txt_Inventory.Text.ToString())) { cmd = new SqlCommand("update tbl_product SET type = @type, description = @description, price = @price, inventory = @inventory WHERE product_id = @product_id ", sqlCon); sqlCon.Open(); cmd.Parameters.AddWithValue("@type", txt_Type.Text); cmd.Parameters.AddWithValue("@description", txt_Description.Text); cmd.Parameters.AddWithValue("@price", txt_Price.Text); cmd.Parameters.AddWithValue("@inventory", txt_Inventory.Text); cmd.Parameters.AddWithValue("@product_id", product_id); cmd.ExecuteNonQuery(); sqlCon.Close(); MessageBox.Show("Data Updated Successfully !!!", "Message"); LoadData(); RefreshTextFields(); btn_Update.IsEnabled = false; btn_Delete.IsEnabled = false; btn_Refresh.IsEnabled = false; btn_AddNew.IsEnabled = true; txt_Type.IsEnabled = true; } }
/// <summary> /// check so số thập phân /// </summary> /// <param name="txt"></param> /// <returns></returns> public static string NhapSoTp(TextBox txt) { try { if (!CheckValidate.checksothapphan(txt.Text) && txt.Text != "") { string s = txt.Text; if (s.Length > 1) { txt.Text = s.Remove(s.Length - 1, 1); } else { txt.Text = ""; } txt.Select(txt.Text.Length, 0); } return(txt.Text); } catch (Exception ex) { return(""); throw ex; } }
protected void btRegister_Click(object sender, EventArgs e) { string name = this.txtName.Text; string phone = this.txtPhone.Text; if (!CheckValidate.VerifyPhoneNumber(phone)) { this.thongBao.Text = "Error phone!"; } else { string email = this.txtEmail.Text; string pass = this.txtPass.Text; string username = this.txtUsername.Text; bool gender = true; if (this.rdFemale.Checked) { gender = false; } int idRegion = Convert.ToInt32(this.drRegion.SelectedValue); int idSite = Convert.ToInt32(this.drSite.SelectedValue); DateTime dob = this.dob.SelectedDate; if (AccountDAO.insertAccount(name, phone, email, username, pass, dob, gender, idRegion, idSite)) { Response.Redirect("../../Default.aspx"); } else { this.txtName.Text = "Login fail!"; } } }
bool CheckValidate_F() { try { if (txtFullName.Text == "") { NoteBox.Show("Tên đầy đủ không được để trống không được để trống", "Lỗi", NoteBoxLevel.Error); txtFullName.Focus(); return(false); } else if (txtUserName.Text == "") { NoteBox.Show("Tên đăng nhập không được để trống không được để trống", "Lỗi", NoteBoxLevel.Error); txtUserName.Focus(); return(false); } else if (txtUserName.Text.Contains(" ")) { NoteBox.Show("Tên đăng nhập không được chứa dấu cách", "Lỗi", NoteBoxLevel.Error); txtUserName.Focus(); return(false); } else if (c_type == Convert.ToInt16(Form_Type.Insert) && !CheckUserNotSame(txtUserName.Text.Trim())) { NoteBox.Show("Tên đăng nhập đã tồn tại trong CSDL", "Lỗi", NoteBoxLevel.Error); txtUserName.Focus(); return(false); } else if (txtPass.Text == "") { NoteBox.Show("Mật khẩu không được để trống không được để trống"); txtPass.Focus(); return(false); } else if (CheckValidate.checkAllSpace(txtPass.Text)) { NoteBox.Show("Mật khẩu không được chứa toàn dấu cách", "Lỗi", NoteBoxLevel.Error); txtPass.Focus(); return(false); } return(true); } catch (Exception ex) { CommonData.log.Error(ex.ToString()); return(false); } }
bool Check_validate_Fee_Extend() { try { if (c_lst_Fee_Extend.Count == 0) { NoteBox.Show("Không có thông tin thanh toán phí gia hạn", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); txtFee_Extend.Focus(); return(false); } if (c_ok_Extend == false) { NoteBox.Show("Số tiền 1 lần thanh toán gia hạn không đúng định dạng", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dgrFee_Extend.Focus(); return(false); } for (int i = 0; i < c_lst_Fee_Extend.Count; i++) { Fees_Revenue_Info item = c_lst_Fee_Extend[i]; string _tem = item.Fee_Expected.ToString().Replace(",", "").Trim(); if (CheckValidate.CheckGiaDuong(_tem) == false) { tabExtend.Focus(); UpdateLayout(); DataGridHelper.NVSFocus(dgrFee_Extend, i, 2); return(false); } } return(true); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); return(false); } }
// public static string GetDay(string strdate) { try { if (CheckValidate.CheckValidDate(strdate) == true) { DateTime _dt; _dt = ConvertString2Date(strdate); return(_dt.Day.ToString()); } else { return(""); } } catch { return(""); } }
private bool GroupUser_CheckValidate() { try { string name = txtName.Text; if (name == "") { NoteBox.Show("Tên nhóm người dùng không được để trống", "Lỗi", NoteBoxLevel.Error); txtName.Focus(); return(false); } else if (CheckValidate.checkAllSpace(name)) { NoteBox.Show("Tên nhóm người dùng không được chứa toàn dấu cách", "Lỗi", NoteBoxLevel.Error); txtName.Clear(); txtName.Focus(); return(false); } else if (!CheckNameNotSame(txtName.Text.Trim().ToUpper())) { NoteBox.Show("Tên nhóm người dùng đã tồn tại trong cơ sở dữ liệu", "Lỗi", NoteBoxLevel.Error); txtName.Focus(); return(false); } else { return(true); } } catch (Exception ex) { CommonData.log.Error(ex.ToString()); return(false); } }
void Search() { try { Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; if (dpFromDate.Text == "") { NoteBox.Show("Thời gian từ ngày không được để trống", "", NoteBoxLevel.Error); dpFromDate.Focus(); return; } if (CheckValidate.CheckValidDate(dpFromDate.Text) == false) { NoteBox.Show("Thời gian từ ngày không đúng định dạng", "", NoteBoxLevel.Error); dpFromDate.Focus(); return; } if (dpToDate.Text == "") { NoteBox.Show("Thời gian đến ngày không được để trống", "", NoteBoxLevel.Error); dpToDate.Focus(); return; } if (CheckValidate.CheckValidDate(dpToDate.Text) == false) { NoteBox.Show("Thời gian đến ngày không đúng định dạng", "", NoteBoxLevel.Error); dpToDate.Focus(); return; } if (ConvertData.ConvertString2Date(dpFromDate.Text).Date > ConvertData.ConvertString2Date(dpToDate.Text).Date) { NoteBox.Show("Thời gian từ ngày phải nhỏ hơn đến ngày", "", NoteBoxLevel.Error); dpFromDate.Focus(); return; } string _created_by = cboCreatedBy.SelectedValue.ToString().ToUpper(); if (_created_by == "") { _created_by = "ALL"; } string _estate_code = cboEsateCode.SelectedValue.ToString().ToUpper(); if (_estate_code == "") { _estate_code = "ALL"; } string _user = txtUser.Text.ToUpper(); if (_user == "") { _user = "******"; } string _Customer = txtCustomer.Text.ToUpper(); if (_Customer == "") { _Customer = "ALL"; } DateTime _fromdate = ConvertData.ConvertString2Date(dpFromDate.Text); DateTime _todate = ConvertData.ConvertString2Date(dpToDate.Text); string _str_from_date = ConvertData.ConvertDate2String(_fromdate); string _str_to_date = ConvertData.ConvertDate2String(_todate); c_lst = c_Fees_Revenue_Controller.Fees_Report(_str_from_date, _str_to_date, _created_by, _estate_code, _user, _Customer); Mouse.OverrideCursor = null; dgrContract.ItemsSource = c_lst; DataGridHelper.NVSFocus(dgrContract, 0, 0); } catch (Exception ex) { Mouse.OverrideCursor = null; ErrorLog.log.Error(ex.ToString()); } }
void Accept() { try { if (txtFeePay.Text == "") { NoteBox.Show("Số tiền thanh toán không được để trống"); txtFeePay.Focus(); return; } if (dpPay_Date.Text == "") { NoteBox.Show("Ngày thanh toán không được để trống", "", NoteBoxLevel.Error); dpPay_Date.Focus(); return; } if (CheckValidate.CheckValidDate(dpPay_Date.Text) == false) { NoteBox.Show("Ngày thanh toán không đúng định dạng", "", NoteBoxLevel.Error); dpPay_Date.Focus(); return; } Fees_Revenue_Info _Fees_Revenue_Info = new Fees_Revenue_Info(); _Fees_Revenue_Info.Fee_Id = c_Fees_MustPay.Fee_Id; _Fees_Revenue_Info.Pay_Date = Common.ConvertData.ConvertString2Date(dpPay_Date.Text); _Fees_Revenue_Info.Fee = Convert.ToDecimal(txtFeePay.Text); _Fees_Revenue_Info.Debit_Amount = c_Fees_MustPay.Fee_Expected - _Fees_Revenue_Info.Fee; _Fees_Revenue_Info.Pay_Status = (decimal)Enum_Fee_Status.Payed; MessageBoxResult result = NoteBox.Show("Bạn có muốn thanh toán phí môi giới cho hợp đồng này hay không?", "Thông báo", NoteBoxLevel.Question); if (MessageBoxResult.Yes != result) { return; } if (_Fees_Revenue_Controller.Fees_Revenue_Update(_Fees_Revenue_Info) == false) { NoteBox.Show("Lỗi thanh toán", "", NoteBoxLevel.Error); return; } Contract_Info _Contract_Info = c_Contract_Info; if (c_index == c_lst_Fee_All.Count - 1) { _Contract_Info.Fee_Status = (decimal)Enum_Fee_Status.Payed; } else { _Contract_Info.Fee_Status = (decimal)Enum_Fee_Status.No_Pay; } if (_Contract_Controller.Contract_Update(c_Contract_Info.Contract_Id, _Contract_Info) == false) { NoteBox.Show("Lỗi cập nhật hợp đồng cho thuê nhà", "", NoteBoxLevel.Error); return; } NoteBox.Show("Thanh toán phí thành công"); c_ok = true; this.Close(); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); } }
bool Tenat_CheckValidate() { try { #region Tenat if (txtChose_Estate_Object.Text == "") { NoteBox.Show("Tên đối tượng BĐS không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtChose_Estate_Object.Focus(); return(false); } if (_Contract_Controller.CheckEstateByContract(c_Estate_Object_Info_Search.Estate_Id, (decimal)Enum_Contract_Type.Tenant) == false) { NoteBox.Show("Đối tượng BĐS được cho thuê", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtChose_Estate_Object.Focus(); return(false); } if (txtRenter_Name.Text == "") { NoteBox.Show("Tên công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRenter_Name.Focus(); return(false); } if (txtAddress.Text == "") { NoteBox.Show("Địa chỉ công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtAddress.Focus(); return(false); } if (txtRepresentive.Text == "") { NoteBox.Show("Tên người đại diện không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRepresentive.Focus(); return(false); } if (txtPhone.Text == "") { NoteBox.Show("Số điện thoại không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtPhone.Focus(); return(false); } if (txtUsers.Text == "") { NoteBox.Show("Người sử dụng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtUsers.Focus(); return(false); } #endregion #region Contract if (txtContract_Code.Text == "") { NoteBox.Show("Mã hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } if (!_Contract_Controller.Check_ExistContractCode(txtContract_Code.Text)) { NoteBox.Show("Mã hợp đồng đã tồn tại, tạo lại mã", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } if (dpContractDate.Text == "") { NoteBox.Show("Ngày ký hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpContractDate.Text) == false) { NoteBox.Show("Ngày ký hợp đồng không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (txtPrice.Text == "") { NoteBox.Show("Tiền thuê nhà không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtPrice.Focus(); return(false); } if (dpFromDate.Text == "") { NoteBox.Show("Thời gian thuê từ ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpFromDate.Text) == false) { NoteBox.Show("Thời gian thuê từ ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (dpToDate.Text == "") { NoteBox.Show("Thời gian thuê đến ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpToDate.Text) == false) { NoteBox.Show("Thời gian thuê đến ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (ConvertData.ConvertString2Date(dpFromDate.Text).Date > ConvertData.ConvertString2Date(dpToDate.Text).Date) { NoteBox.Show("Thời gian thuê từ ngày phải nhỏ hơn đến ngày", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } #endregion #region Fee if (txtFee.Text == "") { NoteBox.Show("Phí môi giới không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFee.Focus(); return(false); } if (txtFeeOnePay.Text == "") { NoteBox.Show("Số tiền 1 lần thanh toán không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFeeOnePay.Focus(); return(false); } if (Check_validate_Fee() == false) { tabFee.Focus(); UpdateLayout(); return(false); } #endregion return(true); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); return(false); } }
bool Renter_CheckValidate() { try { #region Renter if (txtChose_Estate_Object.Text == "") { NoteBox.Show("Tên đối tượng BĐS không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtChose_Estate_Object.Focus(); return(false); } if (_Contract_Controller.CheckEstateByContract(c_Estate_Object_Info_Search.Estate_Id, (decimal)Enum_Contract_Type.Renter) == false) { NoteBox.Show("Đối tượng BĐS được cho thuê", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtChose_Estate_Object.Focus(); return(false); } if (txtRenter_Name.Text == "") { NoteBox.Show("Tên công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRenter_Name.Focus(); return(false); } if (txtAddress.Text == "") { NoteBox.Show("Địa chỉ công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtAddress.Focus(); return(false); } if (txtUsers.Text == "") { NoteBox.Show("Tên người sử dụng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtUsers.Focus(); return(false); } if (txtRepresentive.Text == "") { NoteBox.Show("Tên người đại diện không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRepresentive.Focus(); return(false); } if (txtPhone.Text == "") { NoteBox.Show("Số điện thoại không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtPhone.Focus(); return(false); } #endregion #region Contract if (txtContract_Code.Text == "") { NoteBox.Show("Mã hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } //if (txtContract_Name.Text == "") //{ // NoteBox.Show("Tên hợp đồng không được để trống", "", NoteBoxLevel.Error); // tabContract.Focus(); // UpdateLayout(); // txtContract_Name.Focus(); // return false; //} if (!_Contract_Controller.Check_ExistContractCode(txtContract_Code.Text)) { NoteBox.Show("Mã hợp đồng đã tồn tại, tạo lại mã", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } if (txtPrice.Text == "") { NoteBox.Show("Tiền thuê nhà không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtPrice.Focus(); return(false); } if (dpFromDate.Text == "") { NoteBox.Show("Thời gian thuê từ ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpFromDate.Text) == false) { NoteBox.Show("Thời gian thuê từ ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (dpToDate.Text == "") { NoteBox.Show("Thời gian thuê đến ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpToDate.Text) == false) { NoteBox.Show("Thời gian thuê đến ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (dpContractDate.Text == "") { NoteBox.Show("Ngày ký hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpContractDate.Text) == false) { NoteBox.Show("Ngày ký hợp đồng không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (ConvertData.ConvertString2Date(dpFromDate.Text).Date > ConvertData.ConvertString2Date(dpToDate.Text).Date) { NoteBox.Show("Thời gian thuê từ ngày phải nhỏ hơn đến ngày", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } #endregion #region Fee if (txtFee.Text == "") { NoteBox.Show("Phí môi giới không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFee.Focus(); return(false); } if (!Check_validate_Fee()) { UpdateLayout(); txtFee.Focus(); return(false); } decimal _currecy = Convert.ToDecimal(cboCurrency.SelectedValue); if ((_currecy == (decimal)Enum_Contract_Currency.USD) && txtFee_Vnd.Text == "") { NoteBox.Show("Phí môi giới (VND) không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFee_Vnd.Focus(); return(false); } #endregion return(true); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); return(false); } }
bool Renter_CheckValidate() { try { #region Renter if (txtRenter_Name.Text == "") { NoteBox.Show("Tên công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRenter_Name.Focus(); return(false); } if (txtAddress.Text == "") { NoteBox.Show("Địa chỉ công ty yêu cầu môi giới không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtAddress.Focus(); return(false); } if (txtPhone.Text == "") { NoteBox.Show("Số điện thoại không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtPhone.Focus(); return(false); } #endregion #region Contract if (txtContract_Code.Text == "") { NoteBox.Show("Mã hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } if (!_Contract_Controller.Check_ExistContractCode(txtContract_Code.Text) && txtContract_Code.Text != c_Contract_Info.Contract_Code) { NoteBox.Show("Mã hợp đồng đã tồn tại, tạo lại mã", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtContract_Code.Focus(); return(false); } if (dpFromDate.Text == "") { NoteBox.Show("Thời gian thuê từ ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpFromDate.Text) == false) { NoteBox.Show("Thời gian thuê từ ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (dpToDate.Text == "") { NoteBox.Show("Thời gian thuê đến ngày không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpToDate.Text) == false) { NoteBox.Show("Thời gian thuê đến ngày không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpToDate.Focus(); return(false); } if (dpContractDate.Text == "") { NoteBox.Show("Ngày ký hợp đồng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpContractDate.Text) == false) { NoteBox.Show("Ngày ký hợp đồng không đúng định dạng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpContractDate.Focus(); return(false); } if (ConvertData.ConvertString2Date(dpFromDate.Text).Date > ConvertData.ConvertString2Date(dpToDate.Text).Date) { NoteBox.Show("Thời gian thuê từ ngày phải nhỏ hơn đến ngày", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); dpFromDate.Focus(); return(false); } if (txtUsers.Text == "") { NoteBox.Show("Tên người sử dụng không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtUsers.Focus(); return(false); } if (txtRepresentive.Text == "") { NoteBox.Show("Tên người đại diện không được để trống", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); txtRepresentive.Focus(); return(false); } #endregion #region Fee if (txtFee.Text == "") { NoteBox.Show("Phí môi giới không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFee.Focus(); return(false); } if (Check_validate_Fee() == false) { tabFee.Focus(); UpdateLayout(); txtFee.Focus(); return(false); } decimal _currecy = Convert.ToDecimal(cboCurrency.SelectedValue); if ((_currecy == (decimal)Enum_Contract_Currency.USD) && txtFee_Vnd.Text == "") { NoteBox.Show("Phí môi giới (VND) không được để trống", "", NoteBoxLevel.Error); tabFee.Focus(); UpdateLayout(); txtFee_Vnd.Focus(); return(false); } #endregion #region Extend if (Convert.ToDecimal(cboStatusContract.SelectedValue) == (decimal)Enum_Contract_Status.Gia_Han) { if (dpFromDate_Extend.Text == "") { NoteBox.Show("Thời gian thuê từ ngày không được để trống", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpFromDate_Extend.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpFromDate_Extend.Text) == false) { NoteBox.Show("Thời gian thuê từ ngày không đúng định dạng", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpFromDate_Extend.Focus(); return(false); } if (dpToDate_Extend.Text == "") { NoteBox.Show("Thời gian thuê đến ngày không được để trống", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpToDate_Extend.Focus(); return(false); } if (CheckValidate.CheckValidDate(dpToDate_Extend.Text) == false) { NoteBox.Show("Thời gian thuê đến ngày không đúng định dạng", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpToDate_Extend.Focus(); return(false); } if (ConvertData.ConvertString2Date(dpFromDate_Extend.Text).Date > ConvertData.ConvertString2Date(dpToDate_Extend.Text).Date) { NoteBox.Show("Thời gian thuê từ ngày phải nhỏ hơn đến ngày", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); dpFromDate_Extend.Focus(); return(false); } if (txtFee_Extend.Text == "") { NoteBox.Show("Phí môi giới không được để trống", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); txtFee_Extend.Focus(); return(false); } if (Check_validate_Fee_Extend() == false) { tabExtend.Focus(); UpdateLayout(); txtFee_Extend.Focus(); return(false); } if ((_currecy == (decimal)Enum_Contract_Currency.USD) && txtFee_Vnd_Extend.Text == "") { NoteBox.Show("Phí môi giới (VND) không được để trống", "", NoteBoxLevel.Error); tabExtend.Focus(); UpdateLayout(); txtFee_Vnd_Extend.Focus(); return(false); } } #endregion if ((Convert.ToDecimal(cboStatusContract.SelectedValue) == (decimal)Enum_Contract_Status.Close || Convert.ToDecimal(cboStatusContract.SelectedValue) == (decimal)Enum_Contract_Status.Het_Han || Convert.ToDecimal(cboStatusContract.SelectedValue) == (decimal)Enum_Contract_Status.Dong_Trc_Thoi_Han) && Check_Is_DongHopDong() == false) { NoteBox.Show("Chưa thanh toán hết phí không thể đóng hoặc sửa trạng thái hợp đồng", "", NoteBoxLevel.Error); tabContract.Focus(); UpdateLayout(); cboStatusContract.Focus(); return(false); } return(true); } catch (Exception ex) { ErrorLog.log.Error(ex.ToString()); return(false); } }
private void btnSearch_Click(object sender, RoutedEventArgs e) { try { if (txtCustomer_Name.Text != "") { c_customer_name = txtCustomer_Name.Text; } else { c_customer_name = "ALL"; } if (txtSoHoaDon.Text != "") { c_shd = txtSoHoaDon.Text; } else { c_shd = "ALL"; } if (dpSaleDate.Text != "" && !CheckValidate.CheckValidDate(dpSaleDate.Text)) { NoteBox.Show("Ngày bán từ không đúng định dạng", "", NoteBoxLevel.Error); dpSaleDate.Focus(); return; } if (dpSaleDateTo.Text != "" && !CheckValidate.CheckValidDate(dpSaleDateTo.Text)) { NoteBox.Show("Ngày bán đến không đúng định dạng", "", NoteBoxLevel.Error); dpSaleDate.Focus(); return; } if (dpSaleDate.Text != "" && dpSaleDateTo.Text != "" && Common.ConvertData.ConvertString2Date(dpSaleDate.Text) > Common.ConvertData.ConvertString2Date(dpSaleDate.Text)) { NoteBox.Show("Ngày bán từ phải nhỏ hơn ngày bán đến không đúng định dạng", "", NoteBoxLevel.Error); dpSaleDate.Focus(); return; } if (dpSaleDate.Text != "") { c_str_date = Common.ConvertData.ConvertString2Date(dpSaleDate.Text).ToString("dd/MM/yyyy"); } else { c_str_date = "ALL"; } if (dpSaleDateTo.Text != "") { c_str_date_to = Common.ConvertData.ConvertString2Date(dpSaleDateTo.Text).ToString("dd/MM/yyyy"); } else { c_str_date_to = "ALL"; } c_lst = c_Sale_Header_Controller.Sale_Header_Search(c_shd, c_str_date, c_str_date_to, c_customer_name, Convert.ToInt16(ThuChi_Type.Ban_Buon)); dgrSaleHeader.ItemsSource = c_lst; DataGridHelper.NVSFocus(dgrSaleHeader, 0, 0); } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
bool CheckValidate_F() { try { if (txtProduct_Name.Text == "") { NoteBox.Show("Tên áo không được để trống"); txtProduct_Name.Focus(); return(false); } else if (cboItem_Type.Text == "") { NoteBox.Show("Loại sản phẩm không được để trống"); cboItem_Type.Focus(); return(false); } else if (txtProductCode.Text == "") { NoteBox.Show("Mã sản phẩm không được để trống"); txtProductCode.Focus(); return(false); } else if (txtCount_J.Text == "") { NoteBox.Show("Số dây áo không được để trống"); txtCount_J.Focus(); return(false); } //else if (ckb_Is_XuatDu.IsChecked == true && c_j_ao > 1) //{ // NoteBox.Show("Hàng xuất dư chỉ được nhập 1 dây áo"); // txtCount_J.Focus(); // return false; //} else if (txtCount.Text == "") { NoteBox.Show("Số áo/dây không được để trống"); txtCount.Focus(); return(false); } else if (dpReceiveDate.Text == "") { NoteBox.Show("Ngày nhập không được để trống"); txtToAge.Focus(); return(false); } else if (!CheckValidate.CheckValidDate(dpReceiveDate.Text)) { NoteBox.Show("Ngày nhập không đúng định dạng"); txtToAge.Focus(); return(false); } else if (txtFromAge.Text == "") { NoteBox.Show("Size áo từ không được để trống"); txtFromAge.Focus(); return(false); } else if (txtToAge.Text == "") { NoteBox.Show("Size áo đến không được để trống"); txtToAge.Focus(); return(false); } else if (Convert.ToInt16(txtFromAge.Text) > Convert.ToInt16(txtToAge.Text)) { NoteBox.Show("Size áo từ không được lớn hơn Size áo đến"); txtFromAge.Focus(); return(false); } return(true); } catch (Exception ex) { CommonData.log.Error(ex.ToString()); return(false); } }