Exemplo n.º 1
0
        private void DeleteProvince()
        {
            string strError = "";

            if (provinceIDList.Contains("$"))
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000012", Commons.Culture, Commons.ResourceMessage).Replace("$Count$", provinceIDList.Split('$').Length.ToString())))
                {
                    strError = busProvince.DeleteListProvince(provinceIDList, provinceCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }
            else
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000005", Commons.Culture, Commons.ResourceMessage)))
                {
                    strError = busProvince.DeleteProvince(provinceIDList, provinceCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }

            if (strError.Equals(""))
            {
                LoadAllData();
            }
            else
            {
                Commons.ShowMessage(strError, 0);
            }
        }
Exemplo n.º 2
0
        private async Task DeleteProvince()
        {
            province_code_list = "";
            province_id_list   = "";
            foreach (int index in grvProvince.GetSelectedRows())
            {
                province_code_list = string.Join("$", province_code_list, grvProvince.GetRowCellDisplayText(index, gcolProvinceCode));
                province_id_list   = string.Join("$", province_id_list, grvProvince.GetRowCellDisplayText(index, gcolProvinceID));
            }

            if (province_code_list.Length > 0)
            {
                province_code_list = province_code_list.Substring(1);
            }
            if (province_id_list.Length > 0)
            {
                province_id_list = province_id_list.Substring(1);
            }

            PRO_tblProvinceDRO result = new PRO_tblProvinceDRO();

            result.ResponseItem.Message = "ready";
            if (!string.IsNullOrEmpty(province_id_list))
            {
                try
                {
                    if (province_id_list.Contains("$"))
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", province_id_list.Split('$').Length.ToString())))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblProvinceBUS.DeleteProvince(CommonEngine.userInfo.Username, ConfigEngine.Language, province_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    = "8",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những tỉnh thành có mã '{1}'.", CommonEngine.userInfo.UserID, province_code_list.Replace("$", ", ")),
                                DescriptionEN = string.Format("Account '{0}' has deleted provinces successfully with province codes are '{1}'.", CommonEngine.userInfo.UserID, province_code_list.Replace("$", ", "))
                            });
                        }
                    }
                    else
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language)))
                        {
                            CommonEngine.ShowWaitForm(this.ParentForm);
                            result = await PRO_tblProvinceBUS.DeleteProvince(CommonEngine.userInfo.Username, ConfigEngine.Language, province_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    = "8",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công tỉnh thành có mã '{1}'.", CommonEngine.userInfo.UserID, province_code_list),
                                DescriptionEN = string.Format("Account '{0}' has deleted province successfully with province code is '{1}'.", CommonEngine.userInfo.UserID, province_code_list)
                            });
                        }
                    }

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