コード例 #1
0
 public virtual bool Insert(SMC_UserList userlist)
 {
     try
     {
         SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
         if (autoDao.HasMaxID("SMC_UserList"))
         {
             int max_id = autoDao.GetMaxID("SMC_UserList");
             userlist.UL_ID = max_id + 1;
         }
         else
         {
             userlist.UL_ID = 1;
         }
         int i = SMC_UserListDao.Insert(userlist);
         if (i > 0)
         {
             autoDao.UpdateMaxID("SMC_UserList");
         }
         return(i > 0);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法Insert失败", ex);
     }
 }
コード例 #2
0
        public JsonResult SavePersonsTree(string ids, string ids_changed, int roleId)
        {
            string[] idsArray         = ids.Split(",".ToCharArray());
            string[] idsArray_changed = ids_changed.Split(",".ToCharArray());
            foreach (string sId in idsArray)
            {
                if (!sId.StartsWith("u_"))
                {
                    continue;
                }
                if (!String.IsNullOrEmpty(sId))
                {
                    SMC_UserList user = BoFactory.GetSMC_UserListBo.Get(int.Parse(sId.Replace("u_", "")));
                    user.Role_ID = roleId;

                    BoFactory.GetSMC_UserListBo.InsertOrUpdate(user);
                }
            }

            foreach (string sId in idsArray_changed)
            {
                if (!sId.StartsWith("u_"))
                {
                    continue;
                }
                if (!String.IsNullOrEmpty(sId))
                {
                    SMC_UserList user = BoFactory.GetSMC_UserListBo.Get(int.Parse(sId.Replace("u_", "")));
                    user.Role_ID = 0;

                    BoFactory.GetSMC_UserListBo.InsertOrUpdate(user);
                }
            }
            return(Json(new { result = true, d = "保存成功!" }));
        }
コード例 #3
0
        public ActionResult AddModifyUser()
        {
            string sUser = Request.QueryString["UserID"];
            string sUnit = Request.QueryString["Upper_Unit_ID"];
            int    user_id = 0; string unit_id = "";

            if (!String.IsNullOrEmpty(sUser))
            {
                user_id = int.Parse(sUser);
            }
            if (!String.IsNullOrEmpty(sUnit))
            {
                unit_id = sUnit;
            }

            //string unit_Name = BoFactory.GetSMC_UnitBo.Get(unit_id).Unit_Name;
            this.ViewData["user_id"] = user_id;
            this.ViewData["unit_id"] = unit_id;
            //this.ViewData["Unit_Name"] = unit_Name;

            List <SelectListItem> unitList = new List <SelectListItem>();
            IList <SMC_Unit>      units = BoFactory.GetSMC_UnitBo.GetAllUnits();



            ViewData["Unit_Name"] = unitList;


            if (user_id == 0)
            {
                foreach (var r in units)
                {
                    unitList.Add(new SelectListItem {
                        Text = r.Unit_Name, Value = r.Unit_ID.ToString(), Selected = r.Unit_ID == unit_id
                    });
                }
                return(View());
            }
            else
            {
                SMC_UserList ur = BoFactory.GetSMC_UserListBo.Get(user_id);
                this.ViewData["unit_id"] = ur.Unit_ID;
                SMC_Unit un        = BoFactory.GetSMC_UnitBo.Get(ur.Unit_ID);
                string   unit_Name = un == null ? "" : un.Unit_Name;
                ur.Unit_Name = unit_Name;
                foreach (var r in units)
                {
                    unitList.Add(new SelectListItem {
                        Text = r.Unit_Name, Value = r.Unit_ID.ToString(), Selected = r.Unit_ID == ur.Unit_ID
                    });
                }

                return(View(ur));
            }
        }
コード例 #4
0
 public virtual void Delete(SMC_UserList entity)
 {
     try
     {
         SMC_UserListDao.Delete(entity);
     }
     catch (DalException ex)
     {
         throw new BOException("????????????", ex);
     }
 }
