public ActionResult Borrloans() { string json = ""; B_td_Myborrow b = new B_td_Myborrow(); M_td_Myborrow p = new M_td_Myborrow(); p.Username = DNTRequest.GetString("Username"); p.userTel = DNTRequest.GetString("userTel"); p.BorrPurposes = DNTRequest.GetString("BorrPurposes"); p.CompName = DNTRequest.GetString("CompName"); p.Industry = DNTRequest.GetString("Industry"); p.RegCapital = DNTRequest.GetString("RegCapital"); p.TimeLimit = int.Parse(DNTRequest.GetString("TimeLimit")); // p.Mortgage = int.Parse(DNTRequest.GetString("pMortgage")); p.FoundingTime = DateTime.Parse(DNTRequest.GetString("FoundingTime")); p.BorrAMT = DNTRequest.GetString("BorrAMT"); p.Area = DNTRequest.GetString("pArea"); p.BorrType = 1; if (b.Add(p) > 0) { json = @" {""rs"" : ""y"", ""url"" : ""/""}"; } else { json = @" {""rs"" : ""n"", ""error"" : ""操作失败""}"; } return(Content(json, "text/json")); }
public ActionResult PostPersonLoans() { string json = ""; B_td_Myborrow b = new B_td_Myborrow(); M_td_Myborrow p = new M_td_Myborrow(); p.Username = DNTRequest.GetString("pUsername"); p.userTel = DNTRequest.GetString("puserTel"); p.BorrAMT = DNTRequest.GetString("pBorrAMT"); p.Area = DNTRequest.GetString("pArea"); p.BorrPurposes = DNTRequest.GetString("pBorrPurposes"); p.TimeLimit = int.Parse(DNTRequest.GetString("pTimeLimit")); p.Mortgage = int.Parse(DNTRequest.GetString("pMortgage")); p.BorrType = 0; p.FoundingTime = DateTime.Now; if (b.Add(p) > 0) { json = @" {""rs"" : ""y"", ""url"" : ""/""}"; } else { json = @" {""rs"" : ""n"", ""error"" : ""操作失败""}"; } return(Content(json, "text/json")); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(M_td_Myborrow model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into hx_td_Myborrow("); strSql.Append("Username,userTel,BorrAMT,BorrPurposes,Area,CompName,Industry,RegCapital,TimeLimit,FoundingTime,Mortgage,EntryTime,BorrType,BorrState)"); strSql.Append(" values ("); strSql.Append("@Username,@userTel,@BorrAMT,@BorrPurposes,@Area,@CompName,@Industry,@RegCapital,@TimeLimit,@FoundingTime,@Mortgage,@EntryTime,@BorrType,@BorrState)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Username", SqlDbType.VarChar, 255), new SqlParameter("@userTel", SqlDbType.VarChar, 255), new SqlParameter("@BorrAMT", SqlDbType.VarChar, 255), new SqlParameter("@BorrPurposes", SqlDbType.VarChar, 255), new SqlParameter("@Area", SqlDbType.VarChar, 255), new SqlParameter("@CompName", SqlDbType.VarChar, 255), new SqlParameter("@Industry", SqlDbType.VarChar, 255), new SqlParameter("@RegCapital", SqlDbType.VarChar, 255), new SqlParameter("@TimeLimit", SqlDbType.Int, 4), new SqlParameter("@FoundingTime", SqlDbType.DateTime), new SqlParameter("@Mortgage", SqlDbType.Int, 4), new SqlParameter("@EntryTime", SqlDbType.DateTime), new SqlParameter("@BorrType", SqlDbType.Int, 4), new SqlParameter("@BorrState", SqlDbType.Int, 4) }; parameters[0].Value = model.Username; parameters[1].Value = model.userTel; parameters[2].Value = model.BorrAMT; parameters[3].Value = model.BorrPurposes; parameters[4].Value = model.Area; parameters[5].Value = model.CompName; parameters[6].Value = model.Industry; parameters[7].Value = model.RegCapital; parameters[8].Value = model.TimeLimit; parameters[9].Value = model.FoundingTime; parameters[10].Value = model.Mortgage; parameters[11].Value = model.EntryTime; parameters[12].Value = model.BorrType; parameters[13].Value = model.BorrState; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public M_td_Myborrow GetModel(int Myborrowid) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Myborrowid,Username,userTel,BorrAMT,BorrPurposes,Area,CompName,Industry,RegCapital,TimeLimit,FoundingTime,Mortgage,EntryTime,BorrType,BorrState from hx_td_Myborrow "); strSql.Append(" where Myborrowid=@Myborrowid"); SqlParameter[] parameters = { new SqlParameter("@Myborrowid", SqlDbType.Int, 4) }; parameters[0].Value = Myborrowid; M_td_Myborrow model = new M_td_Myborrow(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public M_td_Myborrow DataRowToModel(DataRow row) { M_td_Myborrow model = new M_td_Myborrow(); if (row != null) { if (row["Myborrowid"] != null && row["Myborrowid"].ToString() != "") { model.Myborrowid = int.Parse(row["Myborrowid"].ToString()); } if (row["Username"] != null) { model.Username = row["Username"].ToString(); } if (row["userTel"] != null) { model.userTel = row["userTel"].ToString(); } if (row["BorrAMT"] != null) { model.BorrAMT = row["BorrAMT"].ToString(); } if (row["BorrPurposes"] != null) { model.BorrPurposes = row["BorrPurposes"].ToString(); } if (row["Area"] != null) { model.Area = row["Area"].ToString(); } if (row["CompName"] != null) { model.CompName = row["CompName"].ToString(); } if (row["Industry"] != null) { model.Industry = row["Industry"].ToString(); } if (row["RegCapital"] != null) { model.RegCapital = row["RegCapital"].ToString(); } if (row["TimeLimit"] != null && row["TimeLimit"].ToString() != "") { model.TimeLimit = int.Parse(row["TimeLimit"].ToString()); } if (row["FoundingTime"] != null && row["FoundingTime"].ToString() != "") { model.FoundingTime = DateTime.Parse(row["FoundingTime"].ToString()); } if (row["Mortgage"] != null && row["Mortgage"].ToString() != "") { model.Mortgage = int.Parse(row["Mortgage"].ToString()); } if (row["EntryTime"] != null && row["EntryTime"].ToString() != "") { model.EntryTime = DateTime.Parse(row["EntryTime"].ToString()); } if (row["BorrType"] != null && row["BorrType"].ToString() != "") { model.BorrType = int.Parse(row["BorrType"].ToString()); } if (row["BorrState"] != null && row["BorrState"].ToString() != "") { model.BorrState = int.Parse(row["BorrState"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(M_td_Myborrow model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update hx_td_Myborrow set "); strSql.Append("Username=@Username,"); strSql.Append("userTel=@userTel,"); strSql.Append("BorrAMT=@BorrAMT,"); strSql.Append("BorrPurposes=@BorrPurposes,"); strSql.Append("Area=@Area,"); strSql.Append("CompName=@CompName,"); strSql.Append("Industry=@Industry,"); strSql.Append("RegCapital=@RegCapital,"); strSql.Append("TimeLimit=@TimeLimit,"); strSql.Append("FoundingTime=@FoundingTime,"); strSql.Append("Mortgage=@Mortgage,"); strSql.Append("EntryTime=@EntryTime,"); strSql.Append("BorrType=@BorrType,"); strSql.Append("BorrState=@BorrState"); strSql.Append(" where Myborrowid=@Myborrowid"); SqlParameter[] parameters = { new SqlParameter("@Username", SqlDbType.VarChar, 255), new SqlParameter("@userTel", SqlDbType.VarChar, 255), new SqlParameter("@BorrAMT", SqlDbType.VarChar, 255), new SqlParameter("@BorrPurposes", SqlDbType.VarChar, 255), new SqlParameter("@Area", SqlDbType.VarChar, 255), new SqlParameter("@CompName", SqlDbType.VarChar, 255), new SqlParameter("@Industry", SqlDbType.VarChar, 255), new SqlParameter("@RegCapital", SqlDbType.VarChar, 255), new SqlParameter("@TimeLimit", SqlDbType.Int, 4), new SqlParameter("@FoundingTime", SqlDbType.DateTime), new SqlParameter("@Mortgage", SqlDbType.Int, 4), new SqlParameter("@EntryTime", SqlDbType.DateTime), new SqlParameter("@BorrType", SqlDbType.Int, 4), new SqlParameter("@BorrState", SqlDbType.Int, 4), new SqlParameter("@Myborrowid", SqlDbType.Int, 4) }; parameters[0].Value = model.Username; parameters[1].Value = model.userTel; parameters[2].Value = model.BorrAMT; parameters[3].Value = model.BorrPurposes; parameters[4].Value = model.Area; parameters[5].Value = model.CompName; parameters[6].Value = model.Industry; parameters[7].Value = model.RegCapital; parameters[8].Value = model.TimeLimit; parameters[9].Value = model.FoundingTime; parameters[10].Value = model.Mortgage; parameters[11].Value = model.EntryTime; parameters[12].Value = model.BorrType; parameters[13].Value = model.BorrState; parameters[14].Value = model.Myborrowid; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(M_td_Myborrow model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(M_td_Myborrow model) { return(dal.Add(model)); }