Esempio n. 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.jxc_Payment GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,Name,Directions,AuditDate,AuditGuy,remark,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,n1,n2,n3,status,create_person,create_date,update_person,update_date from jxc_Payment ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            Maticsoft.Model.jxc_Payment model = new Maticsoft.Model.jxc_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);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.jxc_Payment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jxc_Payment(");
            strSql.Append("Name,Directions,AuditDate,AuditGuy,remark,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,n1,n2,n3,status,create_person,create_date,update_person,update_date)");
            strSql.Append(" values (");
            strSql.Append("@Name,@Directions,@AuditDate,@AuditGuy,@remark,@v1,@v2,@v3,@v4,@v5,@v6,@v7,@v8,@v9,@v10,@n1,@n2,@n3,@status,@create_person,@create_date,@update_person,@update_date)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",          SqlDbType.NVarChar,   50),
                new SqlParameter("@Directions",    SqlDbType.NVarChar,  200),
                new SqlParameter("@AuditDate",     SqlDbType.DateTime),
                new SqlParameter("@AuditGuy",      SqlDbType.VarChar,    50),
                new SqlParameter("@remark",        SqlDbType.Text),
                new SqlParameter("@v1",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v2",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v3",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v4",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v5",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v6",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v7",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v8",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v9",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v10",           SqlDbType.NVarChar,  255),
                new SqlParameter("@n1",            SqlDbType.Int,         4),
                new SqlParameter("@n2",            SqlDbType.Int,         4),
                new SqlParameter("@n3",            SqlDbType.Int,         4),
                new SqlParameter("@status",        SqlDbType.Int,         4),
                new SqlParameter("@create_person", SqlDbType.NVarChar,   50),
                new SqlParameter("@create_date",   SqlDbType.DateTime),
                new SqlParameter("@update_person", SqlDbType.NVarChar,   50),
                new SqlParameter("@update_date",   SqlDbType.DateTime)
            };
            parameters[0].Value  = model.Name;
            parameters[1].Value  = model.Directions;
            parameters[2].Value  = model.AuditDate;
            parameters[3].Value  = model.AuditGuy;
            parameters[4].Value  = model.remark;
            parameters[5].Value  = model.v1;
            parameters[6].Value  = model.v2;
            parameters[7].Value  = model.v3;
            parameters[8].Value  = model.v4;
            parameters[9].Value  = model.v5;
            parameters[10].Value = model.v6;
            parameters[11].Value = model.v7;
            parameters[12].Value = model.v8;
            parameters[13].Value = model.v9;
            parameters[14].Value = model.v10;
            parameters[15].Value = model.n1;
            parameters[16].Value = model.n2;
            parameters[17].Value = model.n3;
            parameters[18].Value = model.status;
            parameters[19].Value = model.create_person;
            parameters[20].Value = model.create_date;
            parameters[21].Value = model.update_person;
            parameters[22].Value = model.update_date;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.jxc_Payment DataRowToModel(DataRow row)
 {
     Maticsoft.Model.jxc_Payment model = new Maticsoft.Model.jxc_Payment();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].ToString();
         }
         if (row["Directions"] != null)
         {
             model.Directions = row["Directions"].ToString();
         }
         if (row["AuditDate"] != null && row["AuditDate"].ToString() != "")
         {
             model.AuditDate = DateTime.Parse(row["AuditDate"].ToString());
         }
         if (row["AuditGuy"] != null)
         {
             model.AuditGuy = row["AuditGuy"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["v1"] != null)
         {
             model.v1 = row["v1"].ToString();
         }
         if (row["v2"] != null)
         {
             model.v2 = row["v2"].ToString();
         }
         if (row["v3"] != null)
         {
             model.v3 = row["v3"].ToString();
         }
         if (row["v4"] != null)
         {
             model.v4 = row["v4"].ToString();
         }
         if (row["v5"] != null)
         {
             model.v5 = row["v5"].ToString();
         }
         if (row["v6"] != null)
         {
             model.v6 = row["v6"].ToString();
         }
         if (row["v7"] != null)
         {
             model.v7 = row["v7"].ToString();
         }
         if (row["v8"] != null)
         {
             model.v8 = row["v8"].ToString();
         }
         if (row["v9"] != null)
         {
             model.v9 = row["v9"].ToString();
         }
         if (row["v10"] != null)
         {
             model.v10 = row["v10"].ToString();
         }
         if (row["n1"] != null && row["n1"].ToString() != "")
         {
             model.n1 = int.Parse(row["n1"].ToString());
         }
         if (row["n2"] != null && row["n2"].ToString() != "")
         {
             model.n2 = int.Parse(row["n2"].ToString());
         }
         if (row["n3"] != null && row["n3"].ToString() != "")
         {
             model.n3 = int.Parse(row["n3"].ToString());
         }
         if (row["status"] != null && row["status"].ToString() != "")
         {
             model.status = int.Parse(row["status"].ToString());
         }
         if (row["create_person"] != null)
         {
             model.create_person = row["create_person"].ToString();
         }
         if (row["create_date"] != null && row["create_date"].ToString() != "")
         {
             model.create_date = DateTime.Parse(row["create_date"].ToString());
         }
         if (row["update_person"] != null)
         {
             model.update_person = row["update_person"].ToString();
         }
         if (row["update_date"] != null && row["update_date"].ToString() != "")
         {
             model.update_date = DateTime.Parse(row["update_date"].ToString());
         }
     }
     return(model);
 }
Esempio n. 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.jxc_Payment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jxc_Payment set ");
            strSql.Append("Name=@Name,");
            strSql.Append("Directions=@Directions,");
            strSql.Append("AuditDate=@AuditDate,");
            strSql.Append("AuditGuy=@AuditGuy,");
            strSql.Append("remark=@remark,");
            strSql.Append("v1=@v1,");
            strSql.Append("v2=@v2,");
            strSql.Append("v3=@v3,");
            strSql.Append("v4=@v4,");
            strSql.Append("v5=@v5,");
            strSql.Append("v6=@v6,");
            strSql.Append("v7=@v7,");
            strSql.Append("v8=@v8,");
            strSql.Append("v9=@v9,");
            strSql.Append("v10=@v10,");
            strSql.Append("n1=@n1,");
            strSql.Append("n2=@n2,");
            strSql.Append("n3=@n3,");
            strSql.Append("status=@status,");
            strSql.Append("create_person=@create_person,");
            strSql.Append("create_date=@create_date,");
            strSql.Append("update_person=@update_person,");
            strSql.Append("update_date=@update_date");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",          SqlDbType.NVarChar,   50),
                new SqlParameter("@Directions",    SqlDbType.NVarChar,  200),
                new SqlParameter("@AuditDate",     SqlDbType.DateTime),
                new SqlParameter("@AuditGuy",      SqlDbType.VarChar,    50),
                new SqlParameter("@remark",        SqlDbType.Text),
                new SqlParameter("@v1",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v2",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v3",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v4",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v5",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v6",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v7",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v8",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v9",            SqlDbType.NVarChar,  255),
                new SqlParameter("@v10",           SqlDbType.NVarChar,  255),
                new SqlParameter("@n1",            SqlDbType.Int,         4),
                new SqlParameter("@n2",            SqlDbType.Int,         4),
                new SqlParameter("@n3",            SqlDbType.Int,         4),
                new SqlParameter("@status",        SqlDbType.Int,         4),
                new SqlParameter("@create_person", SqlDbType.NVarChar,   50),
                new SqlParameter("@create_date",   SqlDbType.DateTime),
                new SqlParameter("@update_person", SqlDbType.NVarChar,   50),
                new SqlParameter("@update_date",   SqlDbType.DateTime),
                new SqlParameter("@ID",            SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.Name;
            parameters[1].Value  = model.Directions;
            parameters[2].Value  = model.AuditDate;
            parameters[3].Value  = model.AuditGuy;
            parameters[4].Value  = model.remark;
            parameters[5].Value  = model.v1;
            parameters[6].Value  = model.v2;
            parameters[7].Value  = model.v3;
            parameters[8].Value  = model.v4;
            parameters[9].Value  = model.v5;
            parameters[10].Value = model.v6;
            parameters[11].Value = model.v7;
            parameters[12].Value = model.v8;
            parameters[13].Value = model.v9;
            parameters[14].Value = model.v10;
            parameters[15].Value = model.n1;
            parameters[16].Value = model.n2;
            parameters[17].Value = model.n3;
            parameters[18].Value = model.status;
            parameters[19].Value = model.create_person;
            parameters[20].Value = model.create_date;
            parameters[21].Value = model.update_person;
            parameters[22].Value = model.update_date;
            parameters[23].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }