Esempio n. 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
     {
         if (nickname.Text.Trim() != null && nickname.Text.Trim() != "" &&
             phone.Text.Trim() != null && phone.Text.Trim() != "" &&
             ddlcontactlist.SelectedValue.Trim() != null && ddlcontactlist.SelectedValue.Trim() != "")
         {
             MSShopContactsDAL contactdal   = new MSShopContactsDAL();
             MSShopContacts    contactmodel = new MSShopContacts();
             contactmodel.Phone = phone.Text;
             contactmodel.SID   = ddlcontactlist.SelectedValue;
             if (qqnum.Text.Trim() != null && qqnum.Text.Trim() != "")
             {
                 contactmodel.QQnum = Convert.ToInt32(qqnum.Text);
             }
             if (email.Text.Trim() != null && email.Text.Trim() != "")
             {
                 contactmodel.Email = email.Text;
             }
             if (address.Value.Trim() != null && address.Value.Trim() != "")
             {
                 contactmodel.Address = address.Value;
             }
             contactmodel.IsDel     = 0;
             contactmodel.IsDefault = isyes.Checked ? 1 : 0;
             contactmodel.ID        = strID;
             if (contactdal.UpdateMSSContacts(contactmodel))
             {
                 MessageBox.Show(this, "操作成功!");
             }
             else
             {
                 MessageBox.Show(this, "操作失败!");
             }
         }
         else
         {
             MessageBox.Show(this, "请输入相应名称或电话!");
         }
     }
     else
     {
         return;
     }
 }
        protected void uploadbtn_Click(object sender, EventArgs e)
        {
            #region 信息判断
            if (Session["customerID"] != null && Session["customerID"].ToString() != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                phone = customerDal.GetCustomerValueByID("phone", Session["customerID"].ToString()).ToString();
            }
            else
            {
                JQDialog.SetCookies("pageurl", "PubSecHandEdit.aspx?ishand=" + ishand, 2);
                errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error");
                return;
            }
            MSProduct productModel = new MSProduct();
            if (setpvalue.Value.Trim() != null && setpvalue.Value.Trim() != "")
            {
                productModel.Cid = setpvalue.Value;
            }
            if (pdesc.Value.Trim() != null && pdesc.Value.Trim() != "")
            {
                productModel.Pcontent = pdesc.Value;
            }
            if (price.Value.Trim() != null && price.Value.Trim() != "")
            {
                productModel.Price = Convert.ToDecimal(price.Value);
            }
            if (ptitle.Value.Trim() != null && ptitle.Value.Trim() != "")
            {
                productModel.Ptitle = ptitle.Value;
            }
            if (price.Value.Trim() != null && price.Value.Trim() != "")
            {
                productModel.Price = Convert.ToDecimal(price.Value);
            }
            #endregion
            productModel.ID         = pid;
            productModel.IsSecHand  = ishand;
            productModel.Pstate     = 0;
            productModel.Review     = Review;
            productModel.CustomerID = Session["customerID"].ToString();
            MSProductDAL productDal = new MSProductDAL();

            MSShopContacts    contactModel = new MSShopContacts();
            MSShopContactsDAL contactDal   = new MSShopContactsDAL();
            contactModel.PID      = pid;
            contactModel.IsDel    = 0;
            contactModel.SID      = "";
            contactModel.NickName = UserName.Value;
            contactModel.Phone    = UserPhone.Value;
            bool contactflag = false;
            if (contactDal.ExistContact("", "", "", pid))
            {
                contactModel.ID = contactID;
                contactflag     = contactDal.UpdateMSSContacts(contactModel);
            }
            else
            {
                contactModel.ID = Guid.NewGuid().ToString("N").ToUpper();
                contactflag     = contactDal.AddMSSContacts(contactModel);
            }
            if (productDal.UpdateMSProduct(productModel) && SaveImages())
            {
                errorscript = JQDialog.alertOKMsgBox(3, "操作成功!", "MySecHand.aspx", "error");
            }
            else
            {
                errorscript = JQDialog.alertOKMsgBox(4, "操作失败,请核对后再操作!", "", "error");
                return;
            }
        }