예제 #1
0
        private void UpdateControlContent()
        {
            if (_SupplierService == null)
            {
                _SupplierService = ServiceFactory.GenerateServiceInstance().GenerateSupplierService();
            }

            SafeCrossCallBackDelegate safeCrossCallBackDelegate = null;

            if (cmbCountry.InvokeRequired)
            {
                safeCrossCallBackDelegate = UpdateControlContent;
            }

            if (cmbCountry.InvokeRequired)
            {
                Invoke(safeCrossCallBackDelegate);
            }
            else
            {
                var searchCriteria = new List <string>
                {
                    "ParameterTypeId IN (" + Resources.AppParamCountry + ")"
                };
                var objList = _CommonService.GetAppParameters(searchCriteria);

                _CommonService.PopAppParamExtendedCombobox(
                    ref cmbCountry, objList, int.Parse(Resources.AppParamCountry), true);

                SetSupplierInfo();
                SetModifydStatus(false);
            }
        }
예제 #2
0
        private void UpdateControlContent()
        {
            SafeCrossCallBackDelegate safeCrossCallBackDelegate = null;

            if ((cmbDCardType.InvokeRequired) || (cmbDiscountType.InvokeRequired) || (dgvDiscountCard.InvokeRequired))
            {
                safeCrossCallBackDelegate = UpdateControlContent;
            }

            if (cmbDCardType.InvokeRequired)
            {
                Invoke(safeCrossCallBackDelegate);
            }
            else
            {
                IList objList = _CommonService.GetAppParametersByType(
                    Int32.Parse(Resources.AppParamDiscountType, AppContext.CultureInfo));

                _CommonService.PopAppParamExtendedCombobox(
                    ref cmbDCardType, objList, Int32.Parse(Resources.AppParamDiscountType, AppContext.CultureInfo),
                    false);

                _CommonService.PopAppParamExtendedCombobox(
                    ref cmbDiscountType, objList, Int32.Parse(Resources.AppParamDiscountType, AppContext.CultureInfo),
                    false);
            }
        }
예제 #3
0
        private void UpdateControlContent()
        {
            SafeCrossCallBackDelegate safeCrossCallBackDelegate = null;

            if ((cmbDCardType.InvokeRequired))
            {
                safeCrossCallBackDelegate = UpdateControlContent;
            }

            if (cmbDCardType.InvokeRequired)
            {
                Invoke(safeCrossCallBackDelegate);
            }
            else
            {
                var searchCriteria = new List <string> {
                    "ParameterTypeId IN (20)"
                };

                var objList = _commonService.GetAppParameters(searchCriteria);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbDCardType, objList, int.Parse(Resources.AppParamDiscountType, AppContext.CultureInfo), false);
            }
        }
예제 #4
0
        private void UpdateControlContent()
        {
            SafeCrossCallBackDelegate safeCrossCallBackDelegate = null;

            if (cmbCountry.InvokeRequired)
            {
                safeCrossCallBackDelegate = UpdateControlContent;
            }

            if (cmbCountry.InvokeRequired)
            {
                Invoke(safeCrossCallBackDelegate);
            }
            else
            {
                var searchCriteria = new List <string>
                {
                    "ParameterTypeId IN (" + Resources.AppParamCountry + ")"
                };
                var objList = _CommonService.GetAppParameters(searchCriteria);

                _CommonService.PopAppParamExtendedCombobox(
                    ref cmbCountry,
                    objList,
                    int.Parse(Resources.AppParamCountry),
                    false);

                btnSearch_Click(null, null);
            }
        }
예제 #5
0
        private void UpdateControlContent()
        {
            SafeCrossCallBackDelegate safeCrossCallBackDelegate = null;

            if ((cmbCustomer.InvokeRequired) || (cmbDiscountType.InvokeRequired) ||
                (cmbCategory.InvokeRequired) || (cmbBrand.InvokeRequired) ||
                (cmbColor.InvokeRequired))
            {
                safeCrossCallBackDelegate = UpdateControlContent;
            }

            if (cmbCustomer.InvokeRequired)
            {
                Invoke(safeCrossCallBackDelegate);
            }
            else
            {
                var searchCriteria = new List <string> {
                    "ParameterTypeId IN (1, 4, 3, 20)"
                };

                var objList =
                    _commonService.GetAppParameters(searchCriteria);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbDiscountType,
                    objList,
                    int.Parse(Resources.AppParamDiscountType, AppContext.CultureInfo),
                    false);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbCategory,
                    objList,
                    int.Parse(Resources.AppParamCategory, AppContext.CultureInfo),
                    false);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbBrand,
                    objList,
                    int.Parse(Resources.AppParamMark, AppContext.CultureInfo),
                    false);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbColor,
                    objList,
                    int.Parse(Resources.AppParamColor, AppContext.CultureInfo),
                    false);

                searchCriteria.Clear();
                searchCriteria.Add(
                    "CustomerId IN (SELECT DISTINCT CustomerId FROM TSaleOrders WHERE CustomerId IS NOT NULL)");
                objList =
                    ServiceFactory.GenerateServiceInstance().GenerateCustomerService().GetCustomers(searchCriteria);
                cmbCustomer.CustomizedDataBinding(
                    objList,
                    Customer.ConstCustomerName,
                    Customer.ConstCustomerId,
                    false);
            }
        }
예제 #6
0
        private void UpdateControlContent()
        {
            SafeCrossCallBackDelegate safeCrossCallBackDelegate = null;

            if (cmbDCountType.InvokeRequired)
            {
                safeCrossCallBackDelegate = UpdateControlContent;
            }

            if (cmbDCountType.InvokeRequired)
            {
                Invoke(safeCrossCallBackDelegate);
            }
            else
            {
                _discountTypeList = _CommonService.GetAppParametersByTypeSortByValue(
                    Int32.Parse(Resources.AppParamDiscountType, AppContext.CultureInfo));

                if (_discountTypeList.Count != 0)
                {
                    cmbDCountType.DataSource    = _discountTypeList;
                    cmbDCountType.DisplayMember = AppParameter.ConstParameterValue;
                    cmbDCountType.ValueMember   = AppParameter.ConstParameterValue;

                    if (lsbCustomer.Items.Count != 0)
                    {
                        int selectedIndex = lsbCustomer.SelectedIndex;
                        lsbCustomer.SelectedIndex = -1;
                        lsbCustomer.SelectedIndex = selectedIndex;
                    }
                }
            }
        }
예제 #7
0
        private void UpdateControlContent()
        {
            var objList = _CommonService.GetAppParametersByType(
                Int32.Parse(Resources.AppParamExpense, AppContext.CultureInfo));

            if (cmbExpenseType.InvokeRequired)
            {
                SafeCrossCallBackDelegate safeCrossCallBackDelegate = UpdateControlContent;
                Invoke(safeCrossCallBackDelegate);
            }
            else
            {
                _CommonService.PopAppParamExtendedCombobox(
                    ref cmbExpenseType, objList, Int32.Parse(Resources.AppParamExpense, AppContext.CultureInfo), false);
            }
        }
예제 #8
0
        private void UpdateControlContent()
        {
            SafeCrossCallBackDelegate safeCrossCallBackDelegate = null;

            if ((cmbCategory.InvokeRequired) || (cmbMark.InvokeRequired) || (cmbColor.InvokeRequired))
            {
                safeCrossCallBackDelegate = UpdateControlContent;
            }

            if (cmbCategory.InvokeRequired)
            {
                Invoke(safeCrossCallBackDelegate);
            }
            else
            {
                var searchCriteria =
                    new List <string>
                {
                    "ParameterTypeId IN (" +
                    Resources.AppParamCategory + ", " +
                    Resources.AppParamMark + "," +
                    Resources.AppParamColor + ")"
                };
                var objectList = _commonService.GetAppParameters(searchCriteria);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbCategory,
                    objectList,
                    Int32.Parse(Resources.AppParamCategory, AppContext.CultureInfo),
                    false);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbMark,
                    objectList,
                    Int32.Parse(Resources.AppParamMark, AppContext.CultureInfo),
                    false);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbColor,
                    objectList,
                    Int32.Parse(Resources.AppParamColor, AppContext.CultureInfo),
                    false);

                IListToBindingList(
                    _productService.GetCatalogs(chbInstockOnly.Checked));
            }
        }
예제 #9
0
        private void UpdateControlContent()
        {
            if (_userService == null)
            {
                _userService = ServiceFactory.GenerateServiceInstance().GenerateUserService();
            }

            SafeCrossCallBackDelegate safeCrossCallBackDelegate = null;

            if (cmbGender.InvokeRequired)
            {
                safeCrossCallBackDelegate = UpdateControlContent;
            }

            if (cmbGender.InvokeRequired)
            {
                Invoke(safeCrossCallBackDelegate);
            }
            else
            {
                var searchCriteria = new List <string> {
                    "ParameterTypeId IN (8, 10, 11, 12)"
                };
                var objList = _commonService.GetAppParameters(searchCriteria);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbGender, objList, int.Parse(Resources.AppParamGender), true);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbMaritalStatus, objList, int.Parse(Resources.AppParamMaritalStatus), true);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbPosition, objList, int.Parse(Resources.AppParamPosition), true);

                _commonService.PopAppParamExtendedCombobox(
                    ref cmbContractType, objList, int.Parse(Resources.AppParamContractType), true);

                objList = _userService.GetPermissions();
                clbPermission.DataSource = objList;
                if (((IList)clbPermission.DataSource).Count != 0)
                {
                    clbPermission.DisplayMember = Permission.ConstPermissionLabel;
                    clbPermission.ValueMember   = Permission.ConstPermissionId;
                }

                if (_user != null)
                {
                    if (((IList)cmbGender.DataSource).Count != 0)
                    {
                        cmbGender.SelectedValue = _user.GenderId;
                    }
                    if (((IList)cmbMaritalStatus.DataSource).Count != 0)
                    {
                        cmbMaritalStatus.SelectedValue = _user.MaritalStatusId;
                    }
                    if (((IList)cmbPosition.DataSource).Count != 0)
                    {
                        cmbPosition.SelectedValue = _user.PositionId;
                    }
                    if (((IList)cmbContractType.DataSource).Count != 0)
                    {
                        cmbContractType.SelectedValue = _user.ContractId;
                    }

                    objList = _userService.GetPermissionsByUser(_user.UserId);
                    if (objList.Count != 0)
                    {
                        foreach (UserPermission usrPermission in objList)
                        {
                            for (int counter = 0; counter < clbPermission.Items.Count; counter++)
                            {
                                if (usrPermission.PermissionId ==
                                    ((Permission)clbPermission.Items[counter]).PermissionId)
                                {
                                    clbPermission.SetItemChecked(counter, true);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #10
0
        private void RetrieveConfiguration()
        {
            try
            {
                SafeCrossCallBackDelegate safeCrossCallBackDelegate = null;

                if (pnlBody_Right.InvokeRequired)
                {
                    safeCrossCallBackDelegate = RetrieveConfiguration;
                }

                if (pnlBody_Right.InvokeRequired)
                {
                    Invoke(safeCrossCallBackDelegate);
                }
                else
                {
                    Thread.Sleep(100);

                    //Loading Service
                    pgbService.Value += 15;
                    _commonService    = ServiceFactory.GenerateServiceInstance().GenerateCommonService();
                    pgbService.Value += 15;
                    _saleOrderService = ServiceFactory.GenerateServiceInstance().GenerateSaleOrderService();
                    pgbService.Value += 15;
                    _productService   = ServiceFactory.GenerateServiceInstance().GenerateProductService();
                    pgbService.Value += 15;
                    _customerService  = ServiceFactory.GenerateServiceInstance().GenerateCustomerService();
                    pgbService.Value += 15;
                    _supplierService  = ServiceFactory.GenerateServiceInstance().GenerateSupplierService();
                    pgbService.Value += 15;
                    _expenseService   = ServiceFactory.GenerateServiceInstance().GenerateExpenseService();
                    pgbService.Value += 10;
                    _userService      = ServiceFactory.GenerateServiceInstance().GenerateUserService();

                    //Connecting to database
                    pgbGlobalConfig.Value += 50;
                    _commonService.InitializeGlobalConfiguration();
                    pgbGlobalConfig.Value += 50;

                    //Initializing workspace
                    pgbInitialization.Value += 30;
                    _commonService.InitializeWorkSpace();
                    pgbInitialization.Value += 30;
                    if (AppContext.Counter == null)
                    {
                        const string briefMsg  = "អំពីការចូលទៅក្នុងប្រព័ន្ឋ";
                        var          detailMsg = Resources.MsgCounterNotInitialize;
                        using (var frmMessageBox = new FrmExtendedMessageBox())
                        {
                            frmMessageBox.BriefMsgStr    = briefMsg;
                            frmMessageBox.DetailMsgStr   = detailMsg;
                            frmMessageBox.IsCanceledOnly = true;
                            frmMessageBox.ShowDialog(this);
                            Close();
                            return;
                        }
                    }
                    pgbInitialization.Value += 40;

                    //Loading configuration
                    pgbCustomizedConfig.Value += 80;
                    Visible = false;

                    using (var frmLogIn = new FrmLogIn())
                    {
                        frmLogIn.UserService = _userService;
                        if (frmLogIn.ShowDialog(this) == DialogResult.OK)
                        {
                            Visible = true;

                            var frmMain = new FrmMain();
                            ApplicationContext.MainForm = frmMain;

                            frmMain.CommonService    = _commonService;
                            frmMain.SaleOrderService = _saleOrderService;
                            frmMain.ProductService   = _productService;
                            frmMain.CustomerService  = _customerService;
                            frmMain.SupplierService  = _supplierService;
                            frmMain.ExpenseService   = _expenseService;
                            frmMain.UserService      = _userService;

                            _commonService.InitializeCustomizedConfiguration(frmLogIn.User);
                            pgbCustomizedConfig.Value += 20;

                            _commonService.InsertOperationLog(
                                AppContext.User.UserId,
                                int.Parse(Resources.OperationLogIn));

                            frmMain.Show();
                            Close();
                        }
                        else
                        {
                            ApplicationContext.ExitThread();
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                const string briefMsg  = "អំពីការចូលទៅក្នុងប្រព័ន្ឋ";
                var          detailMsg = Resources.MsgConnectionLost;
                using (var frmMessageBox = new FrmExtendedMessageBox())
                {
                    frmMessageBox.BriefMsgStr    = briefMsg;
                    frmMessageBox.DetailMsgStr   = detailMsg;
                    frmMessageBox.IsCanceledOnly = true;
                    frmMessageBox.ShowDialog(this);
                    Close();
                }
            }
        }