Ejemplo n.º 1
0
        private void DeleteDistrict()
        {
            string strError = "";

            if (districtIDList.Contains("$"))
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000012", Commons.Culture, Commons.ResourceMessage).Replace("$Count$", districtIDList.Split('$').Length.ToString())))
                {
                    strError = busDistrict.DeleteListDistrict(districtIDList, districtCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }
            else
            {
                if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000005", Commons.Culture, Commons.ResourceMessage)))
                {
                    strError = busDistrict.DeleteDistrict(districtIDList, districtCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
                }
            }

            if (strError.Equals(""))
            {
                LoadAllData();
            }
            else
            {
                Commons.ShowMessage(strError, 0);
            }
        }
Ejemplo n.º 2
0
        private async Task DeleteDistrict()
        {
            district_code_list = "";
            district_id_list   = "";

            foreach (int index in grvDistrict.GetSelectedRows())
            {
                district_code_list = string.Join("$", district_code_list, grvDistrict.GetRowCellDisplayText(index, gcolDistrictCode));
                district_id_list   = string.Join("$", district_id_list, grvDistrict.GetRowCellDisplayText(index, gcolDistrictID));
            }

            if (district_code_list.Length > 0)
            {
                district_code_list = district_code_list.Substring(1);
            }
            if (district_id_list.Length > 0)
            {
                district_id_list = district_id_list.Substring(1);
            }

            PRO_tblDistrictDRO result = new PRO_tblDistrictDRO();

            result.ResponseItem.Message = "ready";
            if (!string.IsNullOrEmpty(district_id_list))
            {
                try
                {
                    if (district_id_list.Contains("$"))
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", district_id_list.Split('$').Length.ToString())))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblDistrictBUS.DeleteDistrict(CommonEngine.userInfo.Username, ConfigEngine.Language, district_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    = "12",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những quận huyện có mã '{1}'.", CommonEngine.userInfo.UserID, district_code_list.Replace("$", ", ")),
                                DescriptionEN = string.Format("Account '{0}' has deleted districts successfully with district codes are '{1}'.", CommonEngine.userInfo.UserID, district_code_list.Replace("$", ", "))
                            });
                        }
                    }
                    else
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language)))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblDistrictBUS.DeleteDistrict(CommonEngine.userInfo.Username, ConfigEngine.Language, district_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    = "12",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công quận huyện có mã '{1}'.", CommonEngine.userInfo.UserID, district_code_list),
                                DescriptionEN = string.Format("Account '{0}' has deleted district successfully with district code is '{1}'.", CommonEngine.userInfo.UserID, district_code_list)
                            });
                        }
                    }
                    if (!CommonEngine.CheckValidResponseItem(result.ResponseItem))
                    {
                        return;
                    }

                    if (!result.ResponseItem.Message.Equals("ready"))
                    {
                        if (string.IsNullOrEmpty(result.ResponseItem.Message))
                        {
                            GetAllDistrict();
                        }
                        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);
            }
        }