コード例 #5
0
 public virtual int Save(SMC_UserList entity)
 {
     if (SMC_UserListDao.Get(entity.UL_ID) == null)
     {
         return(SMC_UserListDao.Insert(entity));
     }
     else
     {
         return(SMC_UserListDao.Update(entity));
     }
 }
コード例 #6
0
 public virtual bool Update(SMC_UserList userlist)
 {
     try
     {
         int i = SMC_UserListDao.Update(userlist);
         return(i > 0);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法Update失败", ex);
     }
 }
コード例 #7
0
 public virtual bool SetRoleToUser(int role_id, int user_id)
 {
     try
     {
         bool         result = false;
         SMC_UserList user   = SMC_UserListDao.Get(user_id);
         user.Role_ID = role_id;
         int i = SMC_UserListDao.Update(user);
         return(result);
     }
     catch (DalException ex)
     {
         throw new BOException("调用方法SetRoleToUser失败", ex);
     }
 }
コード例 #8
0
        public ActionResult AddModifyUserSave(FormCollection form)
        {
            JsonReturnMessages data = new JsonReturnMessages()
            {
                IsSuccess = true, Msg = "操作成功"
            };

            SMC_UserList ur     = null;
            int          userId = Convert.ToInt32(form[0]);

            if (userId == 0)
            {
                ur = new SMC_UserList();
                ur.UL_CreatedTime = DateTime.Now;
                ur.UL_ID          = -1;
                ur.UL_UID         = form["UL_UID"];
                ur.UL_PWD         = form["UL_PWD"];
                ur.Unit_ID        = form["Unit_Name"];
            }
            else
            {
                ur = BoFactory.GetSMC_UserListBo.Get(userId);
            }

            ur.Unit_ID        = form["unit_id"];
            ur.UL_Name        = form["UL_Name"];
            ur.UL_MobilePhone = form["UL_MobilePhone"];
            ur.UL_MailAddress = form["UL_MailAddress"];
            ur.UL_Sequence    = Convert.ToInt32(form["UL_Sequence"]);
            ur.UL_Demo        = form["UL_Demo"];
            ur.Unit_ID        = form["Unit_Name"];
            ur.UL_UID         = ur.UL_UID.Trim();
            try
            {
                BoFactory.GetSMC_UserListBo.InsertOrUpdate(ur);
            }
            catch (Exception ex)
            {
                data.IsSuccess = false;
                data.Msg       = ex.Message;
            }

            return(Json(data));
        }
コード例 #9
0
        public ActionResult DelUser(int ul_id)
        {
            JsonReturnMessages data = new JsonReturnMessages()
            {
                IsSuccess = true, Msg = "操作成功"
            };
            SMC_UserList ur = BoFactory.GetSMC_UserListBo.Get(ul_id);

            if (ur != null && CurrentUser.UserUId != ur.UL_UID)
            {
                BoFactory.GetSMC_UserListBo.Delete(ur);
            }
            else
            {
                data.IsSuccess = false;
                data.Msg       = "不能删除自己的账号";
            }

            return(Json(data));
        }
コード例 #10
0
        public ActionResult RegUser(FormCollection form)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };

            SMC_UserList ur = new SMC_UserList();

            ur.UL_ID = -1;
            ur.UL_UID = form[0];
            ur.UL_Name = form[1];
            ur.UL_PWD = form[2];
            ur.UL_MobilePhone = form[4];
            ur.UL_MailAddress = form[5];
            ur.Unit_ID =form[6];
            ur.UL_Sequence = Int32.Parse(form[7]);
            ur.UL_Demo = form[8];
            ur.UL_Gender = form[9];

            BoFactory.GetSMC_UserListBo.InsertOrUpdate(ur);

            return Json(data);
        }
