コード例 #1
0
        private Entities.UserGroupDataRigth LoadSingleUserGroupDataRigth(DataRow row)
        {
            Entities.UserGroupDataRigth model = new Entities.UserGroupDataRigth();

            if (row["RecID"].ToString() != "")
            {
                model.RecID = int.Parse(row["RecID"].ToString());
            }
            if (row["UserID"].ToString() != "")
            {
                model.UserID = int.Parse(row["UserID"].ToString());
            }
            if (row["BGID"].ToString() != "")
            {
                model.BGID = int.Parse(row["BGID"].ToString());
            }
            if (row["RightType"].ToString() != "")
            {
                model.RightType = int.Parse(row["RightType"].ToString());
            }
            if (row["CreateTime"].ToString() != "")
            {
                model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
            }
            if (row["CreateUserID"].ToString() != "")
            {
                model.CreateUserID = int.Parse(row["CreateUserID"].ToString());
            }
            return(model);
        }
コード例 #2
0
        //分组权限 插日志
        private void userGroupDataRigthInsertLog(Entities.UserGroupDataRigth oldModel, Entities.UserGroupDataRigth newModel)
        {
            string userLogStr = string.Empty;
            string logStr     = string.Empty;

            Hashtable ht_FieldName = new Hashtable();

            ht_FieldName.Add("UserID", "员工姓名");
            ht_FieldName.Add("RightType", "数据权限");
            ht_FieldName.Add("CreateTime", "编辑时间");
            ht_FieldName.Add("CreateUserID", "编辑人");
            ht_FieldName.Add("BGID", "所属分组");

            BLL.GetLogDesc.ht_FieldName = ht_FieldName;

            Hashtable ht_FieldType = new Hashtable();

            Hashtable ht_RightType = new Hashtable();

            ht_FieldName.Add("1", "本人");
            ht_FieldName.Add("2", "本组");

            ht_FieldType.Add("UserID", "UserID");
            ht_FieldType.Add("RightType", ht_FieldName);
            ht_FieldType.Add("CreateUserID", "UserID");
            ht_FieldType.Add("BGID", GetGroup());

            BLL.GetLogDesc.ht_FieldType = ht_FieldType;

            if (oldModel == null && newModel != null)//为空,则是新增
            {
                //插入日志
                BLL.GetLogDesc.getAddLogInfo(newModel, out userLogStr);

                logStr = "分组权限表新增:" + userLogStr;
            }
            else if (oldModel != null && newModel != null) //不为空,则是编辑
            {
                //插入日志
                BLL.GetLogDesc.getCompareLogInfo(oldModel, newModel, out userLogStr);

                logStr = "分组权限表编辑:" + userLogStr;
            }
            else if (oldModel != null && newModel == null)
            {
                //插入日志
                BLL.GetLogDesc.getDeleteLogInfo(oldModel, out userLogStr);

                logStr = "分组权限表信息删除:" + userLogStr;

                BLL.Util.InsertUserLog(logStr);
            }

            if (userLogStr != string.Empty)
            {
                BLL.Util.InsertUserLog(logStr);
            }
        }
コード例 #3
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(SqlTransaction sqltran, Entities.UserGroupDataRigth model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",        SqlDbType.Int,       4),
                new SqlParameter("@UserID",       SqlDbType.Int,       4),
                new SqlParameter("@BGID",         SqlDbType.Int,       4),
                new SqlParameter("@RightType",    SqlDbType.Int,       4),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@CreateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.RecID;
            parameters[1].Value = model.UserID;
            parameters[2].Value = model.BGID;
            parameters[3].Value = model.RightType;
            parameters[4].Value = model.CreateTime;
            parameters[5].Value = model.CreateUserID;

            return(SqlHelper.ExecuteNonQuery(sqltran, CONNECTIONSTRINGS, CommandType.StoredProcedure, P_USERGROUPDATARIGTH_UPDATE, parameters));
        }
コード例 #4
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Insert(Entities.UserGroupDataRigth model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",        SqlDbType.Int,       4),
                new SqlParameter("@UserID",       SqlDbType.Int,       4),
                new SqlParameter("@BGID",         SqlDbType.Int,       4),
                new SqlParameter("@RightType",    SqlDbType.Int,       4),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@CreateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.UserID;
            parameters[2].Value     = model.BGID;
            parameters[3].Value     = model.RightType;
            parameters[4].Value     = model.CreateTime;
            parameters[5].Value     = model.CreateUserID;

            SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_USERGROUPDATARIGTH_INSERT, parameters);
            return((int)parameters[0].Value);
        }
