/// <summary>
 /// thêm matchType
 /// </summary>
 private void GroupUser_Add()
 {
     try
     {
         Group_User creGroup_User = new Group_User();
         creGroup_User.Owner = Window.GetWindow(this);
         creGroup_User.ShowDialog();
         if (creGroup_User.c_createOk == 1)
         {
             LoadData();
             for (int i = 0; i < arrAllGroupUser.Count; i++)
             {
                 GroupUserInfo ui = (GroupUserInfo)arrAllGroupUser[i];
                 if (ui.Id == c_IdInsert)
                 {
                     rowselect  = i;
                     c_IdInsert = 0;
                     break;
                 }
             }
             DataGridHelper.NVSFocus(dgrGroupUser, rowselect, 1);
             creGroup_User.c_createOk = 0;
         }
     }
     catch (Exception ex)
     {
         CommonData.log.Error(ex.ToString());
     }
 }
Exemple #2
0
        void GroupUser_Add()
        {
            try
            {
                if (GroupUser_CheckValidate())
                {
                    GroupUserInfo _GroupUserInfo = new GroupUserInfo();
                    _GroupUserInfo.Name       = txtName.Text.Trim();
                    _GroupUserInfo.Group_Type = 1;
                    _GroupUserInfo.Note       = txtNotes.Text.Trim();

                    decimal id = moncon.GroupUser_Insert(_GroupUserInfo);
                    if (id > 0)
                    {
                        c_createOk = 1;
                        Group_User_Display.c_IdInsert = id;
                        NoteBox.Show("Thêm mới dữ liệu thành công", "", NoteBoxLevel.Note);
                        this.Close();
                    }
                    else
                    {
                        NoteBox.Show("Thêm mới không thành công", "Lỗi", NoteBoxLevel.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
        private void SetRight()
        {
            try
            {
                GroupUserInfo ms = new GroupUserInfo();
                ms = GetRow();

                rowselect = dgrGroupUser.SelectedIndex;
                if (ms != null)
                {
                    GroupUser_Right frm_GroupUser_Right = new GroupUser_Right();
                    frm_GroupUser_Right.Owner           = Window.GetWindow(this);
                    frm_GroupUser_Right.c_GroupUserInfo = ms;
                    frm_GroupUser_Right.ShowDialog();
                    if (frm_GroupUser_Right.c_ok == 1)
                    {
                        LoadData();
                        DataGridHelper.NVSFocus(dgrGroupUser, rowselect, 1);
                        frm_GroupUser_Right.c_ok = 0;
                    }
                    else
                    {
                        DataGridHelper.NVSFocus(dgrGroupUser, rowselect, 1);
                    }
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemple #4
0
        private void loadView()
        {
            try
            {
                //if (!this.NVSQuyen_Core.RIGHT_VIEW)
                //{
                //    NoteBox.Show("Bạn không có quyền sử dụng chức năng này", "Thông báo", NoteBoxLevel.Note);
                //    return;
                //}

                rowselect = dgrGroupUser.SelectedIndex;
                GroupUserInfo ms = new GroupUserInfo();

                GroupUser_View frmView = new GroupUser_View();
                ms = GetRow();
                if (ms == null)
                {
                    return;
                }
                frmView.Owner           = Window.GetWindow(this);
                frmView.c_GroupUserInfo = ms;
                frmView.ShowDialog();
                DataGridHelper.NVSFocus(dgrGroupUser, rowselect, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
        public void GroupUser_Update()
        {
            try
            {
                if (GroupUser_CheckValidate())
                {
                    MessageBoxResult result = NoteBox.Show("Bạn có muốn sửa thông tin này hay không?", "Thông báo", NoteBoxLevel.Question);
                    if (result == MessageBoxResult.Yes)
                    {
                        GroupUserInfo _GroupUserInfo = new GroupUserInfo();
                        _GroupUserInfo.Name       = txtName.Text.Trim();
                        _GroupUserInfo.Group_Type = c_GroupUserInfo.Group_Type;
                        _GroupUserInfo.Note       = txtNotes.Text.Trim();

                        if (moncon.GroupUser_Update(c_GroupUserInfo.Id, _GroupUserInfo))
                        {
                            c_editOK = 1;
                            NoteBox.Show("Cập nhật dữ liệu thành công", "Thông báo", NoteBoxLevel.Note);
                            this.Close();
                        }
                        else
                        {
                            NoteBox.Show("Cập nhật dữ liệu không thành công", "Thông báo", NoteBoxLevel.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemple #6
0
        public ActionBusinessResult AddGroup(GroupUserInfo groupAdd)
        {
            var result = GroupUserDA.AddGroup(groupAdd);

            if (result > 0)
            {
                this.SetActionSuccess(true);
            }

            return(this.SetActionResult(result, KnMessageCode.AddGroupSuccess));
        }
Exemple #7
0
 /// <summary>
 /// update theo id GroupUser
 /// </summary>
 public bool GroupUser_Update(decimal id, GroupUserInfo p_GroupUserInfo)
 {
     try
     {
         return(CommonData.c_serviceWCF.GroupUser_Update(id, p_GroupUserInfo.Name, p_GroupUserInfo.Group_Type, p_GroupUserInfo.Note));
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
         return(false);
     }
 }
Exemple #8
0
 public decimal GroupUser_Insert(GroupUserInfo p_GroupUserInfo)
 {
     try
     {
         return(CommonData.c_serviceWCF.GroupUser_Insert(p_GroupUserInfo.Name, p_GroupUserInfo.Group_Type, p_GroupUserInfo.Note));
     }
     catch (Exception ex)
     {
         ErrorLog.log.Error(ex.ToString());
         return(-1);
     }
 }
Exemple #9
0
        public ActionBusinessResult EditGroup(GroupUserInfo groupEdit)
        {
            var result = GroupUserDA.EditGroup(groupEdit);

            if (result > 0)
            {
                this.SetActionSuccess(true);
                //AccountManagerBL.AddAccountInGroupToAccountForceReLoginCollection(groupEdit.Id);
            }

            return(this.SetActionResult(result, KnMessageCode.EditGroupSuccess));
        }
 private GroupUserInfo GetRow()
 {
     try
     {
         GroupUserInfo us = (GroupUserInfo)dgrGroupUser.SelectedItem;
         return(us);
     }
     catch (Exception ex)
     {
         CommonData.log.Error(ex.ToString());
         return(null);
     }
 }
Exemple #11
0
        public ActionResult GetViewToEditGroup(int groupId)
        {
            var groupInfo = new GroupUserInfo();

            try
            {
                groupInfo = GroupUserBL.GetGroupById(groupId);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(PartialView("~/Areas/ModuleUsersAndRoles/Views/GroupUser/_PartialEditGroup.cshtml", groupInfo));
        }
        public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo)
        {
            var sendData = SendGroupUserInfoByGroupID.ParseFrom(requestInfo.Body);
            var userInfo = RedisUtility.Get <RedisUserInfoModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, sendData.Openid, sendData.Unionid));

            if (userInfo == null || !userInfo.GroupID.Any(w => w == sendData.GroupID))
            {
                // session.Close();
                return;
            }
            GroupInfoDAL groupInfoDAL    = new GroupInfoDAL();
            var          groupInfo       = groupInfoDAL.GetGroupInfoByGroupID(sendData.GroupID, userInfo.Type);
            var          returnGroupInfo = ReturnGroupUserInfoByGroupID.CreateBuilder();

            if (groupInfo != null)
            {
                var list = groupInfoDAL.GetGroupStaffInfoByGroupID(sendData.GroupID);
                if (list != null)
                {
                    foreach (var item in list)
                    {
                        var userInfoDB = new mjuserinfoDAL().GetModel(item.GroupUserID);
                        if (userInfoDB != null)
                        {
                            var groupUserInfo = GroupUserInfo.CreateBuilder();
                            groupUserInfo.SetGroupUserID(item.GroupUserID).SetNickName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(userInfoDB.nickname)))
                            .SetPicture(userInfoDB.headimg).SetStatus(0);
                            if (Gongyong.userlist.Any(w => w.UserID.Equals(item.GroupUserID)))
                            {
                                groupUserInfo.SetStatus(1);
                            }
                            if (RedisUtility.Get <RedisGameModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERGAME, userInfoDB.openid, userInfoDB.unionid)) != null)
                            {
                                groupUserInfo.SetStatus(2);
                            }
                            returnGroupInfo.AddUserList(groupUserInfo);
                        }
                    }
                    var data = returnGroupInfo.SetStatus(1).Build().ToByteArray();
                    session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1035, data.Length, requestInfo.MessageNum, data)));
                    return;
                }
            }
            var dataF = returnGroupInfo.SetStatus(0).Build().ToByteArray();

            session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1035, dataF.Length, requestInfo.MessageNum, dataF)));
        }
Exemple #13
0
        public ActionResult DoAddGroup(GroupUserInfo groupInfo)
        {
            var result = new ActionBusinessResult();

            try
            {
                var groupBL = new GroupUserBL();
                groupInfo.CreatedBy = SessionData.CurrentUser.Username;
                result = groupBL.AddGroup(groupInfo);
                MemoryData.ReloadGroup();
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(Json(new { result = result.ToJson() }));
        }
Exemple #14
0
        public static int AddGroup(GroupUserInfo groupAdd)
        {
            try
            {
                var paramReturn = new OracleParameter("p_return", OracleDbType.Int32, ParameterDirection.Output);
                OracleHelper.ExecuteNonQuery(Configuration.connectionString, CommandType.StoredProcedure, "pkg_s_groups.proc_GroupUser_AddNew",
                                             new OracleParameter("p_groupName", OracleDbType.Varchar2, groupAdd.Name, ParameterDirection.Input),
                                             new OracleParameter("p_notes", OracleDbType.Varchar2, groupAdd.Notes, ParameterDirection.Input),
                                             new OracleParameter("p_CreatedBy", OracleDbType.Varchar2, groupAdd.CreatedBy, ParameterDirection.Input),
                                             paramReturn);
                var result = Convert.ToInt32(paramReturn.Value.ToString());
                return(result);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(KnMessageCode.AddGroupFail.GetCode());
        }
        private void GroupUser_Delete()
        {
            try
            {
                GroupUserInfo mf = new GroupUserInfo();
                mf        = GetRow();
                rowselect = dgrGroupUser.SelectedIndex;
                if (mf == null)
                {
                    return;
                }

                if (CheckDeleteGroupUser(mf.Id))
                {
                    MessageBoxResult rs = NoteBox.Show("Bạn có muốn xóa nhóm người sử dụng hay không?", "Thông báo", NoteBoxLevel.Question);
                    if (rs == MessageBoxResult.Yes)
                    {
                        _grUsCon.GroupUser_Delete(mf.Id);
                        NoteBox.Show("Xóa dữ liệu thành công");
                        LoadData();
                        DataGridHelper.NVSFocus(dgrGroupUser, 0, 1);
                        dgrGroupUser.Focus();
                    }
                    else if (rs == MessageBoxResult.No)
                    {
                        DataGridHelper.NVSFocus(dgrGroupUser, rowselect, 1);
                    }
                }
                else
                {
                    NoteBox.Show("Không thể xóa nhóm vì trong nhóm đang có user. Hãy xóa hoặc chuyển tất cả user sang nhóm khác", "Thông báo", NoteBoxLevel.Error);
                    DataGridHelper.NVSFocus(dgrGroupUser, rowselect, 1);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemple #16
0
        /// <summary>
        /// update theo id GroupUser
        /// </summary>
        public bool GroupUser_Update(decimal id, GroupUserInfo p_GroupUserInfo)
        {
            try
            {
                //Common.CommonData.c_serviceWCF.GroupUser_Update(id, p_GroupUserInfo.Name, p_GroupUserInfo.Group_Type, p_GroupUserInfo.Note);

                SqlParameter[] spParameter = new SqlParameter[4];

                int i = 0;
                spParameter[i]           = new SqlParameter("@Name", SqlDbType.NVarChar);
                spParameter[i].Direction = ParameterDirection.Input;
                spParameter[i].Value     = p_GroupUserInfo.Name;

                i++;
                spParameter[i]           = new SqlParameter("@Group_Type", SqlDbType.Int);
                spParameter[i].Direction = ParameterDirection.Input;
                spParameter[i].Value     = p_GroupUserInfo.Group_Type;

                i++;
                spParameter[i]           = new SqlParameter("@Note", SqlDbType.NVarChar);
                spParameter[i].Direction = ParameterDirection.Input;
                spParameter[i].Value     = p_GroupUserInfo.Note;

                i++;
                spParameter[i]           = new SqlParameter("@Id", SqlDbType.Int);
                spParameter[i].Direction = ParameterDirection.Input;
                spParameter[i].Value     = id;

                SqlHelper.ExecuteNonQuery(CommonData.ConnectionString, CommandType.StoredProcedure, "proc_Group_User_Update", spParameter);

                return(true);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                return(false);
            }
        }
        private void loadView()
        {
            try
            {
                rowselect = dgrGroupUser.SelectedIndex;
                GroupUserInfo ms = new GroupUserInfo();

                GroupUser_View frmView = new GroupUser_View();
                ms = GetRow();
                if (ms == null)
                {
                    return;
                }
                frmView.Owner           = Window.GetWindow(this);
                frmView.c_GroupUserInfo = ms;
                frmView.ShowDialog();
                DataGridHelper.NVSFocus(dgrGroupUser, rowselect, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemple #18
0
        public decimal GroupUser_Insert(GroupUserInfo p_GroupUserInfo)
        {
            try
            {
                decimal        _id         = -1;
                SqlParameter[] spParameter = new SqlParameter[4];

                int i = 0;
                spParameter[i]           = new SqlParameter("@Name", SqlDbType.NVarChar);
                spParameter[i].Direction = ParameterDirection.Input;
                spParameter[i].Value     = p_GroupUserInfo.Name;

                i++;
                spParameter[i]           = new SqlParameter("@Group_Type", SqlDbType.Int);
                spParameter[i].Direction = ParameterDirection.Input;
                spParameter[i].Value     = p_GroupUserInfo.Group_Type;

                i++;
                spParameter[i]           = new SqlParameter("@Note", SqlDbType.NVarChar);
                spParameter[i].Direction = ParameterDirection.Input;
                spParameter[i].Value     = p_GroupUserInfo.Note;

                i++;
                spParameter[i]           = new SqlParameter("@Id", SqlDbType.Int);
                spParameter[i].Direction = ParameterDirection.Output;
                spParameter[i].Value     = _id;

                SqlHelper.ExecuteNonQuery(CommonData.ConnectionString, CommandType.StoredProcedure, "proc_Group_User_Insert", spParameter);

                return(Convert.ToDecimal(spParameter[i].Value));
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                return(-1);
            }
        }
        /// <summary>
        /// cập nhật thông tin Match_Type
        /// </summary>
        private void GroupUser_Update()
        {
            try
            {
                Group_User_Update upGroup_User = new Group_User_Update();
                GroupUserInfo     ms           = new GroupUserInfo();
                ms = GetRow();

                rowselect          = dgrGroupUser.SelectedIndex;
                upGroup_User.Owner = Window.GetWindow(this);
                if (ms == null)
                {
                    return;
                }


                upGroup_User.c_GroupUserInfo = ms;
                upGroup_User.NVSQuyen_Core   = this.NVSQuyen_Core;

                upGroup_User.ShowDialog();
                if (upGroup_User.c_editOK == 1)
                {
                    LoadData();
                    DataGridHelper.NVSFocus(dgrGroupUser, rowselect, 1);
                    upGroup_User.c_editOK = 0;
                }
                else
                {
                    DataGridHelper.NVSFocus(dgrGroupUser, rowselect, 1);
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemple #20
0
        public override GetGroupsResponseBody ExecuteCore()
        {
            GetGroupsResponseBody res = new GetGroupsResponseBody();

            //获取用户所在组的guid
            List <string> groupGuids = db.t_group_user.Where(g => g.user_id == this.request.UserId).Select(g => g.group_guid).ToList();

            if (groupGuids == null || groupGuids.Count <= 0)
            {
                return(res);
            }

            var groups = db.t_group.Where(g => groupGuids.Contains(g.group_guid)).ToList();

            if (groups == null || groups.Count <= 0)
            {
                return(res);
            }

            var groupUsers = db.t_group_user.Where(u => groupGuids.Contains(u.group_guid)).ToList();

            List <int> userIds = groupUsers.Select(u => u.user_id).ToList();
            var        users   = db.t_user.Where(u => userIds.Contains(u.id)).Select(u => new { u.id, u.name, u.head_image }).ToList();

            List <t_group> emptyGroup = new List <t_group>();

            res.GroupInfos = new List <GroupInfo>();
            groups.ForEach(f =>
            {
                GroupInfo info = new GroupInfo()
                {
                    GroupGuid      = f.group_guid,
                    BuildUserId    = f.build_user_id,
                    GroupName      = f.group_name,
                    GroupNote      = f.group_note,
                    GroupUserCount = f.group_user_count,
                    GroupUsers     = groupUsers.Where(u => u.group_guid == f.group_guid).Select(u =>
                    {
                        GroupUserInfo user = new GroupUserInfo()
                        {
                            UserId        = u.user_id,
                            GroupGuid     = u.group_guid,
                            UserHeadImage = users.Where(i => i.id == u.user_id).Select(i => i.head_image).FirstOrDefault(),
                            UserName      = users.Where(i => i.id == u.user_id).Select(i => i.name).FirstOrDefault()
                        };

                        return(user);
                    }).ToList(),
                    BuildDate  = GenericUtility.FormatDate2(f.build_date),
                    UpdateDate = GenericUtility.FormatDate2(f.update_date),
                };
                info.GroupUserImages = info.GroupUsers.Select(u => u.UserHeadImage).Take(AppConfigManager.GROUP_USER_IMAGE_COUNT).ToList();

                if (info.GroupUsers == null || info.GroupUsers.Count <= 0)
                {
                    emptyGroup.Add(f);
                }
                else
                {
                    res.GroupInfos.Add(info);
                }
            });

            if (emptyGroup.Count > 0)
            {
                db.t_group.RemoveRange(emptyGroup);
                //try
                //{
                db.SaveChanges();
                //}
                //catch (Exception)
                //{
                //}
            }

            return(res);
        }