/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_BillListPay DataRowToModel(DataRow row) { IPSP.Model.T_BillListPay model = new IPSP.Model.T_BillListPay(); if (row != null) { if (row["n_BillListPayID"] != null && row["n_BillListPayID"].ToString() != "") { model.n_BillListPayID = int.Parse(row["n_BillListPayID"].ToString()); } if (row["n_BillPayID"] != null && row["n_BillPayID"].ToString() != "") { model.n_BillPayID = int.Parse(row["n_BillPayID"].ToString()); } if (row["n_BillListID"] != null && row["n_BillListID"].ToString() != "") { model.n_BillListID = int.Parse(row["n_BillListID"].ToString()); } if (row["n_PaymentAmount"] != null && row["n_PaymentAmount"].ToString() != "") { model.n_PaymentAmount = decimal.Parse(row["n_PaymentAmount"].ToString()); } if (row["dt_PaymentDate"] != null && row["dt_PaymentDate"].ToString() != "") { model.dt_PaymentDate = DateTime.Parse(row["dt_PaymentDate"].ToString()); } if (row["n_PaymentUserID"] != null && row["n_PaymentUserID"].ToString() != "") { model.n_PaymentUserID = int.Parse(row["n_PaymentUserID"].ToString()); } if (row["s_Editor"] != null) { model.s_Editor = row["s_Editor"].ToString(); } if (row["dt_EditTime"] != null && row["dt_EditTime"].ToString() != "") { model.dt_EditTime = DateTime.Parse(row["dt_EditTime"].ToString()); } if (row["n_OFee"] != null && row["n_OFee"].ToString() != "") { model.n_OFee = decimal.Parse(row["n_OFee"].ToString()); } if (row["n_AttrFee"] != null && row["n_AttrFee"].ToString() != "") { model.n_AttrFee = decimal.Parse(row["n_AttrFee"].ToString()); } if (row["n_OrginalAttrFee"] != null && row["n_OrginalAttrFee"].ToString() != "") { model.n_OrginalAttrFee = decimal.Parse(row["n_OrginalAttrFee"].ToString()); } if (row["n_OtherFee"] != null && row["n_OtherFee"].ToString() != "") { model.n_OtherFee = decimal.Parse(row["n_OtherFee"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.T_BillListPay model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_BillListPay set "); strSql.Append("n_PaymentAmount=@n_PaymentAmount,"); strSql.Append("dt_PaymentDate=@dt_PaymentDate,"); strSql.Append("n_PaymentUserID=@n_PaymentUserID,"); strSql.Append("s_Editor=@s_Editor,"); strSql.Append("dt_EditTime=@dt_EditTime,"); strSql.Append("n_OFee=@n_OFee,"); strSql.Append("n_AttrFee=@n_AttrFee,"); strSql.Append("n_OrginalAttrFee=@n_OrginalAttrFee,"); strSql.Append("n_OtherFee=@n_OtherFee"); strSql.Append(" where n_BillListPayID=@n_BillListPayID"); SqlParameter[] parameters = { new SqlParameter("@n_PaymentAmount", SqlDbType.Money, 8), new SqlParameter("@dt_PaymentDate", SqlDbType.DateTime), new SqlParameter("@n_PaymentUserID", SqlDbType.Int, 4), new SqlParameter("@s_Editor", SqlDbType.NVarChar, 20), new SqlParameter("@dt_EditTime", SqlDbType.DateTime), new SqlParameter("@n_OFee", SqlDbType.Money, 8), new SqlParameter("@n_AttrFee", SqlDbType.Money, 8), new SqlParameter("@n_OrginalAttrFee", SqlDbType.Money, 8), new SqlParameter("@n_OtherFee", SqlDbType.Money, 8), new SqlParameter("@n_BillListPayID", SqlDbType.Int, 4), new SqlParameter("@n_BillPayID", SqlDbType.Int, 4), new SqlParameter("@n_BillListID", SqlDbType.Int, 4) }; parameters[0].Value = model.n_PaymentAmount; parameters[1].Value = model.dt_PaymentDate; parameters[2].Value = model.n_PaymentUserID; parameters[3].Value = model.s_Editor; parameters[4].Value = model.dt_EditTime; parameters[5].Value = model.n_OFee; parameters[6].Value = model.n_AttrFee; parameters[7].Value = model.n_OrginalAttrFee; parameters[8].Value = model.n_OtherFee; parameters[9].Value = model.n_BillListPayID; parameters[10].Value = model.n_BillPayID; parameters[11].Value = model.n_BillListID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_BillListPay model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_BillListPay("); strSql.Append("n_BillPayID,n_BillListID,n_PaymentAmount,dt_PaymentDate,n_PaymentUserID,s_Editor,dt_EditTime,n_OFee,n_AttrFee,n_OrginalAttrFee,n_OtherFee)"); strSql.Append(" values ("); strSql.Append("@n_BillPayID,@n_BillListID,@n_PaymentAmount,@dt_PaymentDate,@n_PaymentUserID,@s_Editor,@dt_EditTime,@n_OFee,@n_AttrFee,@n_OrginalAttrFee,@n_OtherFee)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@n_BillPayID", SqlDbType.Int, 4), new SqlParameter("@n_BillListID", SqlDbType.Int, 4), new SqlParameter("@n_PaymentAmount", SqlDbType.Money, 8), new SqlParameter("@dt_PaymentDate", SqlDbType.DateTime), new SqlParameter("@n_PaymentUserID", SqlDbType.Int, 4), new SqlParameter("@s_Editor", SqlDbType.NVarChar, 20), new SqlParameter("@dt_EditTime", SqlDbType.DateTime), new SqlParameter("@n_OFee", SqlDbType.Money, 8), new SqlParameter("@n_AttrFee", SqlDbType.Money, 8), new SqlParameter("@n_OrginalAttrFee", SqlDbType.Money, 8), new SqlParameter("@n_OtherFee", SqlDbType.Money, 8) }; parameters[0].Value = model.n_BillPayID; parameters[1].Value = model.n_BillListID; parameters[2].Value = model.n_PaymentAmount; parameters[3].Value = model.dt_PaymentDate; parameters[4].Value = model.n_PaymentUserID; parameters[5].Value = model.s_Editor; parameters[6].Value = model.dt_EditTime; parameters[7].Value = model.n_OFee; parameters[8].Value = model.n_AttrFee; parameters[9].Value = model.n_OrginalAttrFee; parameters[10].Value = model.n_OtherFee; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_BillListPay GetModel(int n_BillListPayID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_BillListPayID,n_BillPayID,n_BillListID,n_PaymentAmount,dt_PaymentDate,n_PaymentUserID,s_Editor,dt_EditTime,n_OFee,n_AttrFee,n_OrginalAttrFee,n_OtherFee from T_BillListPay "); strSql.Append(" where n_BillListPayID=@n_BillListPayID"); SqlParameter[] parameters = { new SqlParameter("@n_BillListPayID", SqlDbType.Int, 4) }; parameters[0].Value = n_BillListPayID; IPSP.Model.T_BillListPay model = new IPSP.Model.T_BillListPay(); 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 bool Update(IPSP.Model.T_BillListPay model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_BillListPay model) { return(dal.Add(model)); }