コード例 #11
0
        public ActionResult SetUserListRole(string user_id, string Role_ID)
        {
            JsonReturnMessages data = new JsonReturnMessages()
            {
                IsSuccess = true, Msg = "操作成功"
            };

            try
            {
                SMC_UserList su = BoFactory.GetSMC_UserListBo.Get(Int32.Parse(user_id));
                su.Role_ID = Int32.Parse(Role_ID);

                BoFactory.GetSMC_UserListBo.InsertOrUpdate(su);
            }
            catch (Exception e)
            {
                data.IsSuccess = false;
                data.Msg       = e.Message;
            }

            return(Json(data));
        }
コード例 #12
0
        public ActionResult ResetUserPassWord()
        {
            string sUser   = Request.QueryString["UserID"];
            int    user_id = 0;

            if (!String.IsNullOrEmpty(sUser))
            {
                user_id = int.Parse(sUser);
            }
            SMC_UserList ur  = BoFactory.GetSMC_UserListBo.Get(user_id);
            var          isM = BoFactory.GetVersionTrackBo.IsSystemManager(CurrentUser.UserUId);

            this.ViewData["user_id"] = user_id;
            if (isM)
            {
                this.ViewData["IsManager"] = "manager";
            }
            else
            {
                this.ViewData["IsManager"] = "notmanager";
            }
            return(View(ur));
        }
コード例 #13
0
        public ActionResult SetUserListRole(FormCollection form)
        {
            List <SelectListItem> roleList = new List <SelectListItem>();

            roleList.Add(new SelectListItem {
                Text = "请选择角色", Value = "0", Selected = true
            });
            PageView view = new PageView(form);
            string   sUser = Request.QueryString["ul_id"];
            string   sUnit = Request.QueryString["UnitID"];
            int      user_id = 0; string unit_id = "";

            if (!String.IsNullOrEmpty(sUser))
            {
                user_id = int.Parse(sUser);
            }
            if (!String.IsNullOrEmpty(sUnit))
            {
                unit_id = sUnit;
            }
            SMC_UserList      su   = BoFactory.GetSMC_UserListBo.Get(user_id);
            JsonFlexiGridData data = BoFactory.GetSMC_RoleBo.QueryRolesByUnitID(view, unit_id);

            if (data.total > 0)
            {
                foreach (FlexiGridRow r in data.rows)
                {
                    roleList.Add(new SelectListItem {
                        Text = r.cell[0], Value = r.id, Selected = r.cell[0] == su.Role_ID.ToString()
                    });
                }
            }

            ViewData["Role_ID"] = roleList;
            ViewData["user_id"] = su.UL_ID;
            return(View(su));
        }
コード例 #14
0
        public ActionResult RegUser(FormCollection form)
        {
            JsonReturnMessages data = new JsonReturnMessages()
            {
                IsSuccess = true, Msg = "操作成功"
            };

            SMC_UserList ur = new SMC_UserList();

            ur.UL_ID          = -1;
            ur.UL_UID         = form[0];
            ur.UL_Name        = form[1];
            ur.UL_PWD         = form[2];
            ur.UL_MobilePhone = form[4];
            ur.UL_MailAddress = form[5];
            ur.Unit_ID        = form[6];
            ur.UL_Sequence    = Int32.Parse(form[7]);
            ur.UL_Demo        = form[8];
            ur.UL_Gender      = form[9];

            BoFactory.GetSMC_UserListBo.InsertOrUpdate(ur);

            return(Json(data));
        }
コード例 #15
0
        public ActionResult ResetUserPassWordSave(FormCollection form)
        {
            JsonReturnMessages data = new JsonReturnMessages()
            {
                IsSuccess = true, Msg = "修改成功"
            };
            SMC_UserList ur     = null;
            int          userId = Convert.ToInt32(form["user_id"]);

            ur = BoFactory.GetSMC_UserListBo.Get(userId);
            var isM = BoFactory.GetVersionTrackBo.IsSystemManager(CurrentUser.UserUId);

            if (!isM && ur.UL_PWD != form["UL_OPWD"])
            {
                data.IsSuccess = false;
                data.Msg       = "原密码输入错误";
                return(Json(data));
            }

            ur.UL_PWD = form["UL_NPWD"];
            BoFactory.GetSMC_UserListBo.InsertOrUpdate(ur);

            return(Json(data));
        }
