Exemple #1
0
        public string AddBBHJCase(string param)
        {
            var obj = new { status = false, message = "" };

            try
            {
                if (param != "")
                {
                    BBHJCaseViewInfo model = JsonConvert.DeserializeObject <BBHJCaseViewInfo>(param);
                    if (!string.IsNullOrEmpty(model.BBHJCode))
                    {
                        if (!string.IsNullOrEmpty(model.RegisterInfoId))
                        {
                            if (!string.IsNullOrEmpty(model.Volunteer))
                            {
                                BBHJInfo bbhjInfo = new BBHJInfo()
                                {
                                    BBHJCode       = model.BBHJCode,
                                    BBHJInfoID     = System.Guid.NewGuid().ToString(),
                                    CreateDateTime = DateTime.Now,
                                    GuideTime      = DateTime.Now,
                                    RegisterInfoID = model.RegisterInfoId,
                                    Remark         = model.Remarks,
                                    Volunteer      = model.Volunteer
                                };
                                if (IBBHJInfo.CreateBBHJCase(bbhjInfo))
                                {
                                    obj = new { status = true, message = "添加成功" };
                                }
                                else
                                {
                                    obj = new { status = false, message = "添加失败" };
                                }
                            }
                            else
                            {
                                obj = new { status = false, message = "宝贝回家跟进志愿者不能为空" };
                            }
                        }
                        else
                        {
                            obj = new { status = false, message = "案例登记编号不能为空" };
                        }
                    }
                    else
                    {
                        obj = new { status = false, message = "宝贝回家案例编号不能为空" };
                    }
                }
                else
                {
                    obj = new { status = false, message = "参数不能为空" };
                }
            }
            catch (Exception ex)
            {
                obj = new { status = false, message = ex.Message };
            }
            return(JsonConvert.SerializeObject(obj));
        }
Exemple #2
0
        /// <summary>
        /// 设置为宝贝回家案例
        /// </summary>
        /// <param name="id">要设置的案例ID</param>
        /// <returns></returns>
        public bool Bbhj(string id)
        {
            using (var db = new SRISDBEntities())
            {
                var tran = db.Database.BeginTransaction();
                try
                {
                    // 修改案例状态为宝贝回家案例
                    RegisterInfo model = db.RegisterInfo.Find(id);
                    model.IsBBHJ = 1;

                    // 宝贝回家表添加数据
                    BBHJInfo bbModel = new BBHJInfo()
                    {
                        BBHJCode       = "",
                        BBHJInfoID     = System.Guid.NewGuid().ToString(),
                        CreateDateTime = DateTime.Now,
                        GuideTime      = DateTime.Now,
                        RegisterInfoID = id,
                        Remark         = "",
                        Volunteer      = ""
                    };
                    db.BBHJInfo.Add(bbModel);

                    db.SaveChanges();
                    tran.Commit();
                    return(true);
                }
                catch (Exception e)
                {
                    tran.Rollback();
                    return(false);
                }
            }
        }
Exemple #3
0
 /// <summary>
 /// 创建宝贝回家案例
 /// </summary>
 /// <param name="model">宝贝回家案例实体类</param>
 /// <returns></returns>
 public bool CreateBBHJCase(BBHJInfo model)
 {
     using (var db = new SRISDBEntities())
     {
         db.BBHJInfo.Add(model);
         RegisterInfo info = db.RegisterInfo.Find(model.RegisterInfoID);
         info.IsBBHJ = 1;
         db.SaveChanges();
         return(true);
     }
 }