Esempio n. 1
0
        /// <summary>
        /// 添加店铺联系方式
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddMSSContacts(MSShopContacts model)
        {
            string sql = @"INSERT INTO [MS_ShopContacts]
                        ([ID],[SID],[PID],[NickName],[Phone],[QQnum],[Email],[Address],[IsDefault],[IsDel],[AddTime])
                 VALUES
                        (@ID,@SID,@PID,@NickName,@Phone,@QQnum,@Email,@Address,@IsDefault,@IsDel,@AddTime)";

            System.Data.SqlClient.SqlParameter[] paras = new System.Data.SqlClient.SqlParameter[]
            {
                new System.Data.SqlClient.SqlParameter("@ID", model.ID),
                new System.Data.SqlClient.SqlParameter("@SID", model.SID),
                new System.Data.SqlClient.SqlParameter("@PID", model.PID),
                new System.Data.SqlClient.SqlParameter("@NickName", model.NickName),
                new System.Data.SqlClient.SqlParameter("@Phone", model.Phone),
                new System.Data.SqlClient.SqlParameter("@QQnum", model.QQnum),
                new System.Data.SqlClient.SqlParameter("@Email", model.Email),
                new System.Data.SqlClient.SqlParameter("@Address", model.Address),
                new System.Data.SqlClient.SqlParameter("@IsDefault", model.IsDefault),
                new System.Data.SqlClient.SqlParameter("@IsDel", (model.IsDel == 1?1:0)),
                new System.Data.SqlClient.SqlParameter("@AddTime", DateTime.Now)
            };
            int rowsAffected = DbHelperSQL.ExecuteSql(sql.ToString(), paras);

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 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();
             if (contactdal.ExistContact(phone.Text, nickname.Text, ddlcontactlist.SelectedValue, ""))
             {
                 MessageBox.Show(this, "该联系方式已经存在!");
             }
             else
             {
                 MSShopContacts contactmodel = new MSShopContacts();
                 contactmodel.Phone    = phone.Text;
                 contactmodel.SID      = ddlcontactlist.SelectedValue;
                 contactmodel.NickName = nickname.Text;
                 string cityselect = string.Empty;
                 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.IsDefault = isyes.Checked ? 1 : 0;
                 contactmodel.IsDel     = 0;
                 contactmodel.ID        = Guid.NewGuid().ToString("N").ToUpper();
                 if (contactdal.AddMSSContacts(contactmodel))
                 {
                     MessageBox.Show(this, "操作成功!");
                 }
                 else
                 {
                     MessageBox.Show(this, "操作失败!");
                 }
             }
         }
         else
         {
             MessageBox.Show(this, "请输入相应名称或电话!");
         }
     }
     else
     {
         return;
     }
 }
Esempio n. 3
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;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 更新店铺联系方式
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateMSSContacts(MSShopContacts model)
        {
            string safeslq = "";

            safeslq = "UPDATE MS_ShopContacts SET ";
            if (model.SID != null && model.SID != "")
            {
                safeslq += "SID='" + model.SID + "',";
            }
            if (model.PID != null && model.PID != "")
            {
                safeslq += "PID='" + model.PID + "',";
            }
            if (model.NickName != null && model.NickName.ToString() != "")
            {
                safeslq += "NickName='" + model.NickName + "',";
            }
            if (model.Phone != null && model.Phone.ToString() != "")
            {
                safeslq += "Phone='" + model.Phone + "',";
            }
            safeslq += "QQnum=" +
                       (model.QQnum.ToString() != null && model.QQnum.ToString() != "" ? model.QQnum : 0) + ",";
            if (model.Email != null && model.Email != "")
            {
                safeslq += "Email='" + model.Email + "',";
            }
            if (model.Address != null && model.Address != "")
            {
                safeslq += "[Address]='" + model.Address + "',";
            }
            safeslq += "IsDefault=" + (model.IsDefault == 1 ? 1 : 0) + ",";
            safeslq += " IsDel=" + (model.IsDel == 1 ? 1 : 0) + " ";
            safeslq += " where ID='" + model.ID + "'";
            int rowsAffected = DbHelperSQL.ExecuteSql(safeslq.ToString());

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
        void showdetailinfo()
        {
            ddlcontactlist.Items.Clear();
            MSShopDAL actDal = new MSShopDAL();
            DataSet   ds     = new DataSet();

            ds = actDal.GetMSShopList("");
            ddlcontactlist.DataSource     = ds.Tables[0].DefaultView;
            ddlcontactlist.DataTextField  = "ShopName";
            ddlcontactlist.DataValueField = "ID";
            ddlcontactlist.DataBind();

            MSShopContactsDAL contactdal = new MSShopContactsDAL();
            DataSet           contactds  = contactdal.GetContactDetail(strID);
            MSShopContacts    contactdel = DataConvert.DataRowToModel <MSShopContacts>(contactds.Tables[0].Rows[0]);

            phone.Text = contactdel.Phone;
            ddlcontactlist.SelectedIndex =
                ddlcontactlist.Items.IndexOf(ddlcontactlist.Items.FindByValue(contactdel.SID));
            nickname.Text = contactdel.NickName;
            qqnum.Text    = contactdel.QQnum.ToString();
            email.Text    = contactdel.Email;
            address.Value = contactdel.Address;
            if (contactdel.IsDefault == 1)
            {
                isyes.Checked = true;
            }
            else
            {
                isno.Checked = true;
            }
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }
        }
Esempio n. 6
0
        protected void uploadbtn_Click(object sender, EventArgs e)
        {
            #region 信息判断
            if (Session["customerID"] == null || Session["customerID"].ToString() == "")
            {
                JQDialog.SetCookies("pageurl", "PubSecHand.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

            Random random    = new Random();
            int    r1        = (int)(random.Next(0, 9));               //产生2个0-9的随机数
            int    r2        = (int)(random.Next(0, 9));
            string now       = DateTime.Now.ToString("yyMMddhhmmssf"); //一个13位的时间戳
            String paymentID = r1.ToString() + r2.ToString() + now;

            pid                     = "R" + paymentID;
            productModel.ID         = pid;
            productModel.IsSecHand  = ishand;
            productModel.Pstate     = 0;
            productModel.Review     = 1;
            productModel.CustomerID = Session["customerID"].ToString();
            MSProductDAL      productDal   = new MSProductDAL();
            MSShopContacts    contactModel = new MSShopContacts();
            MSShopContactsDAL contactDal   = new MSShopContactsDAL();
            contactModel.ID       = Guid.NewGuid().ToString("N").ToUpper();
            contactModel.PID      = pid;
            contactModel.IsDel    = 0;
            contactModel.SID      = "";
            contactModel.NickName = UserName.Value;
            contactModel.Phone    = UserPhone.Value;
            string pageurl = "NewProduct.aspx?ishand=" + ishand;
            if (productDal.AddMSProduct(productModel) && SaveImages() && contactDal.AddMSSContacts(contactModel))
            {
                if (ishand == 1)
                {
                    pageurl = "MySecHand.aspx";
                }
                errorscript = JQDialog.alertOKMsgBox(5, "操作成功!", pageurl, "succeed");
            }
            else
            {
                errorscript = JQDialog.alertOKMsgBox(3, "操作失败<br/>请核对后再操作!", "", "error");
                return;
            }
        }
        void GetProductDetail()
        {
            string ptitle    = string.Empty;
            string shopID    = string.Empty;
            string puid      = string.Empty;
            int    paracount = 0;

            #region 产品详细
            MSProductDAL productDal   = new MSProductDAL();
            MSProduct    productModel = new MSProduct();
            DataSet      productds    = productDal.GetProductDetail(strpid);
            if (null != productds && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0)
            {
                productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]);
                ptitle       = productModel.Ptitle;
                puid         = productModel.CustomerID;
                if (productModel.SID != null && productModel.SID != "")
                {
                    shopID = productModel.SID;
                }
            }
            #endregion
            #region 店铺详细
            MSShop shopModel = new MSShop();
            if (shopID != null && shopID != "")
            {
                MSShopDAL shopDal = new MSShopDAL();
                DataSet   shopds  = shopDal.GetMSShopDetail(shopID);
                if (shopds != null && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0)
                {
                    shopModel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]);
                }
            }
            #endregion
            #region 图集列表
            MSProductAtlasDAL     atlasDal       = new MSProductAtlasDAL();
            List <MSProductAtlas> AtlasListModel = new List <MSProductAtlas>();
            DataSet atlasds = atlasDal.GetProductAtlasByPID(strpid);
            if (null != atlasds && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in atlasds.Tables[0].Rows)
                {
                    MSProductAtlas atlasModel = DataConvert.DataRowToModel <MSProductAtlas>(row);
                    AtlasListModel.Add(atlasModel);
                }
            }
            #endregion
            #region 产品参数列表
            //MSProductParaDAL paraDal = new MSProductParaDAL();
            //DataSet paramds = paraDal.GetProductParamByPID(strpid);
            //string paramlist = string.Empty;
            //if (null != paramds && paramds.Tables.Count > 0 && paramds.Tables[0].Rows.Count > 0)
            //{
            //    for (int i = 0; i < paramds.Tables[0].Rows.Count; i++)
            //    {
            //        paramlist += "<tr>\r\n";
            //        string paraname = paramds.Tables[0].Rows[i]["ParName"].ToString();
            //        string paravalue = paramds.Tables[0].Rows[i]["ParValue"].ToString();
            //        paramlist += "<td class=\"td_title\">" + paraname + "</td><td>" + paravalue + "</td>\r\n";
            //        try
            //        {
            //            i = i + 1;
            //            paraname = paramds.Tables[0].Rows[i]["ParName"].ToString();
            //            paravalue = paramds.Tables[0].Rows[i]["ParValue"].ToString();
            //            paramlist += "<td class=\"td_title\">" + paraname + "</td><td>" + paravalue + "</td>\r\n";
            //        }
            //        catch (Exception)
            //        {
            //            paramlist += "<td class=\"td_title\">&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td>\r\n";
            //        }
            //        paramlist += "</tr>\r\n";
            //    }
            //}
            #endregion
            #region -------获取产品型号及价格------------
            ProductPara          ParaModel     = new ProductPara();
            List <MSProductPara> paralistmodel = new List <MSProductPara>();
            MSProductParaDAL     paraDal       = new MSProductParaDAL();
            DataSet parads = paraDal.GetMaxMinPrice(strpid);
            if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0)
            {
                paracount = parads.Tables[0].Rows.Count;
                ParaModel = DataConvert.DataRowToModel <ProductPara>(parads.Tables[0].Rows[0]);
            }
            parads = null;
            parads = paraDal.GetProductParamByPID(strpid);
            if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow item in parads.Tables[0].Rows)
                {
                    MSProductPara paramodel = DataConvert.DataRowToModel <MSProductPara>(item);
                    paralistmodel.Add(paramodel);
                }
            }
            #endregion

            #region ----------------根据产品编号获取联系方式--------------------
            MSShopContactsDAL contactDal   = new MSShopContactsDAL();
            MSShopContacts    contactModel = new MSShopContacts();
            DataSet           contactDs    = contactDal.GetContactDetailByPID(strpid);

            MSCustomersDAL CustomerDal = new MSCustomersDAL();
            MSCustomers    CustomerModel = new MSCustomers();
            DataSet        PuidDs = null; int contactcount = 0;

            if (contactDs != null && contactDs.Tables.Count > 0 && contactDs.Tables[0].Rows.Count > 0)
            {
                contactModel = DataConvert.DataRowToModel <MSShopContacts>(contactDs.Tables[0].Rows[0]);
                contactcount = 1;
            }
            else
            {
                if (puid != null && puid != "")
                {
                    PuidDs = CustomerDal.GetCustomerDetail(puid);
                }
                if (PuidDs != null && PuidDs.Tables.Count > 0 && PuidDs.Tables[0].Rows.Count > 0)
                {
                    CustomerModel = DataConvert.DataRowToModel <MSCustomers>(PuidDs.Tables[0].Rows[0]);
                }
            }
            #endregion
            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/Product_detail.html"));
            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            context.TempData["title"] = ptitle;
            if (shopModel != null)
            {
                context.TempData["shopdetail"] = shopModel;
            }
            context.TempData["productdetail"] = productModel;
            context.TempData["atlaslist"]     = AtlasListModel;
            if (contactcount > 0)
            {
                context.TempData["contactdetail"] = contactModel;
            }
            else
            {
                context.TempData["contactdetail"] = CustomerModel;
            }
            context.TempData["customid"] = customid;
            //context.TempData["paramlist"] = paramlist;
            context.TempData["paracount"]   = paracount;
            context.TempData["paramodel"]   = ParaModel;
            context.TempData["paralist"]    = paralistmodel;
            context.TempData["footer"]      = "奥琦微商易";
            context.TempData["errorscript"] = errorscript;

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
        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;
            }
        }