Пример #1
0
        private void DeleteStore()
        {
            string strError = "";

            if (storeIDList.Contains("$"))
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000012", Commons.Culture, Commons.ResourceMessage).Replace("$Count$", storeIDList.Split('$').Length.ToString())))
                {
                    strError = busStore.DeleteListStore(storeIDList, storeCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }
            else
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000005", Commons.Culture, Commons.ResourceMessage)))
                {
                    strError = busStore.DeleteStore(storeIDList, storeCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }

            if (strError.Equals(""))
            {
                LoadAllData();
            }
            else
            {
                Commons.ShowMessage(strError, 0);
            }
        }
Пример #2
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);
            }
        }