Ejemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ShowShop.Model.Product.Deliver GetModelByID(int id)
        {
            ShowShop.Model.Product.Deliver model = new ShowShop.Model.Product.Deliver();
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,name,inceptprice,inceptweight,arrivepay,description,addpriceladder,addweightladder,boundprice,isspecial,isused,putoutid,putouttyid,sort from yxs_deliver ");
            strSql.Append(" where [id]=@id ");
            SqlParameter[] parameters = (SqlParameter[])this.ValueIDPara(id);
            using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString(), parameters))
            {
                if (reader.Read())
                {
                    model.ID = reader.GetInt32(0);
                    model.Name = reader.GetString(1);
                    model.InceptPrice = Convert.ToDecimal(reader["inceptprice"]);
                    model.InceptWeight = Convert.ToDecimal(reader["inceptweight"]);
                    model.ArrivePay = reader.GetInt32(4);
                    model.Description = reader.GetString(5);
                    model.AddPriceLadder = Convert.ToDecimal(reader["addpriceladder"]);
                    model.AddWeightLadder = Convert.ToDecimal(reader["addweightladder"]);
                    model.BoundPrice = reader.GetString(8);
                    model.IsSpecial = reader.GetInt32(9);
                    model.IsUsed = reader.GetInt32(10);
                    model.PutoutId = reader.GetInt32(11);
                    model.PutouttyId = reader.GetInt32(12);
                    model.Sort = reader.GetInt32(13);
                }
                else
                {
                    model = null;
                }

            }
            return model;
        }
Ejemplo n.º 2
0
 protected void lbtnSave_Click(object sender, EventArgs e)
 {
     //try
     //{
         ShowShop.BLL.Product.Deliver bll = new ShowShop.BLL.Product.Deliver();
         ShowShop.Model.Product.Deliver model = new ShowShop.Model.Product.Deliver();
         if (!ChangeHope.Common.ValidateHelper.IsMoney(txtInceptPrice.Text) || !ChangeHope.Common.ValidateHelper.IsNumber(txtInceptWeight.Text) || !ChangeHope.Common.ValidateHelper.IsMoney(txtAddPricelAdder.Text) || !ChangeHope.Common.ValidateHelper.IsMoney(txtAddWeightlAdder.Text) || !ChangeHope.Common.ValidateHelper.IsNumber(txtBoundU1.Text) || !ChangeHope.Common.ValidateHelper.IsNumber(txtBoundD1.Text) || !ChangeHope.Common.ValidateHelper.IsMoney(txtBoundP1.Text))
         {
             this.ltlMsg.Text = "操作失败,请输入正确的价格或者数字";
             this.pnlMsg.Visible = true;
             this.pnlMsg.CssClass = "actionErr";
             return;
         }
         if (float.Parse(txtInceptPrice.Text) <= 0 || float.Parse(txtInceptWeight.Text) <= 0 || float.Parse(txtAddPricelAdder.Text) <= 0 || float.Parse(txtAddWeightlAdder.Text) <= 0 || float.Parse(txtBoundU1.Text) <= 0 || float.Parse(txtBoundD1.Text) <= 0 || float.Parse(txtBoundP1.Text)<=0 )
         {
             this.ltlMsg.Text = "操作失败,价格与重量数不能小于或者等于0";
             this.pnlMsg.Visible = true;
             this.pnlMsg.CssClass = "actionErr";
             return;
         }
         model.Name = this.txtName.Text.Trim();
         model.InceptPrice = Convert.ToDecimal(this.txtInceptPrice.Text.Trim());
         model.InceptWeight = Convert.ToDecimal(this.txtInceptWeight.Text.Trim());
         model.ArrivePay = Convert.ToInt32(this.rblArrivePay.SelectedValue);
         model.Description = this.txtDescription.Text.Trim();
         model.AddPriceLadder = Convert.ToDecimal(this.txtAddPricelAdder.Text.Trim());
         model.AddWeightLadder = Convert.ToDecimal(this.txtAddWeightlAdder.Text.Trim());
         model.BoundPrice = GetBoundPrice();
         model.IsSpecial = Convert.ToInt32(this.rblIsSpecial.SelectedValue);
         model.IsUsed = Convert.ToInt32(this.rblisused.SelectedValue);
         model.Sort = Convert.ToInt32(this.txtSort.Text.Trim());
         if (ViewState["ID"] != null)//更新
         {
             model.ID = Convert.ToInt32(ViewState["ID"].ToString());
             model.PutoutId = Convert.ToInt32(ViewState["PutoutID"]);
             model.PutouttyId = Convert.ToInt32(ViewState["PutoutTyID"]);
             bll.Amend(model);
         }
         else//添加
         {
             ShowShop.Model.Admin.AdminInfo adminModel = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get();
             //管理员ID
             model.PutoutId = adminModel.AdminId;
             model.PutouttyId = 0;
             bll.Add(model);
         }
         this.ltlMsg.Text = "操作成功,已保存该信息";
         this.pnlMsg.Visible = true;
         this.pnlMsg.CssClass = "actionOk";
     //}
     //catch
     //{
     //    this.ltlMsg.Text = "操作失败,请查看数据格式是否符合要求";
     //    this.pnlMsg.Visible = true;
     //    this.pnlMsg.CssClass = "actionErr";
     //}
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到指定条件的所有短消息
 /// </summary>
 /// <param name="uid"></param>
 /// <returns></returns>
 public List<ShowShop.Model.Product.Deliver> GetAll(string strWhere)
 {
     List<ShowShop.Model.Product.Deliver> list = new List<ShowShop.Model.Product.Deliver>();
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  id,name,inceptprice,inceptweight,arrivepay,description,addpriceladder,addweightladder,boundprice,isspecial,isused,putoutid,putouttyid,sort from yxs_deliver ");
     if (strWhere != null && strWhere != "")
     {
         strSql.Append("where " + strWhere + " ");
     }
     strSql.Append(" order by sort asc");
     using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString()))
     {
         while (reader.Read())
         {
             ShowShop.Model.Product.Deliver model = new ShowShop.Model.Product.Deliver();
             model.ID = reader.GetInt32(0);
             model.Name = reader.GetString(1);
             model.InceptPrice = Convert.ToDecimal(reader["inceptprice"]);
             model.InceptWeight = Convert.ToDecimal(reader["inceptweight"]);
             model.ArrivePay = reader.GetInt32(4);
             model.Description = reader.GetString(5);
             model.AddPriceLadder = Convert.ToDecimal(reader["addpriceladder"]);
             model.AddWeightLadder = Convert.ToDecimal(reader["addweightladder"]);
             model.BoundPrice = reader.GetString(8);
             model.IsSpecial = reader.GetInt32(9);
             model.IsUsed = reader.GetInt32(10);
             model.PutoutId = reader.GetInt32(11);
             model.PutouttyId = reader.GetInt32(12);
             model.Sort = reader.GetInt32(13);
             list.Add(model);
         }
     }
     return list;
 }