Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public System.Model.t_order GetModel(string orderId, string shName)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select orderId, customId, sjId, shName, shPhone, shAdress, money, yhjId, zffs, pudate, zt, yhMoney, songDate, liuyan, pstype  ");
            strSql.Append("  from t_order ");
            strSql.Append(" where orderId=@orderId and shName=@shName ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@orderId", SqlDbType.NVarChar, 50),
                new SqlParameter("@shName",  SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = orderId;
            parameters[1].Value = shName;


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

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.orderId  = ds.Tables[0].Rows[0]["orderId"].ToString();
                model.customId = ds.Tables[0].Rows[0]["customId"].ToString();
                model.sjId     = ds.Tables[0].Rows[0]["sjId"].ToString();
                model.shName   = ds.Tables[0].Rows[0]["shName"].ToString();
                model.shPhone  = ds.Tables[0].Rows[0]["shPhone"].ToString();
                model.shAdress = ds.Tables[0].Rows[0]["shAdress"].ToString();
                model.money    = ds.Tables[0].Rows[0]["money"].ToString();
                model.yhjId    = ds.Tables[0].Rows[0]["yhjId"].ToString();
                model.zffs     = ds.Tables[0].Rows[0]["zffs"].ToString();
                model.pudate   = ds.Tables[0].Rows[0]["pudate"].ToString();
                model.zt       = ds.Tables[0].Rows[0]["zt"].ToString();
                model.yhMoney  = ds.Tables[0].Rows[0]["yhMoney"].ToString();
                model.songDate = ds.Tables[0].Rows[0]["songDate"].ToString();
                model.liuyan   = ds.Tables[0].Rows[0]["liuyan"].ToString();
                if (ds.Tables[0].Rows[0]["pstype"].ToString() != "")
                {
                    model.pstype = int.Parse(ds.Tables[0].Rows[0]["pstype"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(System.Model.t_order model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_order(");
            strSql.Append("orderId,customId,sjId,shName,shPhone,shAdress,money,yhjId,zffs,pudate,zt,yhMoney,songDate,liuyan,pstype");
            strSql.Append(") values (");
            strSql.Append("@orderId,@customId,@sjId,@shName,@shPhone,@shAdress,@money,@yhjId,@zffs,@pudate,@zt,@yhMoney,@songDate,@liuyan,@pstype");
            strSql.Append(") ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@orderId",  SqlDbType.NVarChar,   50),
                new SqlParameter("@customId", SqlDbType.NVarChar,   50),
                new SqlParameter("@sjId",     SqlDbType.NVarChar,   50),
                new SqlParameter("@shName",   SqlDbType.NVarChar,   50),
                new SqlParameter("@shPhone",  SqlDbType.NVarChar,   50),
                new SqlParameter("@shAdress", SqlDbType.NVarChar,  200),
                new SqlParameter("@money",    SqlDbType.NVarChar,   50),
                new SqlParameter("@yhjId",    SqlDbType.NVarChar,   50),
                new SqlParameter("@zffs",     SqlDbType.NVarChar,   50),
                new SqlParameter("@pudate",   SqlDbType.NVarChar,   50),
                new SqlParameter("@zt",       SqlDbType.NVarChar,   50),
                new SqlParameter("@yhMoney",  SqlDbType.NVarChar,   50),
                new SqlParameter("@songDate", SqlDbType.NVarChar,   50),
                new SqlParameter("@liuyan",   SqlDbType.NVarChar, 2000),
                new SqlParameter("@pstype",   SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.orderId;
            parameters[1].Value  = model.customId;
            parameters[2].Value  = model.sjId;
            parameters[3].Value  = model.shName;
            parameters[4].Value  = model.shPhone;
            parameters[5].Value  = model.shAdress;
            parameters[6].Value  = model.money;
            parameters[7].Value  = model.yhjId;
            parameters[8].Value  = model.zffs;
            parameters[9].Value  = model.pudate;
            parameters[10].Value = model.zt;
            parameters[11].Value = model.yhMoney;
            parameters[12].Value = model.songDate;
            parameters[13].Value = model.liuyan;
            parameters[14].Value = model.pstype;
            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <System.Model.t_order> DataTableToList(DataTable dt)
        {
            List <System.Model.t_order> modelList = new List <System.Model.t_order>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                System.Model.t_order model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model          = new System.Model.t_order();
                    model.orderId  = dt.Rows[n]["orderId"].ToString();
                    model.customId = dt.Rows[n]["customId"].ToString();
                    model.sjId     = dt.Rows[n]["sjId"].ToString();
                    model.shName   = dt.Rows[n]["shName"].ToString();
                    model.shPhone  = dt.Rows[n]["shPhone"].ToString();
                    model.shAdress = dt.Rows[n]["shAdress"].ToString();
                    model.money    = dt.Rows[n]["money"].ToString();
                    model.yhjId    = dt.Rows[n]["yhjId"].ToString();
                    model.zffs     = dt.Rows[n]["zffs"].ToString();
                    model.pudate   = dt.Rows[n]["pudate"].ToString();
                    model.zt       = dt.Rows[n]["zt"].ToString();
                    model.yhMoney  = dt.Rows[n]["yhMoney"].ToString();
                    model.songDate = dt.Rows[n]["songDate"].ToString();
                    model.liuyan   = dt.Rows[n]["liuyan"].ToString();
                    if (dt.Rows[n]["pstype"].ToString() != "")
                    {
                        model.pstype = int.Parse(dt.Rows[n]["pstype"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(System.Model.t_order model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void  Add(System.Model.t_order model)
 {
     dal.Add(model);
 }
Exemplo n.º 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(System.Model.t_order model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_order set ");

            strSql.Append(" orderId = @orderId , ");
            strSql.Append(" customId = @customId , ");
            strSql.Append(" sjId = @sjId , ");
            strSql.Append(" shName = @shName , ");
            strSql.Append(" shPhone = @shPhone , ");
            strSql.Append(" shAdress = @shAdress , ");
            strSql.Append(" money = @money , ");
            strSql.Append(" yhjId = @yhjId , ");
            strSql.Append(" zffs = @zffs , ");
            strSql.Append(" pudate = @pudate , ");
            strSql.Append(" zt = @zt , ");
            strSql.Append(" yhMoney = @yhMoney , ");
            strSql.Append(" songDate = @songDate , ");
            strSql.Append(" liuyan = @liuyan , ");
            strSql.Append(" pstype = @pstype  ");
            strSql.Append(" where orderId=@orderId and shName=@shName  ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@orderId",  SqlDbType.NVarChar,   50),
                new SqlParameter("@customId", SqlDbType.NVarChar,   50),
                new SqlParameter("@sjId",     SqlDbType.NVarChar,   50),
                new SqlParameter("@shName",   SqlDbType.NVarChar,   50),
                new SqlParameter("@shPhone",  SqlDbType.NVarChar,   50),
                new SqlParameter("@shAdress", SqlDbType.NVarChar,  200),
                new SqlParameter("@money",    SqlDbType.NVarChar,   50),
                new SqlParameter("@yhjId",    SqlDbType.NVarChar,   50),
                new SqlParameter("@zffs",     SqlDbType.NVarChar,   50),
                new SqlParameter("@pudate",   SqlDbType.NVarChar,   50),
                new SqlParameter("@zt",       SqlDbType.NVarChar,   50),
                new SqlParameter("@yhMoney",  SqlDbType.NVarChar,   50),
                new SqlParameter("@songDate", SqlDbType.NVarChar,   50),
                new SqlParameter("@liuyan",   SqlDbType.NVarChar, 2000),
                new SqlParameter("@pstype",   SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.orderId;
            parameters[1].Value  = model.customId;
            parameters[2].Value  = model.sjId;
            parameters[3].Value  = model.shName;
            parameters[4].Value  = model.shPhone;
            parameters[5].Value  = model.shAdress;
            parameters[6].Value  = model.money;
            parameters[7].Value  = model.yhjId;
            parameters[8].Value  = model.zffs;
            parameters[9].Value  = model.pudate;
            parameters[10].Value = model.zt;
            parameters[11].Value = model.yhMoney;
            parameters[12].Value = model.songDate;
            parameters[13].Value = model.liuyan;
            parameters[14].Value = model.pstype;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

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