Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(DNSABC.Model.DNSABC_Order model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update DNSABC_Order set ");
            strSql.Append("OrderId=@OrderId,");
            strSql.Append("ProductType=@ProductType,");
            strSql.Append("ProductID=@ProductID,");
            strSql.Append("ProductName=@ProductName,");
            strSql.Append("UserId=@UserId,");
            strSql.Append("Domain=@Domain,");
            strSql.Append("Price=@Price,");
            strSql.Append("State=@State,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("FinishTime=@FinishTime,");
            strSql.Append("UpdateTime=@UpdateTime,");
            strSql.Append("CreateTime=@CreateTime");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderId",     SqlDbType.VarChar,    50),
                new SqlParameter("@ProductType", SqlDbType.Int,         4),
                new SqlParameter("@ProductID",   SqlDbType.Int,         4),
                new SqlParameter("@ProductName", SqlDbType.VarChar,   200),
                new SqlParameter("@UserId",      SqlDbType.Int,         4),
                new SqlParameter("@Domain",      SqlDbType.VarChar,   200),
                new SqlParameter("@Price",       SqlDbType.Int,         4),
                new SqlParameter("@State",       SqlDbType.Int,         4),
                new SqlParameter("@Remark",      SqlDbType.VarChar,   500),
                new SqlParameter("@FinishTime",  SqlDbType.DateTime),
                new SqlParameter("@UpdateTime",  SqlDbType.DateTime),
                new SqlParameter("@CreateTime",  SqlDbType.DateTime),
                new SqlParameter("@Id",          SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.OrderId;
            parameters[1].Value  = model.ProductType;
            parameters[2].Value  = model.ProductID;
            parameters[3].Value  = model.ProductName;
            parameters[4].Value  = model.UserId;
            parameters[5].Value  = model.Domain;
            parameters[6].Value  = model.Price;
            parameters[7].Value  = model.State;
            parameters[8].Value  = model.Remark;
            parameters[9].Value  = model.FinishTime;
            parameters[10].Value = model.UpdateTime;
            parameters[11].Value = model.CreateTime;
            parameters[12].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(DNSABC.Model.DNSABC_Order model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into DNSABC_Order(");
            strSql.Append("OrderId,ProductType,ProductID,ProductName,UserId,Domain,Price,State,Remark,FinishTime,UpdateTime,CreateTime)");
            strSql.Append(" values (");
            strSql.Append("@OrderId,@ProductType,@ProductID,@ProductName,@UserId,@Domain,@Price,@State,@Remark,@FinishTime,@UpdateTime,@CreateTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderId",     SqlDbType.VarChar,    50),
                new SqlParameter("@ProductType", SqlDbType.Int,         4),
                new SqlParameter("@ProductID",   SqlDbType.Int,         4),
                new SqlParameter("@ProductName", SqlDbType.VarChar,   200),
                new SqlParameter("@UserId",      SqlDbType.Int,         4),
                new SqlParameter("@Domain",      SqlDbType.VarChar,   200),
                new SqlParameter("@Price",       SqlDbType.Int,         4),
                new SqlParameter("@State",       SqlDbType.Int,         4),
                new SqlParameter("@Remark",      SqlDbType.VarChar,   500),
                new SqlParameter("@FinishTime",  SqlDbType.DateTime),
                new SqlParameter("@UpdateTime",  SqlDbType.DateTime),
                new SqlParameter("@CreateTime",  SqlDbType.DateTime)
            };
            parameters[0].Value  = model.OrderId;
            parameters[1].Value  = model.ProductType;
            parameters[2].Value  = model.ProductID;
            parameters[3].Value  = model.ProductName;
            parameters[4].Value  = model.UserId;
            parameters[5].Value  = model.Domain;
            parameters[6].Value  = model.Price;
            parameters[7].Value  = model.State;
            parameters[8].Value  = model.Remark;
            parameters[9].Value  = model.FinishTime;
            parameters[10].Value = model.UpdateTime;
            parameters[11].Value = model.CreateTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #3
0
 private void ShowInfo(int Id)
 {
     DNSABC.BLL.DNSABC_Order   bll   = new DNSABC.BLL.DNSABC_Order();
     DNSABC.Model.DNSABC_Order model = bll.GetModel(Id);
     this.lblId.Text          = model.Id.ToString();
     this.txtOrderId.Text     = model.OrderId.ToString();
     this.txtProductType.Text = model.ProductType.ToString();
     this.txtProductID.Text   = model.ProductID.ToString();
     this.txtProductName.Text = model.ProductName;
     this.txtUserId.Text      = model.UserId.ToString();
     this.txtDomain.Text      = model.Domain;
     this.txtPrice.Text       = model.Price.ToString();
     this.txtState.Text       = model.State.ToString();
     this.txtRemark.Text      = model.Remark;
     this.txtFinishTime.Text  = model.FinishTime.ToString();
     this.txtUpdateTime.Text  = model.UpdateTime.ToString();
     this.txtCreateTime.Text  = model.CreateTime.ToString();
 }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DNSABC.Model.DNSABC_Order GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,OrderId,ProductType,ProductID,ProductName,UserId,Domain,Price,State,Remark,FinishTime,UpdateTime,CreateTime from DNSABC_Order ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"] != null && ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["OrderId"] != null && ds.Tables[0].Rows[0]["OrderId"].ToString() != "")
                {
                    model.OrderId = ds.Tables[0].Rows[0]["OrderId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ProductType"] != null && ds.Tables[0].Rows[0]["ProductType"].ToString() != "")
                {
                    model.ProductType = int.Parse(ds.Tables[0].Rows[0]["ProductType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ProductID"] != null && ds.Tables[0].Rows[0]["ProductID"].ToString() != "")
                {
                    model.ProductID = int.Parse(ds.Tables[0].Rows[0]["ProductID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ProductName"] != null && ds.Tables[0].Rows[0]["ProductName"].ToString() != "")
                {
                    model.ProductName = ds.Tables[0].Rows[0]["ProductName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["UserId"] != null && ds.Tables[0].Rows[0]["UserId"].ToString() != "")
                {
                    model.UserId = int.Parse(ds.Tables[0].Rows[0]["UserId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Domain"] != null && ds.Tables[0].Rows[0]["Domain"].ToString() != "")
                {
                    model.Domain = ds.Tables[0].Rows[0]["Domain"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Price"] != null && ds.Tables[0].Rows[0]["Price"].ToString() != "")
                {
                    model.Price = int.Parse(ds.Tables[0].Rows[0]["Price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["State"] != null && ds.Tables[0].Rows[0]["State"].ToString() != "")
                {
                    model.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null && ds.Tables[0].Rows[0]["Remark"].ToString() != "")
                {
                    model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["FinishTime"] != null && ds.Tables[0].Rows[0]["FinishTime"].ToString() != "")
                {
                    model.FinishTime = DateTime.Parse(ds.Tables[0].Rows[0]["FinishTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UpdateTime"] != null && ds.Tables[0].Rows[0]["UpdateTime"].ToString() != "")
                {
                    model.UpdateTime = DateTime.Parse(ds.Tables[0].Rows[0]["UpdateTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreateTime"] != null && ds.Tables[0].Rows[0]["CreateTime"].ToString() != "")
                {
                    model.CreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["CreateTime"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtOrderId.Text))
            {
                strErr += "订单号 时间戳格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtProductType.Text))
            {
                strErr += "产品类型 1格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtProductID.Text))
            {
                strErr += "产品ID格式错误!\\n";
            }
            if (this.txtProductName.Text.Trim().Length == 0)
            {
                strErr += "产品名称不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtUserId.Text))
            {
                strErr += "用户ID格式错误!\\n";
            }
            if (this.txtDomain.Text.Trim().Length == 0)
            {
                strErr += "产品标识 对应业务的表示不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtPrice.Text))
            {
                strErr += "产品金额格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtState.Text))
            {
                strErr += "订单状态格式错误!\\n";
            }
            if (this.txtRemark.Text.Trim().Length == 0)
            {
                strErr += "附注说明 生成订单的时候不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtFinishTime.Text))
            {
                strErr += "完成时间格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtUpdateTime.Text))
            {
                strErr += "更新时间格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtCreateTime.Text))
            {
                strErr += "创建时间格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      OrderId     = int.Parse(this.txtOrderId.Text);
            int      ProductType = int.Parse(this.txtProductType.Text);
            int      ProductID   = int.Parse(this.txtProductID.Text);
            string   ProductName = this.txtProductName.Text;
            int      UserId      = int.Parse(this.txtUserId.Text);
            string   Domain      = this.txtDomain.Text;
            int      Price       = int.Parse(this.txtPrice.Text);
            int      State       = int.Parse(this.txtState.Text);
            string   Remark      = this.txtRemark.Text;
            DateTime FinishTime  = DateTime.Parse(this.txtFinishTime.Text);
            DateTime UpdateTime  = DateTime.Parse(this.txtUpdateTime.Text);
            DateTime CreateTime  = DateTime.Parse(this.txtCreateTime.Text);

            DNSABC.Model.DNSABC_Order model = new DNSABC.Model.DNSABC_Order();
            model.OrderId     = OrderId;
            model.ProductType = ProductType;
            model.ProductID   = ProductID;
            model.ProductName = ProductName;
            model.UserId      = UserId;
            model.Domain      = Domain;
            model.Price       = Price;
            model.State       = State;
            model.Remark      = Remark;
            model.FinishTime  = FinishTime;
            model.UpdateTime  = UpdateTime;
            model.CreateTime  = CreateTime;

            DNSABC.BLL.DNSABC_Order bll = new DNSABC.BLL.DNSABC_Order();
            bll.Add(model);
            ROYcms.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }