Exemple #1
0
        private void DeleteWarehouse()
        {
            string strError = "";

            if (warehouseIDList.Contains("$"))
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000012", Commons.Culture, Commons.ResourceMessage).Replace("$Count$", warehouseIDList.Split('$').Length.ToString())))
                {
                    strError = busWarehouse.DeleteListWarehouse(warehouseIDList, warehouseIDList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }
            else
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000005", Commons.Culture, Commons.ResourceMessage)))
                {
                    strError = busWarehouse.DeleteWarehouse(warehouseIDList, warehouseIDList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }

            if (strError.Equals(""))
            {
                LoadAllData();
            }
            else
            {
                Commons.ShowMessage(strError, 0);
            }
        }
Exemple #2
0
        private async Task DeleteWarehouse()
        {
            warehouse_code_list = "";
            warehouse_id_list   = "";
            foreach (int index in grvWarehouse.GetSelectedRows())
            {
                warehouse_code_list = string.Join("$", warehouse_code_list, grvWarehouse.GetRowCellDisplayText(index, gcolWarehouseCode));
                warehouse_id_list   = string.Join("$", warehouse_id_list, grvWarehouse.GetRowCellDisplayText(index, gcolWarehouseID));
            }

            if (warehouse_code_list.Length > 0)
            {
                warehouse_code_list = warehouse_code_list.Substring(1);
            }
            if (warehouse_id_list.Length > 0)
            {
                warehouse_id_list = warehouse_id_list.Substring(1);
            }

            PRO_tblWarehouseDRO result = new PRO_tblWarehouseDRO();

            result.ResponseItem.Message = "ready";
            if (!string.IsNullOrEmpty(warehouse_id_list))
            {
                try
                {
                    if (warehouse_id_list.Contains("$"))
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", warehouse_id_list.Split('$').Length.ToString())))
                        {
                            result = await PRO_tblWarehouseBUS.DeleteWarehouse(warehouse_id_list, CommonEngine.userInfo.Username, ConfigEngine.Language, 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    = "18",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những kho hàng có mã '{1}'.", CommonEngine.userInfo.UserID, warehouse_code_list.Replace("$", ", ")),
                                DescriptionEN = string.Format("Account '{0}' has deleted warehouses successfully with warehouse codes are '{1}'.", CommonEngine.userInfo.UserID, warehouse_code_list.Replace("$", ", "))
                            });
                        }
                    }
                    else
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language)))
                        {
                            result = await PRO_tblWarehouseBUS.DeleteWarehouse(warehouse_id_list, CommonEngine.userInfo.Username, ConfigEngine.Language, 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    = "18",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công kho hàng có mã '{1}'.", CommonEngine.userInfo.UserID, warehouse_code_list),
                                DescriptionEN = string.Format("Account '{0}' has deleted warehouse successfully with warehouse code is '{1}'.", CommonEngine.userInfo.UserID, warehouse_code_list)
                            });
                        }
                    }

                    if (!CommonEngine.CheckValidResponseItem(result.ResponseItem))
                    {
                        return;
                    }
                    if (!result.ResponseItem.Message.Equals("ready"))
                    {
                        if (string.IsNullOrEmpty(result.ResponseItem.Message))
                        {
                            GetAllWarehouse("");
                        }
                        else
                        {
                            CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        }
                    }
                }
                catch (Exception ex)
                {
                    CommonEngine.ShowExceptionMessage(ex);
                }
            }
            else
            {
                CommonEngine.ShowMessage("000027", IMC.Helper.MessageType.Warning, true);
            }
        }