コード例 #1
0
        public ActionResult EditUser(BaneAddModel user, BaneRecoveryModel model)
        {
            if (!ModelState.IsValid)
            {
                return(operateContext.RedirectAjax(1, "数据验证失败~", "", ""));
            }
            bool IsBack = true;
            //编辑身份证之前判断是否被占用
            List <HCQ2_Model.Bane_User> usr =
                operateContext.bllSession.Bane_User.Select(
                    s => s.user_identify.Equals(user.user_identify, StringComparison.CurrentCultureIgnoreCase) && s.user_id != user.user_id);

            if (null != usr && usr.Count > 0 && usr[0].user_id != user.user_id)
            {
                return(operateContext.RedirectAjax(1, "编辑用户失败,身份证已被占用请重新设置!", "", ""));
            }
            try
            {
                IsBack = operateContext.bllSession.Bane_User.EditUser(user, model);
                operateContext.bllSession.Bane_LogDetail.Add(new Bane_LogDetail {
                    user_id = operateContext.Usr.user_id, user_name = operateContext.Usr.user_name, log_type = "编辑禁毒人员", log_ip = RequestHelper.GetIP, log_title = "编辑用户", log_context = "编辑禁毒人员:" + user.user_identify, log_date = DateTime.Now
                });
                return(operateContext.RedirectAjax(0, "数据删除成功~", "", ""));
            }
            catch (Exception ex)
            {
                return(operateContext.RedirectAjax(1, ex.Message, "", ""));
            }
            if (IsBack)
            {
                return(operateContext.RedirectAjax(0, "编辑用户成功~", "", ""));
            }
            return(operateContext.RedirectAjax(1, "编辑用户失败~", "", ""));
        }
コード例 #2
0
 public ActionResult AddUser(BaneAddModel user, BaneRecoveryModel model)
 {
     ModelState.Remove("user_id");
     ModelState.Remove("ri_id");
     if (!ModelState.IsValid)
     {
         return(operateContext.RedirectAjax(1, "数据验证失败~", "", ""));
     }
     try
     {
         //添加之前判断身份证是否被占用
         List <Bane_User> usr =
             operateContext.bllSession.Bane_User.Select(
                 s => s.user_identify.Equals(user.user_identify, StringComparison.CurrentCultureIgnoreCase));
         if (null != usr && usr.Count > 0)
         {
             return(operateContext.RedirectAjax(1, "添加用户失败,当前身份证已存在!", "", ""));
         }
         bool Isback = operateContext.bllSession.Bane_User.AddUser(user, model);
         operateContext.bllSession.Bane_LogDetail.Add(new Bane_LogDetail {
             user_id = operateContext.Usr.user_id, user_name = operateContext.Usr.user_name, log_type = "添加禁毒人员", log_ip = RequestHelper.GetIP, log_title = "添加用户", log_context = "添加禁毒人员:" + user.user_identify, log_date = DateTime.Now
         });
         if (Isback)
         {
             return(operateContext.RedirectAjax(0, "添加用户成功~", "", ""));
         }
         return(operateContext.RedirectAjax(1, "添加用户失败~", "", ""));
     }
     catch (Exception ex)
     {
         return(operateContext.RedirectAjax(1, ex.Message, "", ""));
     }
 }
