Beispiel #1
0
    private void DeleteGroupUser()
    {
        string strError = "";

        if (groupIDList.Contains("$"))
        {
            if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000012", Commons.Culture, Commons.ResourceMessage).Replace("$Count$", groupIDList.Split('$').Length.ToString())))
            {
                strError = busGroupUser.DeleteListGroupUser(groupIDList, groupCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
            }
        }
        else
        {
            if (Commons.ShowConfirmMessage(Lang.GetMessageByLanguage("000005", Commons.Culture, Commons.ResourceMessage)))
            {
                strError = busGroupUser.DeleteGroupUser(groupIDList, groupCodeList, User.UserInfo.Username, User.UserInfo.LanguageID);
            }
        }

        if (strError.Equals(""))
        {
            LoadAllData();
        }
        else
        {
            Commons.ShowMessage(strError, 0);
        }
    }
Beispiel #2
0
        private async Task DeleteGroupUser()
        {
            group_code_list = "";
            group_id_list   = "";
            foreach (int index in grvGroupUser.GetSelectedRows())
            {
                group_code_list = string.Join("$", group_code_list, grvGroupUser.GetRowCellDisplayText(index, gcolGroupCode));
                group_id_list   = string.Join("$", group_id_list, grvGroupUser.GetRowCellDisplayText(index, gcolGroupID));
            }

            if (group_code_list.Length > 0)
            {
                group_code_list = group_code_list.Substring(1);
            }
            if (group_id_list.Length > 0)
            {
                group_id_list = group_id_list.Substring(1);
            }

            SYS_tblGroupUserDRO result = new SYS_tblGroupUserDRO();

            result.ResponseItem.Message = "ready";
            if (!string.IsNullOrEmpty(group_id_list))
            {
                try
                {
                    if (group_id_list.Contains("$"))
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", group_id_list.Split('$').Length.ToString())))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await SYS_tblGroupUserBUS.DeleteGroupUser(group_id_list, group_code_list, CommonEngine.userInfo.UserID, ConfigEngine.Language, new SYS_tblActionLogDTO
                            {
                                Activity      = BaseConstant.COMMAND_INSERT_EN,
                                UserID        = CommonEngine.userInfo.UserID,
                                LanguageID    = ConfigEngine.Language,
                                ActionEN      = BaseConstant.COMMAND_DELETE_LIST_EN,
                                ActionVN      = BaseConstant.COMMAND_DELETE_LIST_VI,
                                FunctionID    = "9",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công nhóm người dùng có mã '{1}'.", CommonEngine.userInfo.UserID, group_code_list.Replace("$", ", ")),
                                DescriptionEN = string.Format("Account '{0}' has deleted group user successfully with group code are '{1}'.", CommonEngine.userInfo.UserID, group_code_list.Replace("$", ", "))
                            });
                        }
                    }
                    else
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language)))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await SYS_tblGroupUserBUS.DeleteGroupUser(group_id_list, group_code_list, CommonEngine.userInfo.UserID, ConfigEngine.Language, new SYS_tblActionLogDTO
                            {
                                Activity      = BaseConstant.COMMAND_DELETE_EN,
                                UserID        = CommonEngine.userInfo.UserID,
                                LanguageID    = ConfigEngine.Language,
                                ActionEN      = BaseConstant.COMMAND_DELETE_EN,
                                ActionVN      = BaseConstant.COMMAND_DELETE_VI,
                                FunctionID    = "9",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công nhóm người dùng có mã '{1}'.", CommonEngine.userInfo.UserID, group_code_list),
                                DescriptionEN = string.Format("Account '{0}' has deleted group user successfully with group code is '{1}'.", CommonEngine.userInfo.UserID, group_code_list)
                            });
                        }
                    }

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