コード例 #5
0
 /// 保存用户信息的第二页内容
 /// <summary>
 /// 保存用户信息的第二页内容
 /// </summary>
 private void EmployeeAgentOptionForPageTwo(out string msg)
 {
     msg = "";
     try
     {
         int      userid       = UserID;
         string[] ids_beijing  = ManageBG_BeiJing.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
         string[] ids_xian     = ManageBG_XiAn.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
         int      login_userid = BLL.Util.GetLoginUserID();
         //清空管辖分组
         BLL.UserGroupDataRigth.Instance.DeleteByUserID(userid);
         //插入管辖分组 北京
         foreach (string bgid in ids_beijing)
         {
             Entities.UserGroupDataRigth groupDataRigthModel = new Entities.UserGroupDataRigth();
             groupDataRigthModel.CreateTime   = DateTime.Now;
             groupDataRigthModel.CreateUserID = login_userid;
             groupDataRigthModel.UserID       = userid;
             groupDataRigthModel.BGID         = CommonFunction.ObjectToInteger(bgid);
             BLL.UserGroupDataRigth.Instance.Insert(groupDataRigthModel);
         }
         BLL.Loger.Log4Net.Info("【用户基本信息设置——数据权限设置】1.更新用户[UserID=" + userid + "]北京的管辖分组为:" + ManageBG_BeiJing + "]");
         //插入管辖分组 西安
         foreach (string bgid in ids_xian)
         {
             Entities.UserGroupDataRigth groupDataRigthModel = new Entities.UserGroupDataRigth();
             groupDataRigthModel.CreateTime   = DateTime.Now;
             groupDataRigthModel.CreateUserID = login_userid;
             groupDataRigthModel.UserID       = userid;
             groupDataRigthModel.BGID         = CommonFunction.ObjectToInteger(bgid);
             BLL.UserGroupDataRigth.Instance.Insert(groupDataRigthModel);
         }
         BLL.Loger.Log4Net.Info("【用户基本信息设置——数据权限设置】2.更新用户[UserID=" + userid + "]西安的管辖分组为:" + ManageBG_XiAn + "]");
         msg = "{'result':'success'}";
     }
     catch (Exception ex)
     {
         msg = "{'result':'failure','msg':'" + ex.Message + "'}";
     }
 }