コード例 #3
0
        /// <summary>
        ///  添加戒毒人员
        /// </summary>
        /// <param name="user"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddUser(BaneAddModel user, BaneRecoveryModel model)
        {
            //报到时间
            DateTime next_date = DateTime.ParseExact(model.start_date, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN"));
            int      addMonth  = 1;//默认一个月周期
            //检查时间
            List <Bane_UrinalysisTimeSet> set = DBSession.IBane_UrinalysisTimeSetDAL.Select(s => s.user_type.Equals(user.user_type), o => o.gap_month, true);

            if (set != null)
            {
                addMonth = set[0].gap_month;
            }
            DateTime  user_next_date = next_date.AddMonths(addMonth);
            Bane_User baneUser       = new Bane_User
            {
                user_name      = user.user_name,
                alias_name     = user.alias_name,
                user_sex       = user.user_sex,
                user_birth     = DateTime.ParseExact(user.user_birth, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN")),
                user_height    = user.user_height,
                user_identify  = user.user_identify,
                user_edu       = user.user_edu,
                job_status     = user.job_status,
                bane_type      = user.bane_type,
                birth_url      = user.birth_url,
                family_phone   = user.family_phone,
                live_url       = user.live_url,
                move_phone     = user.move_phone,
                attn_name      = user.attn_name,
                attn_url       = user.attn_url,
                attn_relation  = user.attn_relation,
                attn_phone     = user.attn_phone,
                marital_status = user.marital_status,
                is_live_parent = user.is_live_parent,
                user_status    = user.user_status,
                is_pro_train   = user.is_pro_train,
                user_skill     = user.user_skill,
                user_type      = user.user_type,
                user_phone     = user.user_phone,
                ur_next_date   = user_next_date,
                user_photo     = GetPhotoUrl(user.user_photo, user.user_identify, user.org_id.ToString()),
                user_note      = user.user_note,
                org_id         = user.org_id,
                is_send        = false,//是否下发
                user_resume    = user.user_resume,
                iris_data1     = ss1(user.iris_data2),
                iris_data2     = ss2(user.iris_data2),
                update_date    = DateTime.Now
            };
            Bane_RecoveryInfo reInfo = new Bane_RecoveryInfo
            {
                user_identify      = model.user_identify,
                exec_area          = model.exec_area,
                exec_unit          = model.exec_unit,
                order_unit         = model.order_unit,
                is_aids            = model.is_aids,
                isolation_url      = model.isolation_url,
                isolation_out_date = (!string.IsNullOrEmpty(model.isolation_out_date)) ? DateTime.ParseExact(model.isolation_out_date, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN")) : (DateTime?)null,
                cure_ups           = model.cure_ups,
                in_recovery        = model.in_recovery,
                start_date         = next_date,
                end_date           = (!string.IsNullOrEmpty(model.end_date)) ? DateTime.ParseExact(model.end_date, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN")) : (DateTime?)null,
                end_reason         = model.end_reason
            };
            int mark = DBSession.IBane_UserDAL.Add(baneUser);

            DBSession.IBane_RecoveryInfoDAL.Add(reInfo);
            return(mark > 0 ? true : false);
        }
コード例 #4
0
        /// <summary>
        ///  编辑戒毒人员
        /// </summary>
        /// <param name="user"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool EditUser(BaneAddModel user, BaneRecoveryModel model)
        {
            List <Bane_UrinalysisRecord> list = DBSession.IBane_UrinalysisRecordDAL.Select(s => s.user_identify.Equals(user.user_identify));
            //报到时间
            DateTime next_date = DateTime.ParseExact(model.start_date, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN"));
            //下次尿检时间
            string    updateItem = "";
            Bane_User baneUser   = new Bane_User();

            if (list == null || list.Count <= 0)
            {
                int addMonth = 1;//默认一个月周期
                //检查时间
                List <Bane_UrinalysisTimeSet> set = DBSession.IBane_UrinalysisTimeSetDAL.Select(s => s.user_type.Equals(user.user_type), o => o.gap_month, true);
                if (set != null)
                {
                    addMonth = set[0].gap_month;
                }
                //下次尿检时间
                baneUser.ur_next_date = next_date.AddMonths(addMonth);
                updateItem            = ",ur_next_date";
            }
            baneUser.user_name      = user.user_name;
            baneUser.alias_name     = user.alias_name;
            baneUser.user_sex       = user.user_sex;
            baneUser.user_birth     = DateTime.ParseExact(user.user_birth, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN"));
            baneUser.user_height    = user.user_height;
            baneUser.user_identify  = user.user_identify;
            baneUser.user_edu       = user.user_edu;
            baneUser.job_status     = user.job_status;
            baneUser.bane_type      = user.bane_type;
            baneUser.birth_url      = user.birth_url;
            baneUser.family_phone   = user.family_phone;
            baneUser.live_url       = user.live_url;
            baneUser.move_phone     = user.move_phone;
            baneUser.attn_name      = user.attn_name;
            baneUser.attn_url       = user.attn_url;
            baneUser.attn_relation  = user.attn_relation;
            baneUser.attn_phone     = user.attn_phone;
            baneUser.marital_status = user.marital_status;
            baneUser.is_live_parent = user.is_live_parent;
            baneUser.user_status    = user.user_status;
            baneUser.is_pro_train   = user.is_pro_train;
            baneUser.user_skill     = user.user_skill;
            baneUser.user_type      = user.user_type;
            baneUser.user_phone     = user.user_phone;
            baneUser.user_photo     = GetPhotoUrl(user.user_photo, user.user_identify, user.org_id.ToString());
            baneUser.user_note      = user.user_note;
            baneUser.org_id         = user.org_id;
            baneUser.is_send        = false;//是否下发
            baneUser.user_resume    = user.user_resume;
            baneUser.iris_data1     = ss1(user.iris_data2);
            baneUser.iris_data2     = ss2(user.iris_data2);
            baneUser.update_date    = DateTime.Now;
            Bane_RecoveryInfo reInfo = new Bane_RecoveryInfo
            {
                user_identify      = model.user_identify,
                exec_area          = model.exec_area,
                exec_unit          = model.exec_unit,
                order_unit         = model.order_unit,
                is_aids            = model.is_aids,
                isolation_url      = model.isolation_url,
                isolation_out_date = (!string.IsNullOrEmpty(model.isolation_out_date)) ? DateTime.ParseExact(model.isolation_out_date, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN")) : (DateTime?)null,
                cure_ups           = model.cure_ups,
                in_recovery        = model.in_recovery,
                start_date         = next_date,
                end_date           = (!string.IsNullOrEmpty(model.end_date)) ? DateTime.ParseExact(model.end_date, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN")) : (DateTime?)null,
                end_reason         = model.end_reason
            };

            string[]      param = { "user_name", "alias_name", "user_sex", "user_birth", "user_height", "user_identify", "user_edu", "job_status", "bane_type", "birth_url", "family_phone", "live_url", "move_phone", "attn_name", "attn_url", "attn_relation", "attn_phone", "marital_status", "is_live_parent", "user_status", " is_pro_train", "user_skill", "user_type", "user_phone", "user_note", "is_send", "user_resume", "iris_data1", "iris_data2", "update_date" };
            List <string> _list = param.ToList();

            if (!string.IsNullOrEmpty(updateItem))
            {
                _list.Add("ur_next_date");
            }
            if (!string.IsNullOrEmpty(user.user_photo))
            {
                _list.Add("user_photo");
            }
            DBSession.IBane_UserDAL.Modify(baneUser, s => s.user_id == user.user_id, _list.ToArray());
            DBSession.IBane_RecoveryInfoDAL.Modify(reInfo, s => s.ri_id == model.ri_id, "user_identify", "exec_area", "exec_unit", "order_unit", "is_aids", "isolation_url", "isolation_out_date", "cure_ups", "in_recovery", "start_date", "end_date", "end_reason");
            return(true);
        }