Exemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.T_BillPay model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_BillPay(");
            strSql.Append("n_CMoneyID,n_ClientID,n_BillID,n_PayCurrencyID)");
            strSql.Append(" values (");
            strSql.Append("@n_CMoneyID,@n_ClientID,@n_BillID,@n_PayCurrencyID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CMoneyID",      SqlDbType.Int, 4),
                new SqlParameter("@n_ClientID",      SqlDbType.Int, 4),
                new SqlParameter("@n_BillID",        SqlDbType.Int, 4),
                new SqlParameter("@n_PayCurrencyID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_CMoneyID;
            parameters[1].Value = model.n_ClientID;
            parameters[2].Value = model.n_BillID;
            parameters[3].Value = model.n_PayCurrencyID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.T_BillPay DataRowToModel(DataRow row)
 {
     IPSP.Model.T_BillPay model = new IPSP.Model.T_BillPay();
     if (row != null)
     {
         if (row["n_BillPayID"] != null && row["n_BillPayID"].ToString() != "")
         {
             model.n_BillPayID = int.Parse(row["n_BillPayID"].ToString());
         }
         if (row["n_CMoneyID"] != null && row["n_CMoneyID"].ToString() != "")
         {
             model.n_CMoneyID = int.Parse(row["n_CMoneyID"].ToString());
         }
         if (row["n_ClientID"] != null && row["n_ClientID"].ToString() != "")
         {
             model.n_ClientID = int.Parse(row["n_ClientID"].ToString());
         }
         if (row["n_BillID"] != null && row["n_BillID"].ToString() != "")
         {
             model.n_BillID = int.Parse(row["n_BillID"].ToString());
         }
         if (row["n_PayCurrencyID"] != null && row["n_PayCurrencyID"].ToString() != "")
         {
             model.n_PayCurrencyID = int.Parse(row["n_PayCurrencyID"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.T_BillPay model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_BillPay set ");
            strSql.Append("n_PayCurrencyID=@n_PayCurrencyID");
            strSql.Append(" where n_BillPayID=@n_BillPayID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_PayCurrencyID", SqlDbType.Int, 4),
                new SqlParameter("@n_BillPayID",     SqlDbType.Int, 4),
                new SqlParameter("@n_CMoneyID",      SqlDbType.Int, 4),
                new SqlParameter("@n_ClientID",      SqlDbType.Int, 4),
                new SqlParameter("@n_BillID",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_PayCurrencyID;
            parameters[1].Value = model.n_BillPayID;
            parameters[2].Value = model.n_CMoneyID;
            parameters[3].Value = model.n_ClientID;
            parameters[4].Value = model.n_BillID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.T_BillPay GetModel(int n_BillPayID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_BillPayID,n_CMoneyID,n_ClientID,n_BillID,n_PayCurrencyID from T_BillPay ");
            strSql.Append(" where n_BillPayID=@n_BillPayID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_BillPayID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_BillPayID;

            IPSP.Model.T_BillPay model = new IPSP.Model.T_BillPay();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.T_BillPay model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.T_BillPay model)
 {
     return(dal.Add(model));
 }