Exemplo n.º 1
0
 /// <summary>
 /// 随访记录-保存
 /// </summary>
 /// <param name="sfData"></param>
 /// <param name="sfId"></param>
 /// <returns></returns>
 public int SaveGxySfRecord(EntityGxyRecord gxyRecord, EntityGxySf gxySf, EntityGxySfData sfData, out decimal sfId)
 {
     using (Biz205 biz = new Biz205())
     {
         return(biz.SaveGxySfRecord(gxyRecord, gxySf, sfData, out sfId));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 随访记录-保存
        /// </summary>
        /// <param name="sfData"></param>
        /// <param name="sfId"></param>
        /// <returns></returns>
        public int SaveGxySfRecord(EntityGxyRecord gxyRecord, EntityGxySf gxySf, EntityGxySfData sfData, out decimal sfId)
        {
            int affectRows = 0;

            sfId = 0;
            string    Sql = string.Empty;
            SqlHelper svc = null;
            decimal   id  = 0;

            try
            {
                svc = new SqlHelper(EnumBiz.onlineDB);
                List <DacParm> lstParm = new List <DacParm>();
                svc = new SqlHelper(EnumBiz.onlineDB);
                if (gxySf.sfId <= 0)
                {
                    id                 = svc.GetNextID("gxySf", "sfId");
                    gxySf.sfId         = id;
                    gxySf.sfStatus     = 1;
                    gxySf.recordDate   = DateTime.Now;
                    gxyRecord.sfId     = id;
                    gxyRecord.sfTimes += 1;
                    sfData.sfId        = id;
                    lstParm.Add(svc.GetInsertParm(gxySf));
                }
                else
                {
                    id = gxySf.sfId;
                    lstParm.Add(svc.GetUpdateParm(gxySf,
                                                  new List <string> {
                        EntityGxySf.Columns.sfMethod,
                        EntityGxySf.Columns.sfClass,
                        EntityGxySf.Columns.sfDate
                    },
                                                  new List <string> {
                        EntityGxySf.Columns.sfId
                    }));
                }
                //随访数据
                lstParm.Add(svc.GetDelParm(sfData, EntityGxySfData.Columns.sfId));
                lstParm.Add(svc.GetInsertParm(sfData));
                if (gxyRecord.sfTimes > 0)
                {
                    //高血压下次随访数据
                    string           sql   = @"update gxyRecord set manageLevel = ?, nextSfDate = ?, sfId = ?,sfTimes = ? where recId = ?";
                    IDataParameter[] param = svc.CreateParm(5);
                    param[0].Value = gxyRecord.manageLevel;
                    param[1].Value = gxyRecord.nextSfDate;
                    param[2].Value = gxyRecord.sfId;
                    param[3].Value = gxyRecord.sfTimes;
                    param[4].Value = gxyRecord.recId;
                    lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, sql, param));
                }
                else
                {
                    //高血压下次随访数据
                    string           sql   = @"update gxyRecord set manageLevel = ?, nextSfDate = ?, sfId = ? where recId = ?";
                    IDataParameter[] param = svc.CreateParm(4);
                    param[0].Value = gxyRecord.manageLevel;
                    param[1].Value = gxyRecord.nextSfDate;
                    param[2].Value = gxyRecord.sfId;
                    param[3].Value = gxyRecord.recId;
                    lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, sql, param));
                }

                if (lstParm.Count > 0)
                {
                    affectRows = svc.Commit(lstParm);
                }
                sfId = id;
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
                affectRows = -1;
            }
            finally
            {
                svc = null;
            }
            return(affectRows);
        }