/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.T_AbroadBillList model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_AbroadBillList set "); strSql.Append("s_FeeName=@s_FeeName,"); strSql.Append("n_Fee=@n_Fee,"); strSql.Append("n_AFee=@n_AFee,"); strSql.Append("n_TFee=@n_TFee,"); strSql.Append("s_PayMark=@s_PayMark"); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@s_FeeName", SqlDbType.NVarChar, 100), new SqlParameter("@n_Fee", SqlDbType.Money, 8), new SqlParameter("@n_AFee", SqlDbType.Money, 8), new SqlParameter("@n_TFee", SqlDbType.Money, 8), new SqlParameter("@s_PayMark", SqlDbType.NVarChar, 1), new SqlParameter("@n_ID", SqlDbType.Int, 4), new SqlParameter("@n_BillID", SqlDbType.Int, 4), new SqlParameter("@n_CaseID", SqlDbType.Int, 4) }; parameters[0].Value = model.s_FeeName; parameters[1].Value = model.n_Fee; parameters[2].Value = model.n_AFee; parameters[3].Value = model.n_TFee; parameters[4].Value = model.s_PayMark; parameters[5].Value = model.n_ID; parameters[6].Value = model.n_BillID; parameters[7].Value = model.n_CaseID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_AbroadBillList DataRowToModel(DataRow row) { IPSP.Model.T_AbroadBillList model = new IPSP.Model.T_AbroadBillList(); if (row != null) { if (row["n_ID"] != null && row["n_ID"].ToString() != "") { model.n_ID = int.Parse(row["n_ID"].ToString()); } if (row["n_BillID"] != null && row["n_BillID"].ToString() != "") { model.n_BillID = int.Parse(row["n_BillID"].ToString()); } if (row["n_CaseID"] != null && row["n_CaseID"].ToString() != "") { model.n_CaseID = int.Parse(row["n_CaseID"].ToString()); } if (row["s_FeeName"] != null) { model.s_FeeName = row["s_FeeName"].ToString(); } if (row["n_Fee"] != null && row["n_Fee"].ToString() != "") { model.n_Fee = decimal.Parse(row["n_Fee"].ToString()); } if (row["n_AFee"] != null && row["n_AFee"].ToString() != "") { model.n_AFee = decimal.Parse(row["n_AFee"].ToString()); } if (row["n_TFee"] != null && row["n_TFee"].ToString() != "") { model.n_TFee = decimal.Parse(row["n_TFee"].ToString()); } if (row["s_PayMark"] != null) { model.s_PayMark = row["s_PayMark"].ToString(); } } return(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_AbroadBillList model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_AbroadBillList("); strSql.Append("n_BillID,n_CaseID,s_FeeName,n_Fee,n_AFee,n_TFee,s_PayMark)"); strSql.Append(" values ("); strSql.Append("@n_BillID,@n_CaseID,@s_FeeName,@n_Fee,@n_AFee,@n_TFee,@s_PayMark)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@n_BillID", SqlDbType.Int, 4), new SqlParameter("@n_CaseID", SqlDbType.Int, 4), new SqlParameter("@s_FeeName", SqlDbType.NVarChar, 100), new SqlParameter("@n_Fee", SqlDbType.Money, 8), new SqlParameter("@n_AFee", SqlDbType.Money, 8), new SqlParameter("@n_TFee", SqlDbType.Money, 8), new SqlParameter("@s_PayMark", SqlDbType.NVarChar, 1) }; parameters[0].Value = model.n_BillID; parameters[1].Value = model.n_CaseID; parameters[2].Value = model.s_FeeName; parameters[3].Value = model.n_Fee; parameters[4].Value = model.n_AFee; parameters[5].Value = model.n_TFee; parameters[6].Value = model.s_PayMark; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_AbroadBillList GetModel(int n_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_ID,n_BillID,n_CaseID,s_FeeName,n_Fee,n_AFee,n_TFee,s_PayMark from T_AbroadBillList "); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = n_ID; IPSP.Model.T_AbroadBillList model = new IPSP.Model.T_AbroadBillList(); 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_AbroadBillList model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_AbroadBillList model) { return(dal.Add(model)); }