예제 #1
0
        public void Update(PawnProductModel model)
        {
            DbCommand command = dbw.GetStoredProcCommand("UP_mwPawnProduct_Update");

            dbw.AddInParameter(command, "@pawnproductid", DbType.Int32, model.PawnProductID);
            dbw.AddInParameter(command, "@pawnproductname", DbType.String, model.PawnProductName);
            dbw.AddInParameter(command, "@pawnprice", DbType.Decimal, model.PawnPrice);
            dbw.AddInParameter(command, "@sellingprice", DbType.Decimal, model.SellingPrice);
            dbw.AddInParameter(command, "@cateid", DbType.Int32, model.CateID);
            dbw.AddInParameter(command, "@catepath", DbType.String, model.CatePath);
            dbw.AddInParameter(command, "@stock", DbType.Int32, model.Stock);
            dbw.AddInParameter(command, "@smallimage", DbType.String, model.SmallImage);
            dbw.AddInParameter(command, "@mediumimage", DbType.String, model.MediumImage);
            dbw.AddInParameter(command, "@brief", DbType.String, model.Brief);
            dbw.AddInParameter(command, "@inserttime", DbType.DateTime, model.InsertTime);
            dbw.AddInParameter(command, "@changetime", DbType.DateTime, model.ChangeTime);
            dbw.AddInParameter(command, "@status", DbType.Int32, model.Status);
            dbw.AddInParameter(command, "@sortvalue", DbType.Int32, model.SortValue);
            dbw.AddInParameter(command, "@userid", DbType.String, model.UserID);
            dbw.AddInParameter(command, "@deadtime", DbType.DateTime, model.DeadTime);
            dbw.AddInParameter(command, "@truename", DbType.String, model.TrueName);
            dbw.AddInParameter(command, "@phone", DbType.String, model.Phone);
            dbw.AddInParameter(command, "@cellphone", DbType.String, model.CellPhone);
            dbw.AddInParameter(command, "@postcode", DbType.String, model.PostCode);
            dbw.AddInParameter(command, "@region", DbType.String, model.Region);
            dbw.AddInParameter(command, "@address", DbType.String, model.Address);

            dbw.ExecuteNonQuery(command);
        }
예제 #2
0
        private void BindData()
        {
            PawnProductModel model   = bll.GetModel(PawnProductID);
            MagicCategoryBll cateBll = new MagicCategoryBll();

            if (model.Status != (int)PawnProductStatus.尚未收当)
            {
                MessageBox.Show(this, "该商品已被审核,禁止编辑!");
                Response.Redirect("List.aspx");
                return;
            }

            CategoryID = model.CateID;
            if (!String.IsNullOrEmpty(Request.QueryString["categoryid"]))
            {
                CategoryID = Convert.ToInt32(Request.QueryString["categoryid"]);
            }

            TextBox_Category.Text    = new MagicCategoryBll().GetModel(CategoryID).CategoryName;
            TextBox_ProductName.Text = model.PawnProductName;
            TextBox_EndTime.Text     = model.DeadTime.ToString("yyyy-MM-dd");
            TextBox_Price.Text       = model.PawnPrice.ToString("0.00");
            TextBox_Brief.Text       = model.Brief;
            TextBox_TrueName.Text    = model.TrueName;
            TextBox_Phone.Text       = model.Phone;
            TextBox_CellPhone.Text   = model.CellPhone;
            TextBox_PostCode.Text    = model.PostCode;
            TextBox_Address.Text     = model.Address;
            ucRegion.PresetRegionInfo(RegionInfo.GetRegionPathByName(model.Region.Split(' ')[model.Region.Split(' ').Length - 1]));
        }
예제 #3
0
        private void BindData()
        {
            PawnProductModel model = bll.GetModel(PawnProductID);
            MemberInfo       user  = MemberInfo.GetFullInfo(model.UserID);

            if (model.Status != (int)PawnProductStatus.冻结)
            {
                Image_Medium.ImageUrl = MagicWorldImageRule.GetMainImageUrl(model.MediumImage);
                Image_Small.ImageUrl  = MagicWorldImageRule.GetMainImageUrl(model.SmallImage);

                Literal_ProductName.Text = model.PawnProductName;
                Literal_Price.Text       = model.SellingPrice.ToString("0.00");
                Literal_UserID.Text      = model.UserID;
                Literal_Brief.Text       = model.Brief;

                Literal_UserID2.Text = user.UserId;
                string UserPhone = String.Empty, Address = String.Empty;
                switch (user.UserType)
                {
                case MemberType.Personal:
                    PersonMemberInfo puser = (PersonMemberInfo)user;
                    UserPhone = puser.Mobile == String.Empty ? puser.Telephone : puser.Mobile;
                    Address   = String.Empty;
                    break;

                case MemberType.Famly:
                    FamlyMemberInfo fuser = (FamlyMemberInfo)user;
                    UserPhone = fuser.Mobile == String.Empty ? fuser.Telephone : fuser.Mobile;
                    Address   = fuser.Address;
                    break;

                case MemberType.Company:
                    CompanyMemberInfo cuser = (CompanyMemberInfo)user;
                    UserPhone = cuser.Mobile == String.Empty ? cuser.Telephone : cuser.Mobile;
                    Address   = cuser.Address;
                    break;

                case MemberType.School:
                    SchoolMemberInfo suser = (SchoolMemberInfo)user;
                    UserPhone = suser.Mobile == String.Empty ? suser.Telephone : suser.Mobile;
                    Address   = suser.Address;
                    break;

                default:
                    UserPhone = String.Empty;
                    Address   = String.Empty;
                    break;
                }

                Literal_Phone.Text   = UserPhone;
                Literal_Address.Text = Address;

                Repeater_Comment.DataSource = CmtBll.GetList(AppType.MagicWorld, PawnProductID);
                Repeater_Comment.DataBind();
            }
            else
            {
                Response.End();
            }
        }
예제 #4
0
        private PawnProductModel BindModel(DataRow row)
        {
            PawnProductModel model = new PawnProductModel()
            {
                Address         = Convert.ToString(row["address"]),
                Brief           = Convert.ToString(row["brief"]),
                CateID          = Convert.ToInt32(row["cateid"]),
                CatePath        = Convert.ToString(row["catepath"]),
                CellPhone       = Convert.ToString(row["cellphone"]),
                ChangeTime      = Convert.ToDateTime(row["changetime"]),
                DeadTime        = Convert.ToDateTime(row["deadtime"]),
                InsertTime      = Convert.ToDateTime(row["inserttime"]),
                MediumImage     = Convert.ToString(row["mediumimage"]),
                PawnPrice       = Convert.ToDecimal(row["pawnprice"]),
                PawnProductID   = Convert.ToInt32(row["pawnproductid"]),
                PawnProductName = Convert.ToString(row["pawnproductname"]),
                Phone           = Convert.ToString(row["phone"]),
                PostCode        = Convert.ToString(row["postcode"]),
                Region          = Convert.ToString(row["region"]),
                SellingPrice    = Convert.ToInt32(row["sellingprice"]),
                SmallImage      = Convert.ToString(row["smallimage"]),
                SortValue       = Convert.ToInt32(row["sortvalue"]),
                Status          = Convert.ToInt16(row["status"]),
                Stock           = Convert.ToInt32(row["stock"]),
                TrueName        = Convert.ToString(row["truename"]),
                UserID          = Convert.ToString(row["userid"])
            };

            return(model);
        }
예제 #5
0
        private void BindData()
        {
            PawnProductModel model = bll.GetModel(PawnProductID);

            TextBox_ProductName.Text  = model.PawnProductName;
            TextBox_PawnPrice.Text    = model.PawnPrice.ToString();
            TextBox_SellingPrice.Text = model.SellingPrice.ToString();
            TextBox_Brief.Text        = model.Brief;
            TextBox_Count.Text        = model.Stock.ToString();
            //TextBox_Keyword.Text = model.Keywords;
            Image_ProductImage.ImageUrl = MagicWorldImageRule.GetMainImageUrl(model.MediumImage);
        }
예제 #6
0
        public PawnProductModel GetModel(int PawnProductID)
        {
            DbCommand command = dbr.GetStoredProcCommand("UP_mwPawnProduct_Get");

            dbr.AddInParameter(command, "@pawnproductid", DbType.Int32, PawnProductID);
            DataTable        dt    = dbr.ExecuteDataSet(command).Tables[0];
            PawnProductModel model = null;

            if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
            {
                model = BindModel(dt.Rows[0]);
            }
            return(model);
        }
예제 #7
0
        protected void Button_OK_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (TextBox_ProductName.Text == "")
            {
                strErr += "拍品名称为空!\\n";
            }
            if (TextBox_Count.Text == "" || !PageValidate.IsNumber(TextBox_Count.Text))
            {
                strErr += "拍品数量为空或者不是数字!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            PawnProductModel model = bll.GetModel(PawnProductID);

            if (FileUpload_ProductImage.FileName != "")
            {
                string[] ProductImages;
                if (MagicWorldImageRule.SaveProductMainImage(PawnProductID, FileUpload_ProductImage.PostedFile, out ProductImages))
                {
                    model.SmallImage  = ProductImages[0];
                    model.MediumImage = ProductImages[1];
                    //model.LargeImage = ProductImages[2];
                }
                else
                {
                    MessageBox.Show(this, "图片上传失败");
                    return;
                }
            }


            model.PawnProductName = TextBox_ProductName.Text;
            model.PawnPrice       = Convert.ToDecimal(TextBox_PawnPrice.Text);
            model.SellingPrice    = Convert.ToDecimal(TextBox_SellingPrice.Text);
            model.Brief           = TextBox_Brief.Text;
            //model.Keywords = TextBox_Keyword.Text;
            model.Stock      = Convert.ToInt32(TextBox_Count.Text);
            model.ChangeTime = DateTime.Now;
            model.Status     = (int)PawnProductStatus.已收当;

            bll.Update(model);
            Response.Redirect("List.aspx");
        }
 public void Update(PawnProductModel model)
 {
     dal.Update(model);
 }
 public void Add(PawnProductModel model)
 {
     dal.Add(model);
 }