Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.T_Payment DataRowToModel(DataRow row)
 {
     IPSP.Model.T_Payment model = new IPSP.Model.T_Payment();
     if (row != null)
     {
         if (row["n_PaymentID"] != null && row["n_PaymentID"].ToString() != "")
         {
             model.n_PaymentID = int.Parse(row["n_PaymentID"].ToString());
         }
         if (row["n_BillListID"] != null && row["n_BillListID"].ToString() != "")
         {
             model.n_BillListID = int.Parse(row["n_BillListID"].ToString());
         }
         if (row["n_BillID"] != null && row["n_BillID"].ToString() != "")
         {
             model.n_BillID = int.Parse(row["n_BillID"].ToString());
         }
         if (row["n_ReceiveID"] != null && row["n_ReceiveID"].ToString() != "")
         {
             model.n_ReceiveID = int.Parse(row["n_ReceiveID"].ToString());
         }
         if (row["n_HedgeID"] != null && row["n_HedgeID"].ToString() != "")
         {
             model.n_HedgeID = int.Parse(row["n_HedgeID"].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());
         }
     }
     return(model);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.T_Payment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Payment set ");
            strSql.Append("n_BillListID=@n_BillListID,");
            strSql.Append("n_ReceiveID=@n_ReceiveID,");
            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(" where n_PaymentID=@n_PaymentID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_BillListID",    SqlDbType.Int,        4),
                new SqlParameter("@n_ReceiveID",     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_PaymentID",     SqlDbType.Int,        4),
                new SqlParameter("@n_BillID",        SqlDbType.Int,        4),
                new SqlParameter("@n_HedgeID",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_BillListID;
            parameters[1].Value = model.n_ReceiveID;
            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_PaymentID;
            parameters[8].Value = model.n_BillID;
            parameters[9].Value = model.n_HedgeID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.T_Payment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_Payment(");
            strSql.Append("n_BillListID,n_BillID,n_ReceiveID,n_HedgeID,n_PaymentAmount,dt_PaymentDate,n_PaymentUserID,s_Editor,dt_EditTime)");
            strSql.Append(" values (");
            strSql.Append("@n_BillListID,@n_BillID,@n_ReceiveID,@n_HedgeID,@n_PaymentAmount,@dt_PaymentDate,@n_PaymentUserID,@s_Editor,@dt_EditTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_BillListID",    SqlDbType.Int,        4),
                new SqlParameter("@n_BillID",        SqlDbType.Int,        4),
                new SqlParameter("@n_ReceiveID",     SqlDbType.Int,        4),
                new SqlParameter("@n_HedgeID",       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)
            };
            parameters[0].Value = model.n_BillListID;
            parameters[1].Value = model.n_BillID;
            parameters[2].Value = model.n_ReceiveID;
            parameters[3].Value = model.n_HedgeID;
            parameters[4].Value = model.n_PaymentAmount;
            parameters[5].Value = model.dt_PaymentDate;
            parameters[6].Value = model.n_PaymentUserID;
            parameters[7].Value = model.s_Editor;
            parameters[8].Value = model.dt_EditTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.T_Payment GetModel(int n_PaymentID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_PaymentID,n_BillListID,n_BillID,n_ReceiveID,n_HedgeID,n_PaymentAmount,dt_PaymentDate,n_PaymentUserID,s_Editor,dt_EditTime from T_Payment ");
            strSql.Append(" where n_PaymentID=@n_PaymentID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_PaymentID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_PaymentID;

            IPSP.Model.T_Payment model = new IPSP.Model.T_Payment();
            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_Payment model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.T_Payment model)
 {
     return(dal.Add(model));
 }