コード例 #16
0
        public virtual bool InsertOrUpdate(SMC_UserList userList)
        {
            try
            {
                IUserService us = Beyondbit.BUA.Client.ServiceFactory.Instance().GetUserService();
                IOrgService os = Beyondbit.BUA.Client.ServiceFactory.Instance().GetOrgService();
                Beyondbit.BUA.Client.User usr = null;
                try
                {
                    usr = us.GetUserInfo(userList.UL_UID);
                }
                catch
                {
                }

                //Beyondbit.BUA.Client.User[] _users = us.QueryUsersByObjectCode(ObjectType.User, userList.UL_UID);
                if (usr == null)
                {
                    try
                    {
                        //�����û���ͳһ��Ȩ
                        Beyondbit.BUA.Client.User u = new Beyondbit.BUA.Client.User();
                        u.UserUid = userList.UL_UID;
                        u.UserName = userList.UL_Name;
                        u.UserFullName = userList.UL_Name;
                        u.UserEmail = userList.UL_MailAddress == null ? "" : userList.UL_MailAddress;
                        u.UserPersonal = new UserPersonal();
                        u.UserPersonal.UserMobilePhone = userList.UL_MobilePhone;
                        u.UnitCode = userList.Unit_ID;
                        u.OrgCode = userList.Unit_ID;
                        u.UserPassword = userList.UL_PWD;
                        us.AddUser(u);
                    }
                    catch (Exception exe)
                    {
                    }
                }
                else
                {
                }

                int i = 0;
                if (SMC_UserListDao.Get(userList.UL_ID) == null)
                {
                    //i = SMC_UserListDao.Insert(userList);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    if (autoDao.HasMaxID("SMC_UserList"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_UserList");
                        userList.UL_ID = max_id + 1;
                    }
                    else
                    {
                        userList.UL_ID = 1;
                    }
                    i = SMC_UserListDao.Insert(userList);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_UserList");
                    }
                }
                else
                {
                    i = SMC_UserListDao.Update(userList);
                }

                return true;
            }
            catch (DalException ex)
            {
                throw new BOException("���÷���InsertOrUpdateʧ��", ex);
            }
        }
コード例 #17
0
 public virtual int Save(SMC_UserList entity)
 {
     if (SMC_UserListDao.Get(entity.UL_ID) == null)
         return SMC_UserListDao.Insert(entity);
     else
         return SMC_UserListDao.Update(entity);
 }
コード例 #18
0
 public virtual bool Update(SMC_UserList userlist)
 {
     try
     {
         int i = SMC_UserListDao.Update(userlist);
         return i > 0;
     }
     catch (DalException ex)
     {
         throw new BOException("���÷���Updateʧ��", ex);
     }
 }