コード例 #6
0
        private void SaveManagerGroup()
        {
            BLL.UserGroupDataRigth.Instance.DeleteByUserID(int.Parse(UserID));

            if (ManagerGroupIDs != "")
            {
                int      userId         = BLL.Util.GetLoginUserID();
                string[] groupRightArry = ManagerGroupIDs.Split(',');

                foreach (string groupRight in groupRightArry)
                {
                    if (groupRight != "")
                    {
                        Entities.UserGroupDataRigth groupDataRigthModel = new Entities.UserGroupDataRigth();
                        groupDataRigthModel.CreateTime   = DateTime.Now;
                        groupDataRigthModel.CreateUserID = userId;
                        groupDataRigthModel.UserID       = int.Parse(UserID);
                        groupDataRigthModel.BGID         = int.Parse(groupRight);
                        BLL.UserGroupDataRigth.Instance.Insert(groupDataRigthModel);
                    }
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// 当时单个修改时,保存工号和数据权限
        /// </summary>
        private void ModifyOther()
        {
            int retNum = 0;

            #region 修改工号

            Entities.EmployeeAgent model    = new Entities.EmployeeAgent();
            Entities.EmployeeAgent oldModel = null;

            Entities.QueryEmployeeAgent query = new Entities.QueryEmployeeAgent();
            query.UserID = int.Parse(UserIDs);
            int       totalCount = 0;
            DataTable dt         = BLL.EmployeeAgent.Instance.GetEmployeeAgent(query, "", 1, 10, out totalCount);

            oldModel = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(int.Parse(UserIDs));


            //*add by qizq 2013-7-16 如果工号已存在,删除工号员工对应关系(程序走到这步说明用户已经选择要替换已有工号对应员工)
            if (!string.IsNullOrEmpty(AgentNum))
            {
                Entities.QueryEmployeeAgent queryHave = new Entities.QueryEmployeeAgent();
                queryHave.AgentNum = AgentNum;
                int       total  = 0;
                DataTable dtHave = BLL.EmployeeAgent.Instance.GetEmployeeAgent(queryHave, "", 1, 10, out total);
                if (total != 0)
                {
                    if (dtHave.Rows[0]["UserID"].ToString() != UserIDs)
                    {
                        BLL.EmployeeAgent.Instance.Delete(int.Parse(dtHave.Rows[0]["RecID"].ToString()));
                        string logStr = "删除用户工号:把" + BLL.Util.GetNameInHRLimitEID(Convert.ToInt32(dtHave.Rows[0]["UserID"].ToString())) + "的工号" + AgentNum + "删除";
                        BLL.Util.InsertUserLog(logStr);
                    }
                }
            }
            //*



            if (dt == null || dt.Rows.Count == 0)
            {
                model.UserID       = int.Parse(UserIDs);
                model.AgentNum     = AgentNum;
                model.CreateTime   = DateTime.Now;
                model.CreateUserID = BLL.Util.GetLoginUserID();

                //如果没有,则插入
                if (model.AgentNum != "")
                {
                    retNum = BLL.EmployeeAgent.Instance.Insert(model);

                    model.RecID = retNum;
                    employeeAgentInsertLog(null, model);
                }
            }
            else
            {
                //如果有,则修改
                if (dt.Rows[0]["AgentNum"].ToString() != AgentNum)
                {
                    //有变动,要修改
                    model          = BLL.EmployeeAgent.Instance.GetEmployeeAgent(int.Parse(dt.Rows[0]["RecID"].ToString()));
                    model.AgentNum = AgentNum;
                    if (model.AgentNum != "")
                    {
                        retNum = BLL.EmployeeAgent.Instance.Update(model);
                        employeeAgentInsertLog(oldModel, model);
                    }
                    //*add by qizq2013-7-16如果工号为空,删除人员坐席对应关系。
                    else
                    {
                        retNum = BLL.EmployeeAgent.Instance.Delete(model.RecID);
                        string logStr = "删除用户工号:把" + BLL.Util.GetNameInHRLimitEID(Convert.ToInt32(oldModel.UserID)) + "的工号" + oldModel.AgentNum + "删除";
                        BLL.Util.InsertUserLog(logStr);
                    }
                    //*
                }
            }


            #endregion

            #region 修改数据权限

            Entities.UserDataRigth modeldata = new Entities.UserDataRigth();

            Entities.UserDataRigth oldModel_UserData = null;

            Entities.QueryUserDataRigth dataQuery = new Entities.QueryUserDataRigth();
            dataQuery.UserID = int.Parse(UserIDs);

            DataTable datadt = BLL.UserDataRigth.Instance.GetUserDataRigth(dataQuery, "", 1, 10, out totalCount);

            oldModel_UserData = BLL.UserDataRigth.Instance.GetUserDataRigth(int.Parse(UserIDs));

            if (datadt == null || datadt.Rows.Count == 0)
            {
                modeldata.UserID       = int.Parse(UserIDs);
                modeldata.RightType    = int.Parse(RightType);
                modeldata.CreateTime   = DateTime.Now;
                modeldata.CreateUserID = BLL.Util.GetLoginUserID();

                //如果没有,则插入
                BLL.UserDataRigth.Instance.Insert(modeldata);

                userDataRigthInsertLog(null, modeldata);
            }
            else
            {
                //如果有,则修改

                if (datadt.Rows[0]["RightType"].ToString() != RightType)
                {
                    //如果数据权限有变动,则更新
                    modeldata           = BLL.UserDataRigth.Instance.GetUserDataRigth(int.Parse(datadt.Rows[0]["UserID"].ToString()));
                    modeldata.RightType = int.Parse(RightType);
                    retNum = BLL.UserDataRigth.Instance.Update(modeldata);

                    userDataRigthInsertLog(oldModel_UserData, modeldata);
                }
            }


            #endregion

            #region 分组设置
            if (!string.IsNullOrEmpty(GroupRightStr))
            {
                //先删除用户的分组
                BLL.UserGroupDataRigth.Instance.DeleteByUserID(int.Parse(UserIDs));
                BLL.Util.InsertUserLog("删除用户ID为:" + UserIDs + ",姓名为:" + BLL.Util.GetNameInHRLimitEID(int.Parse(UserIDs)) + " 下面的所属业务组");

                int      userId         = BLL.Util.GetLoginUserID();
                string[] groupRightArry = GroupRightStr.Split(';');
                foreach (string groupRight in groupRightArry)
                {
                    string[] arry = groupRight.Split('|');
                    Entities.UserGroupDataRigth groupDataRigthModel = new Entities.UserGroupDataRigth();
                    groupDataRigthModel.CreateTime   = DateTime.Now;
                    groupDataRigthModel.CreateUserID = userId;
                    groupDataRigthModel.RightType    = int.Parse(arry[1]);
                    groupDataRigthModel.UserID       = int.Parse(UserIDs);
                    groupDataRigthModel.BGID         = int.Parse(arry[0]);
                    int returnRecID = BLL.UserGroupDataRigth.Instance.Insert(groupDataRigthModel);
                    groupDataRigthModel.RecID = returnRecID;

                    userGroupDataRigthInsertLog(null, groupDataRigthModel);
                }
            }
            #endregion
        }
コード例 #8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(SqlTransaction sqltran, Entities.UserGroupDataRigth model)
 {
     return(Dal.UserGroupDataRigth.Instance.Update(sqltran, model));
 }
コード例 #9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Entities.UserGroupDataRigth model)
 {
     return(Dal.UserGroupDataRigth.Instance.Update(model));
 }
コード例 #10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Insert(Entities.UserGroupDataRigth model)
 {
     return(Dal.UserGroupDataRigth.Instance.Insert(model));
 }