public static JiwangshiDto GetOneJiwangshiDto(string table,string strwhere) { JiwangshiDto jiwangshiDto=new JiwangshiDto(); jiwangshiDto = JiwangshiDal.GetOneJiwangshi(table, strwhere); return jiwangshiDto; }
public static void AddJiwangshi(JiwangshiDto jiwangshiDto) { SqlParameter[] arParames = JiwangshiDal.getParameters(jiwangshiDto); SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString); try { SqlHelper.ExecuteNonQuery(myconn, CommandType.StoredProcedure, "CreateJiwangshi", arParames); } catch (SqlException ex) { throw ex; } finally { myconn.Close(); myconn.Dispose(); } }
public static List<JiwangshiDto> GetJiwangshiList(string table,string strwhere) { List<JiwangshiDto> jiwangshilist = new List<JiwangshiDto>(); 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) { JiwangshiDto jiwangshiDto = new JiwangshiDto(); jiwangshiDto = JiwangshiDal.getDataRowToJiwangshiDto(dr); jiwangshilist.Add(jiwangshiDto); } return jiwangshilist; } catch (SqlException ex) { throw ex; } finally { myconn.Close(); myconn.Dispose(); } }
public JsonResult AjaxJibingInsert() { // string content = Request.Form["healthXuexing"].ToString(); // string content2 = Request.Form["healthFeiyong"].ToString(); // string content3 = Request.Form["healthJiazuDady"].ToString(); int JiwangshiUserId = 0; string JiwangshiName = ""; string JiwangshiClass = "既往史"; DateTime JiwangshiTime = System.DateTime.Now; string JiwangshiJibingClass = ""; JiwangshiUserId = int.Parse(Request.Form["JiwangshiUserId"].ToString()); JiwangshiClass = Request.Form["JiwangshiClass"].ToString(); JiwangshiName = Request.Form["JiwangshiName"].ToString(); JiwangshiJibingClass = Request.Form["JiwangshiJibingClass"].ToString(); JiwangshiTime = DateTime.Parse(Request.Form["JiwangshiTime"].ToString()); JiwangshiDto jiwangshiDto = new JiwangshiDto(); jiwangshiDto.JiwangshiUserId = JiwangshiUserId; jiwangshiDto.JiwangshiClass = JiwangshiClass; jiwangshiDto.JiwangshiName = JiwangshiName; jiwangshiDto.JiwangshiJibingClass = JiwangshiJibingClass; jiwangshiDto.JiwangshiTime = JiwangshiTime; JiwangshiBll.AddJiwangshi(jiwangshiDto); var json = new JsonResult(); string strwhere = "JiwangshiUserId=" + JiwangshiUserId + " and JiwangshiClass='" + JiwangshiClass + "'"; List<JiwangshiDto> jiwangshiDtoList = JiwangshiBll.GetJiwangshiDtoList("CrmJiwangshi", strwhere); json.Data = jiwangshiDtoList; json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return json; //return RedirectToAction("HealthIndex"); }
public void AjaxJibingInsert12() { // string content = Request.Form["healthXuexing"].ToString(); // string content2 = Request.Form["healthFeiyong"].ToString(); // string content3 = Request.Form["healthJiazuDady"].ToString(); int JiwangshiUserId = 0; string JiwangshiName = ""; string JiwangshiClass = "既往史"; DateTime JiwangshiTime = System.DateTime.Now; string JiwangshiJibingClass = ""; JiwangshiUserId = int.Parse(Request.Form["JiwangshiUserId"].ToString()); JiwangshiClass = Request.Form["JiwangshiClass"].ToString(); JiwangshiName = Request.Form["JiwangshiName"].ToString(); JiwangshiJibingClass = Request.Form["JiwangshiJibingClass"].ToString(); JiwangshiTime = DateTime.Parse(Request.Form["JiwangshiTime"].ToString()); JiwangshiDto jiwangshiDto = new JiwangshiDto(); jiwangshiDto.JiwangshiUserId = JiwangshiUserId; jiwangshiDto.JiwangshiClass = JiwangshiClass; jiwangshiDto.JiwangshiName = JiwangshiName; jiwangshiDto.JiwangshiJibingClass = JiwangshiJibingClass; jiwangshiDto.JiwangshiTime = JiwangshiTime; JiwangshiBll.AddJiwangshi(jiwangshiDto); return; //return RedirectToAction("HealthIndex"); }
private static SqlParameter[] getParameters(JiwangshiDto jiwangshiDto) { SqlParameter[] arParames = new SqlParameter[6]; arParames[0] = new SqlParameter("@JiwangshiId", SqlDbType.Int); arParames[0].Value = jiwangshiDto.JiwangshiId; arParames[1] = new SqlParameter("@JiwangshiName", SqlDbType.VarChar, 50); arParames[1].Value = jiwangshiDto.JiwangshiName; arParames[2] = new SqlParameter("@JiwangshiJibingClass", SqlDbType.VarChar, 50); arParames[2].Value = jiwangshiDto.JiwangshiJibingClass; arParames[3] = new SqlParameter("@JiwangshiUserId", SqlDbType.Int); arParames[3].Value = jiwangshiDto.JiwangshiUserId; arParames[4] = new SqlParameter("@JiwangshiTime", SqlDbType.DateTime); arParames[4].Value = jiwangshiDto.JiwangshiTime; arParames[5] = new SqlParameter("@JiwangshiClass", SqlDbType.VarChar, 50); arParames[5].Value = jiwangshiDto.JiwangshiClass; return arParames; }
private static JiwangshiDto getDataRowToJiwangshiDto(DataRow dr) { JiwangshiDto jiwangshiDto = new JiwangshiDto(); jiwangshiDto.JiwangshiId = int.Parse(dr["JiwangshiId"].ToString()); jiwangshiDto.JiwangshiName = dr["JiwangshiName"].ToString(); jiwangshiDto.JiwangshiJibingClass = dr["JiwangshiJibingClass"].ToString(); jiwangshiDto.JiwangshiUserId = int.Parse(dr["JiwangshiUserId"].ToString()); jiwangshiDto.JiwangshiClass = dr["JiwangshiClass"].ToString(); jiwangshiDto.JiwangshiTime = DateTime.Parse(dr["JiwangshiTime"].ToString()); return jiwangshiDto; }
public static void UpdateJiwangshiDto(JiwangshiDto jiwangshiDto) { JiwangshiDal.UpdateJiwangshi(jiwangshiDto); }
public static void AddJiwangshi(JiwangshiDto jiwangshiDto) { JiwangshiDal.AddJiwangshi(jiwangshiDto); }