public static HealthDto GetOneHealthDto(string table,string strwhere) { HealthDto healthDto=new HealthDto(); healthDto = HealthDal.GetOneHealth(table, strwhere); return healthDto; }
public static void AddHealth(HealthDto healthDto) { SqlParameter[] arParames = HealthDal.getParameters(healthDto); SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString); try { SqlHelper.ExecuteNonQuery(myconn, CommandType.StoredProcedure, "CreateHealth", arParames); } catch (SqlException ex) { throw ex; } finally { myconn.Close(); myconn.Dispose(); } }
public static List<HealthDto> GetHealthList(string table,string strwhere) { List<HealthDto> userlist = new List<HealthDto>(); SqlParameter[] arParames = new SqlParameter[2]; arParames[0] = new SqlParameter("@table ", SqlDbType.VarChar, 200); arParames[0].Value = table; arParames[1] = new SqlParameter("@Where ", SqlDbType.VarChar, 8000); arParames[1].Value = strwhere; SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString); try { DataTable dt = null; DataSet ds = SqlHelper.ExecuteDataset(myconn, CommandType.StoredProcedure, "getModelByWhere", arParames); dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { HealthDto HealthDto = new HealthDto(); HealthDto = HealthDal.getDataRowToHealthDto(dr); userlist.Add(HealthDto); } return userlist; } catch (SqlException ex) { throw ex; } finally { myconn.Close(); myconn.Dispose(); } }
private static SqlParameter[] getParameters(HealthDto healthDto) { SqlParameter[] arParames = new SqlParameter[22]; arParames[0] = new SqlParameter("@HealthId", SqlDbType.Int); arParames[0].Value = healthDto.HealthId; arParames[1] = new SqlParameter("@HealthUserId ", SqlDbType.Int); arParames[1].Value = healthDto.HealthUserId; arParames[2] = new SqlParameter("@HealthXuexing ", SqlDbType.VarChar, 50); arParames[2].Value = healthDto.HealthXuexing; arParames[3] = new SqlParameter("@HealthRH ", SqlDbType.VarChar, 50); arParames[3].Value = healthDto.HealthRH; arParames[4] = new SqlParameter("@HealthFeiyong ", SqlDbType.VarChar, 500); arParames[4].Value = healthDto.HealthFeiyong; arParames[5] = new SqlParameter("@HealthGuomin ", SqlDbType.VarChar, 50); arParames[5].Value = healthDto.HealthGuomin; arParames[6] = new SqlParameter("@HealthBaolou ", SqlDbType.VarChar, 50); arParames[6].Value = healthDto.HealthBaolou; arParames[7] = new SqlParameter("@HealthJibing ", SqlDbType.VarChar, 50); arParames[7].Value = healthDto.HealthJibing; arParames[8] = new SqlParameter("@HealthShoushu ", SqlDbType.VarChar, 50); arParames[8].Value = healthDto.HealthShoushu; arParames[9] = new SqlParameter("@HealthWaishang ", SqlDbType.VarChar, 50); arParames[9].Value = healthDto.HealthWaishang; arParames[10] = new SqlParameter("@HealthShuxue ", SqlDbType.VarChar, 50); arParames[10].Value = healthDto.HealthShuxue; arParames[11] = new SqlParameter("@HealthJiazuDady ", SqlDbType.VarChar, 50); arParames[11].Value = healthDto.HealthJiazuDady; arParames[12] = new SqlParameter("@HealthJiazuMama ", SqlDbType.VarChar, 50); arParames[12].Value = healthDto.HealthJiazuMama; arParames[13] = new SqlParameter("@HealthJiazuXiongdi ", SqlDbType.VarChar, 50); arParames[13].Value = healthDto.HealthJiazuXiongdi; arParames[14] = new SqlParameter("@HealthJiazuZinv ", SqlDbType.VarChar, 50); arParames[14].Value = healthDto.HealthJiazuZinv; arParames[15] = new SqlParameter("@HealthYichuan ", SqlDbType.VarChar, 50); arParames[15].Value = healthDto.HealthYichuan; arParames[16] = new SqlParameter("@HealthCanji ", SqlDbType.VarChar, 50); arParames[16].Value = healthDto.HealthCanji; arParames[17] = new SqlParameter("@HealthChufang ", SqlDbType.VarChar, 50); arParames[17].Value = healthDto.HealthChufang; arParames[18] = new SqlParameter("@HealthRanliao ", SqlDbType.VarChar, 50); arParames[18].Value = healthDto.HealthRanliao; arParames[19] = new SqlParameter("@HealthYinshui ", SqlDbType.VarChar, 50); arParames[19].Value = healthDto.HealthYinshui; arParames[20] = new SqlParameter("@HealthCesuo ", SqlDbType.VarChar, 50); arParames[20].Value = healthDto.HealthCesuo; arParames[21] = new SqlParameter("@HealthQichulan ", SqlDbType.VarChar, 500); arParames[21].Value = healthDto.HealthQichulan; return arParames; }
private static HealthDto getDataRowToHealthDto(DataRow dr) { HealthDto healthDto = new HealthDto(); healthDto.HealthId = int.Parse(dr["HealthId"].ToString()); healthDto.HealthUserId = int.Parse(dr["HealthUserId"].ToString()); healthDto.HealthXuexing = dr["HealthXuexing"].ToString(); healthDto.HealthRH = dr["HealthRH"].ToString(); healthDto.HealthFeiyong = dr["HealthFeiyong"].ToString(); healthDto.HealthGuomin = dr["HealthGuomin"].ToString(); healthDto.HealthBaolou = dr["HealthBaolou"].ToString(); healthDto.HealthJibing = dr["HealthJibing"].ToString(); healthDto.HealthShoushu = dr["HealthShoushu"].ToString(); healthDto.HealthWaishang = dr["HealthWaishang"].ToString(); healthDto.HealthShuxue = dr["HealthShuxue"].ToString(); healthDto.HealthJiazuDady = dr["HealthJiazuDady"].ToString(); healthDto.HealthJiazuMama = dr["HealthJiazuMama"].ToString(); healthDto.HealthJiazuXiongdi = dr["HealthJiazuXiongdi"].ToString(); healthDto.HealthJiazuZinv = dr["HealthJiazuZinv"].ToString(); healthDto.HealthYichuan = dr["HealthYichuan"].ToString(); healthDto.HealthCanji = dr["HealthCanji"].ToString(); healthDto.HealthChufang = dr["HealthChufang"].ToString(); healthDto.HealthRanliao = dr["HealthRanliao"].ToString(); healthDto.HealthYinshui = dr["HealthYinshui"].ToString(); healthDto.HealthCesuo = dr["HealthCesuo"].ToString(); healthDto.HealthQichulan = dr["HealthQichulan"].ToString(); return healthDto; }
public ActionResult HealthInsert(HealthAddViewModel model) { HealthDto healthDto = new HealthDto(); healthDto.HealthUserId = int.Parse(Request.Form["HealthUserId"].ToString()); healthDto.HealthXuexing = Request.Form["HealthXuexing"].ToString(); healthDto.HealthRH = Request.Form["HealthRH"].ToString(); healthDto.HealthFeiyong = Request.Form["HealthFeiyong"].ToString(); if (String.IsNullOrEmpty(Request.Form["HealthGuomin"])) { healthDto.HealthGuomin = "无"; } else { healthDto.HealthGuomin = Request.Form["HealthGuomin"].ToString(); } if (String.IsNullOrEmpty(Request.Form["HealthBaolou"])) { healthDto.HealthBaolou = "无"; } else { healthDto.HealthBaolou = Request.Form["HealthBaolou"].ToString(); } if (String.IsNullOrEmpty(Request.Form["HealthJibing"])) { healthDto.HealthJibing = "无"; } else { healthDto.HealthJibing = Request.Form["HealthJibing"].ToString(); } healthDto.HealthShoushu = Request.Form["HealthShoushu"].ToString(); healthDto.HealthWaishang = Request.Form["HealthWaishang"].ToString(); healthDto.HealthShuxue = Request.Form["HealthShuxue"].ToString(); if (String.IsNullOrEmpty(Request.Form["HealthJiazuDady"])) { healthDto.HealthJiazuDady = "无"; } else { healthDto.HealthJiazuDady = Request.Form["HealthJiazuDady"].ToString(); } if (String.IsNullOrEmpty(Request.Form["HealthJiazuMama"])) { healthDto.HealthJiazuMama = "无"; } else { healthDto.HealthJiazuMama = Request.Form["HealthJiazuMama"].ToString(); } if (String.IsNullOrEmpty(Request.Form["HealthJiazuXiongdi"])) { healthDto.HealthJiazuXiongdi = "无"; } else { healthDto.HealthJiazuXiongdi = Request.Form["HealthJiazuXiongdi"].ToString(); } if (String.IsNullOrEmpty(Request.Form["HealthJiazuZinv"])) { healthDto.HealthJiazuZinv = "无"; } else { healthDto.HealthJiazuZinv = Request.Form["HealthJiazuZinv"].ToString(); } healthDto.HealthYichuan = Request.Form["HealthYichuan"].ToString(); if (String.IsNullOrEmpty(Request.Form["HealthCanji"])) { healthDto.HealthCanji = "无"; } else { healthDto.HealthCanji = Request.Form["HealthCanji"].ToString(); } healthDto.HealthChufang = Request.Form["HealthChufang"].ToString(); healthDto.HealthRanliao = Request.Form["HealthRanliao"].ToString(); healthDto.HealthYinshui = Request.Form["HealthYinshui"].ToString(); healthDto.HealthCesuo = Request.Form["HealthCesuo"].ToString(); healthDto.HealthQichulan = Request.Form["HealthQichulan"].ToString(); HealthBll.AddHealth(healthDto); // return RedirectTo("/Health/HealthIndex", "客户身体信息添加成功了"); //return RedirectToAction("HealthIndex"); return RedirectToAction("UserIndex", "User", new { groupId = 0, userClass = 0, doctorId = System.Web.HttpContext.Current.Request.Cookies["DoctorId"].Value }); }
public static void UpdateHealthDto(HealthDto healthDto) { HealthDal.UpdateHealth(healthDto); }
public static void AddHealth(HealthDto healthDto) { HealthDal.AddHealth(healthDto); }