private void BtnOutstandingInvoiceClick(object sender, EventArgs e) { Visible = false; using (var frmOutstandingInvoice = new FrmDeposit()) { if (dgvCustomer.CurrentRow == null) { return; } frmOutstandingInvoice.CustomerId = _customerList[dgvCustomer.CurrentRow.Index].CustomerId; if (frmOutstandingInvoice.ShowDialog(this) == DialogResult.OK) { try { } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } } Visible = true; } }
private void ExpenseManagement(IEquatable <string> operationRequest) { using (var frmExpense = new FrmExpense()) { if (operationRequest.Equals(Resources.OperationRequestUpdate)) { frmExpense.Expense = _ExpenseList[dgvExpense.CurrentRow.Index]; } if (frmExpense.ShowDialog(this) == DialogResult.OK) { try { if (operationRequest.Equals(Resources.OperationRequestInsert)) { _ExpenseList.Add(frmExpense.Expense); } dgvExpense.Refresh(); UpdateResultInfo(); EnableActionButton(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } } } }
private void CtrlReport_Load(object sender, EventArgs e) { if (_SaleOrderService == null) { _SaleOrderService = ServiceFactory.GenerateServiceInstance().GenerateSaleOrderService(); } if (_depositService == null) { _depositService = ServiceFactory.GenerateServiceInstance().GenerateDepositService(); } if (_ProductService == null) { _ProductService = ServiceFactory.GenerateServiceInstance().GenerateProductService(); } if (_ExpenseService == null) { _ExpenseService = ServiceFactory.GenerateServiceInstance().GenerateExpenseService(); } try { ThreadStart threadStart = RemoveTemporaryFiles; var thread = new Thread(threadStart) { IsBackground = true }; thread.Start(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void BtnDelete_Click(object sender, EventArgs e) { string briefMsg, detailMsg; if (!UserService.AllowToPerform(Resources.PermissionDeleteCard)) { briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } //ExtendedMessageBox.InformMessage(Resources.MsgUserPermissionDeny); //return; } //if (!ExtendedMessageBox.ConfirmMessage( // "MsgOperationRequestDelete", // "\n\n" + dgvDiscountCard.CurrentRow.Cells["CardNumber"].Value)) // return; //string briefMsg, detailMsg; briefMsg = "អំពីការលុប"; detailMsg = Resources.MsgOperationRequestDelete + "\n" + dgvDiscountCard.CurrentRow.Cells["CardNumber"].Value + " ?"; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; if (frmMessageBox.ShowDialog(this) != DialogResult.OK) { return; } } try { _CustomerService.DiscountCardManagement( (DiscountCard)_DiscountCardList[dgvDiscountCard.CurrentRow.Index], Resources.OperationRequestDelete); _DiscountCardList.RemoveAt(dgvDiscountCard.CurrentRow.Index); dgvDiscountCard.Refresh(); UpdateResultInfo(); EnableActionButton(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void dgvAppParameter_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) { string briefMsg, detailMsg; if (!UserService.AllowToPerform(Resources.PermissionDeleteConfig)) { briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } //ExtendedMessageBox.InformMessage(Resources.MsgUserPermissionDeny); //return; } var appParameter = (AppParameter)_AppParamList[e.Row.Index]; briefMsg = "អំពីការលុប"; detailMsg = Resources.MsgOperationRequestDelete + "\n" + appParameter.ParameterLabel + " ?"; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; if (frmMessageBox.ShowDialog(this) != DialogResult.OK) { e.Cancel = true; return; } } //if (!ExtendedMessageBox.ConfirmMessage(Resources.MsgOperationRequestDelete, appParameter.ParameterLabel)) //{ // e.Cancel = true; // return; //} AppParamManagement(appParameter, Resources.OperationRequestDelete); _AppParamList = _CommonService .GetAppParametersByType(Int32.Parse(lsbAppParam.SelectedValue.ToString(), AppContext.CultureInfo)); cmbAppParamValue.DataSource = _AppParamList; if (StringHelper.Length(cmbAppParamValue.DisplayMember) == 0) { cmbAppParamValue.DisplayMember = AppParameter.ConstParameterValue; } if (StringHelper.Length(cmbAppParamValue.ValueMember) == 0) { cmbAppParamValue.ValueMember = AppParameter.ConstParameterId; } cmbAppParamValue.SelectedIndex = _AppParamList.Count - 1; }
private void BtnDeleteClick(object sender, EventArgs e) { string briefMsg, detailMsg; if (!UserService.AllowToPerform(Resources.PermissionDeleteCustomer)) { briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } SetFocusToCustomerList(); //string briefMsg, detailMsg; briefMsg = "អំពីការលុប"; detailMsg = Resources.MsgOperationRequestDelete + "\n" + dgvCustomer.CurrentRow.Cells["CustomerName"].Value + " ?"; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; if (frmMessageBox.ShowDialog(this) != DialogResult.OK) { return; } } try { _customerService.CustomerManagement( _customerList[dgvCustomer.CurrentRow.Index], Resources.OperationRequestDelete); ThreadStart threadStart = UpdateControlContent; var thread = new Thread(threadStart); thread.Start(); _customerList.RemoveAt(dgvCustomer.CurrentRow.Index); dgvCustomer.Refresh(); UpdateResultInfo(); EnableActionButton(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void RefreshReportDeposit(bool allDeposit) { if (!UserService.AllowToPerform(Resources.PermissionViewDepositReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } var searchCriteria = !allDeposit ? new List <string> { "(DepositDate BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)) ", "(AmountPaidInt < AmountSoldInt) ", "DepositNumber NOT IN (SELECT ReferenceNum FROM TDeposits WHERE ReferenceNum IS NOT NULL) " } : new List <string> { "(DepositDate BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)) " }; var assessmentList = _depositService.GetDepositHistories(searchCriteria, false); DataSet dtsModel = new DtsModels(); var propertyInfos = typeof(DepositReport).GetProperties(); foreach (var objInstance in assessmentList) { var dataRow = dtsModel.Tables[3].NewRow(); foreach (var propertyInfo in propertyInfos) { dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); } dtsModel.Tables[3].Rows.Add(dataRow); } var rptDeposit = new CsrDeposit(); rptDeposit.SetDataSource(dtsModel); crvReport.ReportSource = rptDeposit; }
private void btnReturnCard_Click(object sender, EventArgs e) { var discountCard = (DiscountCard)_DiscountCardList[dgvDiscountCard.CurrentRow.Index]; if (discountCard.CustomerId == 0) { return; } string briefMsg, detailMsg; if (!UserService.AllowToPerform(Resources.PermissionGetBackCard)) { briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } briefMsg = "អំពីការដកហូតប័ណ្ណបញ្ចុះតំលៃ"; detailMsg = Resources.MsgOperationRequestGetBackCard + discountCard.CustomerStr + " ។"; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; if (frmMessageBox.ShowDialog(this) != DialogResult.OK) { return; } } try { discountCard.CustomerId = 0; discountCard.CustomerStr = ""; _CustomerService.DiscountCardManagement( discountCard, Resources.OperationRequestUpdate); btnReturnCard.Enabled = false; } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void DisplayPartialPicture( int numPicture, int startIndex, int stopIndex, ScrollEventType scrollEventType) { try { if ((scrollEventType == ScrollEventType.SmallDecrement) || (scrollEventType == ScrollEventType.LargeDecrement)) { var tmpIndex = startIndex; startIndex = stopIndex; stopIndex = tmpIndex; for (var counter = startIndex + numPicture; counter < stopIndex + numPicture; counter++) { if (counter < _productList.Count) { _productList[counter].ProductPic = null; } } for (var counter = startIndex; counter < startIndex + numPicture; counter++) { SetProductPicture(_productList[counter]); } } else { for (var counter = startIndex; counter < stopIndex; counter++) { _productList[counter].ProductPic = null; if (counter >= numPicture) { break; } } for (var counter = stopIndex; counter < stopIndex + numPicture; counter++) { SetProductPicture(_productList[counter]); } } dgvProduct.Refresh(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void AppParamManagement(AppParameter appParameter, string operationRequest) { try { _CommonService.AppParameterManagement(appParameter, operationRequest); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void BtnSearchSaleClick(object sender, EventArgs e) { try { if (!UserService.AllowToPerform(Resources.PermissionByDatesReport)) { if ((!dtpStartDate.Value.Date.Equals(DateTime.Today)) || (!dtpStopDate.Value.Date.Equals(DateTime.Today))) { const string briefMsg = "សិទ្ធមើល របាយការណ៏តាមថ្ងៃ"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } } crvReport.BringToFront(); if (rdbSale.Checked) { RefreshReportSale(); } else if (rdbDeposit.Checked) { RefreshReportDeposit(chbAllDeposit.Checked); } else if (rdbReturn.Checked) { RefreshReportReturn(); } else if (rdbExpense.Checked) { RefreshDailyExpenseReport(); } else { RefreshIncomeStatementReport(); } } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); throw; } }
private void CtrlSupplier_Load(object sender, EventArgs e) { try { if (_CommonService == null) { _CommonService = ServiceFactory.GenerateServiceInstance().GenerateCommonService(); } if (_SupplierService == null) { _SupplierService = ServiceFactory.GenerateServiceInstance().GenerateSupplierService(); } if (!UserService.AllowToPerform(Resources.PermissionViewSuppResultInfo)) { lblResultInfo.Visible = false; } InitialSupplierList(); ThreadStart threadStart = UpdateControlContent; var thread = new Thread(threadStart) { IsBackground = true }; thread.Start(); //IList objList = _SupplierService.GetSuppliers(); //cmbCustomer.CustomizedDataBinding( // objList, // Customer.CONST_CUSTOMER_NAME, // Customer.CONST_CUSTOMER_Id, // false); //var customerList = new List<Customer>(); //foreach (Customer customer in objList) // customerList.Add(customer); //cmbCustomerHidden.CustomizedDataBinding( // customerList, // Customer.CONST_CUSTOMER_NAME, // Customer.CONST_CUSTOMER_Id, // false); //btnSearch_Click(sender, e); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void lsbProduct_SelectedIndexChanged(object sender, EventArgs e) { if ((lsbAppParam.SelectedIndex == -1) || (StringHelper.Length(lsbAppParam.DisplayMember) == 0) || (StringHelper.Length(lsbAppParam.ValueMember) == 0)) { return; } try { //Will change later if (Int32.Parse(lsbAppParam.SelectedValue.ToString(), AppContext.CultureInfo) == 21) { using (var frmExchangeRate = new FrmExchangeRate()) { frmExchangeRate.ShowDialog(this); return; } } _AppParamList = _CommonService.GetAppParametersByType( Int32.Parse(lsbAppParam.SelectedValue.ToString(), AppContext.CultureInfo)); dgvAppParameter.DataSource = CommonService.IListToDataTable(typeof(AppParameter), _AppParamList); cmbAppParamValue.DataSource = _AppParamList; if (StringHelper.Length(cmbAppParamValue.DisplayMember) == 0) { cmbAppParamValue.DisplayMember = AppParameter.ConstParameterValue; } if (StringHelper.Length(cmbAppParamValue.ValueMember) == 0) { cmbAppParamValue.ValueMember = AppParameter.ConstParameterId; } if (_AppParamList.Count != 0) { cmbAppParamValue.SelectedIndex = _AppParamList.Count - 1; dgvAppParameter.Columns["ParameterTypeId"].Visible = false; dgvAppParameter.Columns["ParameterLabel"].DisplayIndex = 0; dgvAppParameter.Columns["ParameterCode"].DisplayIndex = 1; dgvAppParameter.Columns["ParameterValue"].DisplayIndex = 2; } } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void BtnDeleteClick(object sender, EventArgs e) { string briefMsg, detailMsg; if (!UserService.AllowToPerform(Resources.PermissionDeleteExpense)) { briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } briefMsg = "អំពីការលុប"; detailMsg = Resources.MsgOperationRequestDelete + "\n" + dgvExpense.CurrentRow.Cells["Description"].Value + " ?"; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; if (frmMessageBox.ShowDialog(this) != DialogResult.OK) { return; } } try { _ExpenseService.ExpenseManagement(_ExpenseList[dgvExpense.CurrentRow.Index], Resources.OperationRequestDelete); _ExpenseList.RemoveAt(dgvExpense.CurrentRow.Index); dgvExpense.Refresh(); UpdateResultInfo(); EnableActionButton(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void RefreshReportReturn() { if (!UserService.AllowToPerform(Resources.PermissionViewReturnProductReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } var searchCriteria = new List <string> { "SaleOrderNumber IN (SELECT SaleOrderNumber FROM TSaleOrders WHERE SaleOrderTypeId = 1)", "SaleOrderDate BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)" }; var assessmentList = _SaleOrderService.GetSaleHistories(searchCriteria); DataSet dtsModel = new DtsModels(); var propertyInfos = typeof(SaleOrderReport).GetProperties(); foreach (var objInstance in assessmentList) { var dataRow = dtsModel.Tables[1].NewRow(); foreach (var propertyInfo in propertyInfos) { dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); } dtsModel.Tables[1].Rows.Add(dataRow); } var rptSaleReturn = new CsrSaleReturn(); rptSaleReturn.SetDataSource(dtsModel); crvReport.ReportSource = rptSaleReturn; }
private void BtnSearchClick(object sender, EventArgs e) { try { var searchCriteria = new List <string>(); if (StringHelper.Length(txtCustomerName.Text) != 0) { searchCriteria.Add("CustomerName LIKE '%" + txtCustomerName.Text + "%'"); } if (StringHelper.Length(txtPhoneNumber.Text) != 0) { searchCriteria.Add("PhoneNumber LIKE '%" + txtPhoneNumber.Text + "%'"); } if (chbDeposit.Checked) { searchCriteria.Add( "CustomerId IN (SELECT CustomerId FROM TDeposits WHERE (AmountPaidInt < AmountSoldInt) AND (DepositNumber NOT IN (SELECT ReferenceNum FROM TDeposits WHERE ReferenceNum IS NOT NULL)))"); } if (StringHelper.Length(txtCardNum.Text) != 0) { searchCriteria.Add( "CustomerId IN (SELECT CustomerId FROM TDiscountCards WHERE CustomerId <> 0 AND CardNumber LIKE '%" + StringHelper.Right("000000000" + txtCardNum.Text, 9) + "%')"); } if (cmbDCardType.SelectedIndex != -1) { searchCriteria.Add( "CustomerId IN (SELECT CustomerId FROM TDiscountCards WHERE CustomerId <> 0 AND DiscountCardTypeId = " + cmbDCardType.SelectedValue + ")"); } IListToBindingList( _customerService.GetCustomers(searchCriteria)); dgvCustomer.Refresh(); } catch (ADOException exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void BtnNewProductClick(object sender, EventArgs e) { if (!UserService.AllowToPerform(Resources.PermissionAddProduct)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } ProductManagement(Resources.OperationRequestInsert); }
private void dgvExpense_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (!UserService.AllowToPerform(Resources.PermissionEditExpense)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } ExpenseManagement(Resources.OperationRequestUpdate); }
private void RefreshDailyExpenseReport() { if (!UserService.AllowToPerform(Resources.PermissionViewExpenseReport)) { const string briefMsg = "អំពីសិទ្ឋិប្រើប្រាស់"; var detailMsg = Resources.MsgUserPermissionDeny; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); return; } } var searchCriteria = new List <string> { "CONVERT(DATETIME, ExpenseDate, 103) BETWEEN CONVERT(DATETIME, '" + dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + "', 103) AND CONVERT(DATETIME, '" + dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) + " 23:59', 103)" }; var expenseList = _ExpenseService.GetExpenses(searchCriteria); DataSet dtsProduct = new DtsModels(); var propertyInfos = typeof(Expense).GetProperties(); foreach (var objInstance in expenseList) { var dataRow = dtsProduct.Tables["DtbExpenses"].NewRow(); foreach (var propertyInfo in propertyInfos) { dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null); } dtsProduct.Tables["DtbExpenses"].Rows.Add(dataRow); } var csrExpense = new CsrExpense(); csrExpense.SetDataSource(dtsProduct); crvReport.ReportSource = csrExpense; }
private void CustomerManagement(IEquatable <string> operationRequest) { using (var frmCustomer = new FrmCustomer()) { frmCustomer.CommonService = _commonService; frmCustomer.CustomerService = _customerService; if (operationRequest.Equals(Resources.OperationRequestUpdate)) { if (dgvCustomer.CurrentRow != null) { frmCustomer.Customer = _customerList[dgvCustomer.CurrentRow.Index]; } } if (frmCustomer.ShowDialog(this) == DialogResult.OK) { try { ThreadStart threadStart = UpdateControlContent; var thread = new Thread(threadStart); thread.Start(); if (operationRequest.Equals(Resources.OperationRequestInsert)) { _customerList.Add(frmCustomer.Customer); } dgvCustomer.Refresh(); SetCustomerInfo(); UpdateResultInfo(); EnableActionButton(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } } } SetFocusToCustomerList(); }
private void IListToBindingList(IEnumerable productList) { if (productList == null) { throw new ArgumentNullException("productList", Resources.MsgInvalidProduct); } if (_productList == null) { return; } try { _productList.Clear(); foreach (var product in productList.Cast <Product>().Where(product => product != null)) { var localProduct = product; foreach (var barCode in _barCodeList.Where(barCode => localProduct.ProductCode == barCode.BarCodeValue)) { product.PrintCheck = true; product.PublicQty = barCode.AdditionalStr; break; } _productList.Add(product); } DisplayPartialPicture( dgvProduct.DisplayedRowCount(true), 0, 0, ScrollEventType.LargeIncrement); UpdateResultInfo(); EnableActionButton(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void CtrlCustomer_Load(object sender, EventArgs e) { try { if (!UserService.AllowToPerform(Resources.PermissionViewCustResultInfo)) { lblResultInfo.Visible = false; } if (_customerService == null) { _customerService = ServiceFactory.GenerateServiceInstance().GenerateCustomerService(); } if (_commonService == null) { _commonService = ServiceFactory.GenerateServiceInstance().GenerateCommonService(); } InitializeCustomerList(); ThreadStart threadStart = UpdateControlContent; var thread = new Thread(threadStart) { IsBackground = true }; thread.Start(); var discountCardList = _customerService.GetUsedDiscountCards(); cmbDiscountCard.CustomizedDataBinding( discountCardList, DiscountCard.ConstDiscountCardNumber, DiscountCard.ConstCustomerId, false); IListToBindingList(_customerService.GetCustomers()); dgvCustomer.Refresh(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void CtrlCatalog_Load(object sender, EventArgs e) { try { if (_productService == null) { _productService = ServiceFactory.GenerateServiceInstance().GenerateProductService(); } if (_commonService == null) { _commonService = ServiceFactory.GenerateServiceInstance().GenerateCommonService(); } if (!UserService.AllowToPerform(Resources.PermissionViewAllProductInfo)) { UPInLbl.Visible = false; extraPercentageLbl.Visible = false; } if (!UserService.AllowToPerform(Resources.PermissionViewProdResultInfo)) { lblResultInfo.Visible = false; //extraPercentageLbl.Visible = false; } InitializeProductList(); ThreadStart threadStart = UpdateControlContent; var thread = new Thread(threadStart) { IsBackground = true }; thread.Start(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void CtrBase_Load(object sender, EventArgs e) { try { if (_CommonService == null) { _CommonService = ServiceFactory.GenerateServiceInstance().GenerateCommonService(); } IList objectList = _CommonService.GetAppParameterTypes(); lsbAppParam.DisplayMember = AppParameterType.ConstParameterLabel; lsbAppParam.ValueMember = AppParameterType.ConstParameterId; lsbAppParam.DataSource = objectList; _IsModified = false; } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void CmdSearchProductClick(object sender, EventArgs e) { try { var searchCriteria = new List <string>(); if (cmbCategory.SelectedIndex != -1) { searchCriteria.Add("CategoryId|" + cmbCategory.SelectedValue); } if (cmbMark.SelectedIndex != -1) { searchCriteria.Add("MarkId|" + cmbMark.SelectedValue); } if (cmbColor.SelectedIndex != -1) { searchCriteria.Add("ColorId|" + cmbColor.SelectedValue); } if (txtProductCode.Text.Length != 0) { searchCriteria.Add( "((ProductCode LIKE '%" + txtProductCode.Text + "%') OR " + "(ForeignCode LIKE '%" + txtProductCode.Text + "%'))"); } _productList.Clear(); IListToBindingList( _productService.GetCatalogs(searchCriteria, chbInstockOnly.Checked)); SetFocusToProductList(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void InitializeUserList() { try { if (_UserList == null) { _UserList = new BindingList <User>(); } dgvUser.DataSource = _UserList; dgvUser.Columns["UserName"].DisplayIndex = 0; dgvUser.Columns["PhoneNumber"].DisplayIndex = 1; dgvUser.Columns["GenderStr"].DisplayIndex = 2; dgvUser.Columns["PositionStr"].DisplayIndex = 3; dgvUser.Columns["LogInName"].DisplayIndex = 4; } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void InitializeExpenseList() { try { if (_ExpenseList == null) { _ExpenseList = new BindingList <Expense>(); } dgvExpense.DataSource = _ExpenseList; dgvExpense.Columns["ExpenseDate"].DisplayIndex = 0; dgvExpense.Columns["ExpenseTypeStr"].DisplayIndex = 1; dgvExpense.Columns["Description"].DisplayIndex = 2; dgvExpense.Columns["ExpenseAmountInt"].DisplayIndex = 3; dgvExpense.Columns["ExpenseAmountRiel"].DisplayIndex = 4; } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void InitialSupplierList() { try { if (_SupplierList == null) { _SupplierList = new BindingList <Supplier>(); } dgvSupplier.DataSource = _SupplierList; dgvSupplier.Columns["SupplierName"].DisplayIndex = 0; dgvSupplier.Columns["PhoneNumber"].DisplayIndex = 1; dgvSupplier.Columns["FaxNumber"].DisplayIndex = 2; dgvSupplier.Columns["CountryStr"].DisplayIndex = 3; } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void CtrlExpense_Load(object sender, EventArgs e) { if (_CommonService == null) { _CommonService = ServiceFactory.GenerateServiceInstance().GenerateCommonService(); } if (_ExpenseService == null) { _ExpenseService = ServiceFactory.GenerateServiceInstance().GenerateExpenseService(); } try { if (!UserService.AllowToPerform(Resources.PermissionViewExpResultInfo)) { lblResultInfo.Visible = false; } InitializeExpenseList(); ThreadStart threadStart = UpdateControlContent; var thread = new Thread(threadStart) { IsBackground = true }; thread.Start(); IListToBindingList(_ExpenseService.GetExpenses()); dgvExpense.Refresh(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }
private void InitializeProductList() { try { if (_productList == null) { _productList = new BindingList <Product>(); } dgvProduct.DataSource = _productList; dgvProduct.Columns["PrintCheck"].DisplayIndex = 0; dgvProduct.Columns["PublicQty"].DisplayIndex = 1; dgvProduct.Columns["ProductPic"].DisplayIndex = 2; dgvProduct.Columns["DisplayName"].DisplayIndex = 3; dgvProduct.Columns["Description"].DisplayIndex = 4; dgvProduct.Columns["QtyInStock"].DisplayIndex = 5; } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } }