Example #1
0
        private async void LoadLevel1()
        {
            PRO_tblLevel1DRO level1s = await PRO_tblLevel1BUS.GetAllLevel1(CommonEngine.userInfo.UserID, ConfigEngine.Language, true, null);

            gluLevel1.DataBindings.Clear();
            if (level1s.ResponseItem.IsError)
            {
                CommonEngine.ShowHTTPErrorMessage(level1s.ResponseItem);
                return;
            }
            gluLevel1.Properties.DataSource    = level1s.Level1List;
            gluLevel1.Properties.ValueMember   = "Level1ID";
            gluLevel1.Properties.DisplayMember = "FullLevel1Name";
        }
Example #2
0
        private async void LoadProvince()
        {
            gluProvince.DataBindings.Clear();
            PRO_tblProvinceDRO provinces = await PRO_tblProvinceBUS.GetAllProvinces(CommonEngine.userInfo.UserID, ConfigEngine.Language, true, null);

            if (provinces.ResponseItem.IsError)
            {
                CommonEngine.ShowHTTPErrorMessage(provinces.ResponseItem);
                gluProvince.Properties.DataSource = null;
                return;
            }
            gluProvince.Properties.DataSource    = provinces.ProvinceList;
            gluProvince.Properties.ValueMember   = "ProvinceID";
            gluProvince.Properties.DisplayMember = "FullProvinceName";
        }
Example #3
0
        private async void LoadDistrictByProvince(string province_id)
        {
            gluDistrict.DataBindings.Clear();
            PRO_tblDistrictDRO districts = await PRO_tblDistrictBUS.GetAllDistricts(CommonEngine.userInfo.UserID, ConfigEngine.Language, true, province_id, null);

            if (districts.ResponseItem.IsError)
            {
                CommonEngine.ShowHTTPErrorMessage(districts.ResponseItem);
                gluDistrict.Properties.DataSource = null;
                return;
            }
            gluDistrict.Properties.DataSource    = districts.DistrictList;
            gluDistrict.Properties.ValueMember   = "DistrictID";
            gluDistrict.Properties.DisplayMember = "FullDistrictName";
        }
Example #4
0
        private async void LoadWarehouseByStoreID(string store_id)
        {
            gluWarehouse.DataBindings.Clear();
            PRO_tblWarehouseDRO warehouses = await PRO_tblWarehouseBUS.GetAllWarehouses(CommonEngine.userInfo.UserID, ConfigEngine.Language, true, store_id, "", "", null);

            if (warehouses.ResponseItem.IsError)
            {
                CommonEngine.ShowHTTPErrorMessage(warehouses.ResponseItem);
                gluWarehouse.Properties.DataSource = null;
                return;
            }
            gluWarehouse.Properties.DataSource    = warehouses.WarehouseList;
            gluWarehouse.Properties.ValueMember   = "WarehouseID";
            gluWarehouse.Properties.DisplayMember = "FullWarehouseName";
        }
Example #5
0
        private async Task <bool> SaveDistrict(bool isEdit)
        {
            PRO_tblDistrictDRO result = new PRO_tblDistrictDRO();

            CommonEngine.ShowWaitForm(this);
            try
            {
                result = await iPOS.BUS.Products.PRO_tblDistrictBUS.InsertUpdateDistrict(new PRO_tblDistrictDTO
                {
                    DistrictID   = isEdit ? txtDistrictID.Text : "0",
                    DistrictCode = txtDistrictCode.Text,
                    VNName       = txtVNName.Text,
                    ENName       = txtENName.Text,
                    ProvinceID   = gluProvince.EditValue + "",
                    Rank         = speRank.EditValue != null ? Convert.ToInt32(speRank.Value) : (Int32?)null,
                    Used         = chkUsed.Checked,
                    Note         = mmoNote.Text,
                    UserID       = CommonEngine.userInfo.UserID,
                    Activity     = (isEdit) ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    LanguageID   = ConfigEngine.Language
                }, new DTO.Systems.SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    ActionVN      = isEdit ? BaseConstant.COMMAND_UPDATE_VI : BaseConstant.COMMAND_INSERT_VI,
                    FunctionID    = "12",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công quận huyện có mã quận huyện là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtDistrictCode.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} district successfully with district code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtDistrictCode.Text)
                });

                if (result.ResponseItem.IsError)
                {
                    CommonEngine.CloseWaitForm();
                    CommonEngine.ShowHTTPErrorMessage(result.ResponseItem);
                    txtDistrictCode.Focus();
                    return(false);
                }
                if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    CommonEngine.CloseWaitForm();
                    CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                    txtDistrictCode.Focus();
                    return(false);
                }
                else if (parent_form != null)
                {
                    parent_form.GetAllDistrict();
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return(false);
            }
            finally
            {
                CommonEngine.CloseWaitForm();
            }

            return(true);
        }
Example #6
0
        private async Task DeleteStore()
        {
            store_code_list = "";
            store_id_list   = "";

            foreach (int index in grvStore.GetSelectedRows())
            {
                store_code_list = string.Join("$", store_code_list, grvStore.GetRowCellDisplayText(index, gcolStoreCode));
                store_id_list   = string.Join("$", store_id_list, grvStore.GetRowCellDisplayText(index, gcolStoreID));
            }

            if (store_code_list.Length > 0)
            {
                store_code_list = store_code_list.Substring(1);
            }
            if (store_id_list.Length > 0)
            {
                store_id_list = store_id_list.Substring(1);
            }

            PRO_tblStoreDRO result = new PRO_tblStoreDRO();

            result.ResponseItem.Message = "ready";
            if (!string.IsNullOrEmpty(store_id_list))
            {
                try
                {
                    if (store_id_list.Contains("$"))
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", store_id_list.Split('$').Length.ToString())))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblStoreBUS.DeleteStore(CommonEngine.userInfo.Username, ConfigEngine.Language, store_id_list, new SYS_tblActionLogDTO
                            {
                                Activity      = BaseConstant.COMMAND_INSERT_EN,
                                UserID        = CommonEngine.userInfo.UserID,
                                LanguageID    = ConfigEngine.Language,
                                ActionVN      = BaseConstant.COMMAND_DELETE_VI,
                                ActionEN      = BaseConstant.COMMAND_DELETE_EN,
                                FunctionID    = "13",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những cửa hàng có mã '{1}'.", CommonEngine.userInfo.UserID, store_code_list.Replace("$", ", ")),
                                DescriptionEN = string.Format("Account '{0}' has deleted stores successfully with store codes are '{1}'.", CommonEngine.userInfo.UserID, store_code_list.Replace("$", ", "))
                            });
                        }
                    }
                    else
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language)))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblStoreBUS.DeleteStore(CommonEngine.userInfo.Username, ConfigEngine.Language, store_id_list, new SYS_tblActionLogDTO
                            {
                                Activity      = BaseConstant.COMMAND_INSERT_EN,
                                UserID        = CommonEngine.userInfo.UserID,
                                LanguageID    = ConfigEngine.Language,
                                ActionVN      = BaseConstant.COMMAND_DELETE_VI,
                                ActionEN      = BaseConstant.COMMAND_DELETE_EN,
                                FunctionID    = "13",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công cửa hàng có mã '{1}'.", CommonEngine.userInfo.UserID, store_code_list),
                                DescriptionEN = string.Format("Account '{0}' has deleted store successfully with store code is '{1}'.", CommonEngine.userInfo.UserID, store_code_list)
                            });
                        }
                    }

                    if (result.ResponseItem.IsError)
                    {
                        CommonEngine.ShowHTTPErrorMessage(result.ResponseItem);
                        return;
                    }
                    if (!result.ResponseItem.Message.Equals("ready"))
                    {
                        if (string.IsNullOrEmpty(result.ResponseItem.Message))
                        {
                            GetAllStore();
                        }
                        else
                        {
                            CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        }
                    }
                }
                catch (Exception ex)
                {
                    CommonEngine.ShowExceptionMessage(ex);
                }
            }
            else
            {
                CommonEngine.ShowMessage("000027", IMC.Helper.MessageType.Warning, true);
            }
        }
Example #7
0
        private async Task <bool> SaveWarehouse(bool isEdit)
        {
            PRO_tblWarehouseDRO result = new PRO_tblWarehouseDRO();

            try
            {
                result = await iPOS.BUS.Products.PRO_tblWarehouseBUS.InsertUpdateStore(new PRO_tblWarehouseDTO
                {
                    WarehouseID   = isEdit ? txtWarehouseID.Text : "0",
                    WarehouseCode = txtWarehouseCode.Text,
                    VNName        = txtVNName.Text.Trim(),
                    ENName        = txtENName.Text.Trim(),
                    StoreID       = gluStore.EditValue + "",
                    AddressVN     = txtAddressVN.Text.Trim(),
                    AddressEN     = txtAddressEN.Text.Trim(),
                    Phone         = txtPhone.Text.Trim(),
                    Fax           = txtFax.Text.Trim(),
                    ProvinceID    = gluProvince.EditValue + "",
                    DistrictID    = gluDistrict.EditValue + "",
                    Rank          = (string.IsNullOrEmpty(speRank.EditValue + "")) ? (Int32?)null : Convert.ToInt32(speRank.EditValue),
                    Used          = chkUsed.Checked,
                    Note          = mmoNote.Text.Trim(),
                    UserID        = CommonEngine.userInfo.UserID,
                    Activity      = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    LanguageID    = ConfigEngine.Language
                }, new DTO.Systems.SYS_tblActionLogDTO
                {
                    Activity      = BaseConstant.COMMAND_INSERT_EN,
                    UserID        = CommonEngine.userInfo.UserID,
                    LanguageID    = ConfigEngine.Language,
                    ActionEN      = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN,
                    ActionVN      = isEdit ? BaseConstant.COMMAND_UPDATE_VI : BaseConstant.COMMAND_INSERT_VI,
                    FunctionID    = "18",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công kho hàng có mã kho hàng là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtWarehouseCode.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} warehouse successfully with warehouse code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtWarehouseCode.Text)
                });

                if (result.ResponseItem.IsError)
                {
                    CommonEngine.ShowHTTPErrorMessage(result.ResponseItem);
                    txtWarehouseCode.Focus();
                    return(false);
                }
                if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                {
                    CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                    txtWarehouseCode.Focus();
                    return(false);
                }
                else
                {
                    parent_form.GetAllWarehouse("");
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return(false);
            }

            return(true);
        }