Beispiel #1
0
 /// <summary>
 /// 批量新增外包人员的体检信息
 /// </summary>
 /// <param name="keyValue"></param>
 /// <param name="entity"></param>
 /// <returns></returns>
 public void SummitPhyInfo(string keyValue, PhyInfoEntity entity)
 {
     try
     {
         service.SummitPhyInfo(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
        /// <summary>
        /// 批量新增外包人员的体检信息
        /// </summary>
        /// <param name="keyValue"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        public void SummitPhyInfo(string keyValue, PhyInfoEntity entity)
        {
            string[] ids = entity.ids.Split(',');

            string strIds = string.Join(",", ids).Replace(",", "','");

            string strUpdate = string.Empty;

            if (!string.IsNullOrWhiteSpace(entity.PhysicalUnit))
            {
                strUpdate += string.Format(" PhysicalUnit='{0}',", entity.PhysicalUnit);
            }
            if (!string.IsNullOrWhiteSpace(entity.IsComtraindication))
            {
                strUpdate += string.Format(" IsComtraindication='{0}',", entity.IsComtraindication);
            }
            if (entity.PhysicalTime != null)
            {
                strUpdate += string.Format(" PhysicalTime=to_date('{0}','yyyy-MM-dd'),", entity.PhysicalTime.Value.ToString("yyyy-MM-dd"));
            }
            if (!string.IsNullOrWhiteSpace(entity.ComtraindicationName))
            {
                strUpdate += string.Format(" ComtraindicationName='{0}',", entity.ComtraindicationName);
            }
            var files = new FileInfoService().GetFiles(keyValue);

            if (files.Rows.Count > 0)
            {
                for (int i = 0; i < ids.Length; i++)
                {
                    var key = ids[i] + "01";
                    foreach (DataRow item in files.Rows)
                    {
                        FileInfoEntity itemFile = new FileInfoEntity();
                        itemFile.FileName = item["FileName"].ToString();
                        itemFile.FilePath = item["filepath"].ToString();
                        itemFile.FileSize = item["filesize"].ToString();
                        itemFile.RecId    = key;
                        new FileInfoService().SaveForm("", itemFile);
                    }
                }
            }
            if (!string.IsNullOrWhiteSpace(strUpdate))
            {
                strUpdate = strUpdate.Substring(0, strUpdate.Length - 1);
                var sql = string.Format("update epg_aptitudeinvestigatepeople set {0} where id in('{1}')", strUpdate, strIds);
                this.BaseRepository().ExecuteBySql(sql);
            }
        }