コード例 #19
0
        public virtual bool InsertOrUpdate(SMC_UserList userList)
        {
            try
            {
                IUserService us = Beyondbit.BUA.Client.ServiceFactory.Instance().GetUserService();
                IOrgService  os = Beyondbit.BUA.Client.ServiceFactory.Instance().GetOrgService();
                Beyondbit.BUA.Client.User usr = null;
                try
                {
                    usr = us.GetUserInfo(userList.UL_UID);
                }
                catch
                {
                }

                //Beyondbit.BUA.Client.User[] _users = us.QueryUsersByObjectCode(ObjectType.User, userList.UL_UID);
                if (usr == null)
                {
                    try
                    {
                        //新增用户到统一授权
                        Beyondbit.BUA.Client.User u = new Beyondbit.BUA.Client.User();
                        u.UserUid      = userList.UL_UID;
                        u.UserName     = userList.UL_Name;
                        u.UserFullName = userList.UL_Name;
                        u.UserEmail    = userList.UL_MailAddress == null ? "" : userList.UL_MailAddress;
                        u.UserPersonal = new UserPersonal();
                        u.UserPersonal.UserMobilePhone = userList.UL_MobilePhone;
                        u.UnitCode     = userList.Unit_ID;
                        u.OrgCode      = userList.Unit_ID;
                        u.UserPassword = userList.UL_PWD;
                        us.AddUser(u);
                    }
                    catch (Exception exe)
                    {
                    }
                }
                else
                {
                }


                int i = 0;
                if (SMC_UserListDao.Get(userList.UL_ID) == null)
                {
                    //i = SMC_UserListDao.Insert(userList);
                    SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
                    if (autoDao.HasMaxID("SMC_UserList"))
                    {
                        int max_id = autoDao.GetMaxID("SMC_UserList");
                        userList.UL_ID = max_id + 1;
                    }
                    else
                    {
                        userList.UL_ID = 1;
                    }
                    i = SMC_UserListDao.Insert(userList);
                    if (true)
                    {
                        autoDao.UpdateMaxID("SMC_UserList");
                    }
                }
                else
                {
                    i = SMC_UserListDao.Update(userList);
                }

                return(true);
            }
            catch (DalException ex)
            {
                throw new BOException("调用方法InsertOrUpdate失败", ex);
            }
        }
コード例 #20
0
 public virtual void Delete(SMC_UserList entity)
 {
     try
     {
         SMC_UserListDao.Delete(entity);
     }
     catch (DalException ex)
     {
         throw new BOException("????????????", ex);
     }
 }
コード例 #21
0
        public ActionResult AddModifyUserSave(FormCollection form)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };

            SMC_UserList ur = null;
            int userId =Convert.ToInt32(form[0]);
            if (userId == 0)
            {
                ur = new SMC_UserList();
                ur.UL_CreatedTime = DateTime.Now;
                ur.UL_ID = -1;
                ur.UL_UID = form["UL_UID"];
                ur.UL_PWD = form["UL_PWD"];
                ur.Unit_ID = form["Unit_Name"];
            }
            else
            {
                ur = BoFactory.GetSMC_UserListBo.Get(userId);
            }

            ur.Unit_ID =form["unit_id"];
            ur.UL_Name = form["UL_Name"];
            ur.UL_MobilePhone = form["UL_MobilePhone"];
            ur.UL_MailAddress = form["UL_MailAddress"];
            ur.UL_Sequence = Convert.ToInt32(form["UL_Sequence"]);
            ur.UL_Demo = form["UL_Demo"];
            ur.Unit_ID = form["Unit_Name"];
            ur.UL_UID = ur.UL_UID.Trim();
            try
            {
                BoFactory.GetSMC_UserListBo.InsertOrUpdate(ur);
            }
            catch (Exception ex)
            {
                data.IsSuccess = false;
                data.Msg = ex.Message;
            }

            return Json(data);
        }
コード例 #22
0
 public virtual bool Insert(SMC_UserList userlist)
 {
     try
     {
         SMC_AutoTableIDDao autoDao = new SMC_AutoTableIDDao(AppConfig.statisticDBKey);
         if (autoDao.HasMaxID("SMC_UserList"))
         {
             int max_id = autoDao.GetMaxID("SMC_UserList");
             userlist.UL_ID = max_id + 1;
         }
         else
         {
             userlist.UL_ID = 1;
         }
         int i = SMC_UserListDao.Insert(userlist);
         if (i > 0)
         {
             autoDao.UpdateMaxID("SMC_UserList");
         }
         return i > 0;
     }
     catch (DalException ex)
     {
         throw new BOException("���÷���Insertʧ��", ex);
     }
 }