/// <summary>
        ///  添加对象
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool EditCriminalUser(BaneCriminalModel model)
        {
            if (model == null)
            {
                return(false);
            }
            Bane_CriminalRecord record = new Bane_CriminalRecord
            {
                user_identify   = model.user_identify,
                start_drug_date = (!string.IsNullOrEmpty(model.start_drug_date)) ? DateTime.ParseExact(model.start_drug_date, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN")) : (DateTime?)null,
                drug_year       = model.drug_year,
                force_time      = model.force_time,
                force_insulate  = model.force_insulate,
                other_record    = model.other_record
            };

            DBSession.IBane_CriminalRecordDAL.Modify(record, s => s.cr_id == model.cr_id, "start_drug_date", "drug_year", "force_time", "force_insulate", "other_record");
            return(true);
        }
        /// <summary>
        ///  添加对象
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddCriminalUser(BaneCriminalModel model)
        {
            if (model == null)
            {
                return(false);
            }
            Bane_CriminalRecord record = new Bane_CriminalRecord
            {
                user_identify   = model.user_identify,
                start_drug_date = (!string.IsNullOrEmpty(model.start_drug_date)) ? DateTime.ParseExact(model.start_drug_date, "yyyy-MM-dd", new System.Globalization.CultureInfo("zh-CN")) : (DateTime?)null,
                drug_year       = model.drug_year,
                force_time      = model.force_time,
                force_insulate  = model.force_insulate,
                other_record    = model.other_record
            };
            int mark = DBSession.IBane_CriminalRecordDAL.Add(record);

            return(mark > 0 ? true : false);
        }
Esempio n. 3
0
        public ActionResult EditCriminalRecord(BaneCriminalModel model)
        {
            if (!ModelState.IsValid)
            {
                return(operateContext.RedirectAjax(1, "数据验证失败~", "", ""));
            }
            bool IsBack = true;

            try
            {
                IsBack = operateContext.bllSession.Bane_CriminalRecord.EditCriminalUser(model);
            }
            catch (Exception ex)
            {
                return(operateContext.RedirectAjax(1, ex.Message, "", ""));
            }
            if (IsBack)
            {
                return(operateContext.RedirectAjax(0, "编辑用户成功~", "", ""));
            }
            return(operateContext.RedirectAjax(1, "编辑用户失败~", "", ""));
        }
Esempio n. 4
0
 public ActionResult AddCriminalRecord(BaneCriminalModel model)
 {
     ModelState.Remove("cr_id");
     if (!ModelState.IsValid)
     {
         return(operateContext.RedirectAjax(1, "数据验证失败~", "", ""));
     }
     try
     {
         //添加之前判断身份证是否被占用
         bool Isback = operateContext.bllSession.Bane_CriminalRecord.AddCriminalUser(model);
         if (Isback)
         {
             return(operateContext.RedirectAjax(0, "添加数据成功~", "", ""));
         }
         return(operateContext.RedirectAjax(1, "添加数据失败~", "", ""));
     }
     catch (Exception ex)
     {
         return(operateContext.RedirectAjax(1, ex.Message, "", ""));
     }
 }