예제 #1
0
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ShowShop.BLL.Product.Express bll = new ShowShop.BLL.Product.Express();
                ShowShop.Model.Product.Express model = new ShowShop.Model.Product.Express();
                model.Name = this.txtName.Text.Trim();
                model.FullName = this.txtFullName.Text.Trim();
                model.Address = this.txtAddress.Text.Trim();

                if (txtPhone.Text!="")
                {
                    if(!ChangeHope.Common.ValidateHelper.IsPhone(txtPhone.Text.Trim()))
                    {
                        this.ltlMsg.Text = "操作失败,请输入正确的电话号码。";
                        this.pnlMsg.Visible = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                }
                model.Phone = this.txtPhone.Text.Trim();
                model.Person = this.txtPerson.Text.Trim();
                model.Sort = Convert.ToInt32(this.txtSort.Text.Trim());
                if (ViewState["ID"] != null)//更新
                {
                    model.ID = Convert.ToInt32(ViewState["ID"].ToString());
                    model.Numstr = ViewState["NumStr"].ToString();
                    bll.Amend(model);
                }
                else//添加
                {
                    string str = DateTime.Now.ToFileTime().ToString();
                    Random rand = new Random();
                    model.Numstr = String.Format("YX{0}Ram{1}", str, rand.Next(10000, 99999));
                    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";
            }
        }
예제 #2
0
 /// <summary>
 /// 修改优先级
 /// </summary>
 /// <param name="id"></param>
 /// <param name="sort"></param>
 private void SetSort(int id, int sort)
 {
     ShowShop.BLL.Product.Express bll = new ShowShop.BLL.Product.Express();
     bll.Amend(id, "sort", sort);
     Response.Write("ok");
 }