Beispiel #1
0
        void showdetailinfo()
        {
            MSCustomersDAL CustomerDal   = new MSCustomersDAL();
            DataSet        ds            = CustomerDal.GetCustomerDetail(strID);
            MSCustomers    CustomerModel = DataConvert.DataRowToModel <MSCustomers>(ds.Tables[0].Rows[0]);

            phone.Text       = CustomerModel.Phone;
            hd_content.Value = CustomerModel.Pnote;
            NickName.Text    = CustomerModel.NickName;
            email.Text       = CustomerModel.Email;
            QQnum.Text       = CustomerModel.QQnum;
            if (CustomerModel.HeadImg != null && CustomerModel.HeadImg != "")
            {
                img0.Src = "../../PalmShop/ShopCode/" + CustomerModel.HeadImg;
                oldimg   = CustomerModel.HeadImg;
            }
            if (CustomerModel.Sex == 0)
            {
                isstateyes.Checked = true;
            }
            else
            {
                isstateno.Checked = true;
            }
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }
        }
        /// <summary>
        /// 客户信息更改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateCustomers(MSCustomers model)
        {
            string safeslq = "";

            safeslq = "UPDATE MS_Customers SET ";
            if (model.NickName != null && model.NickName != "")
            {
                safeslq += "NickName='" + model.NickName + "',";
            }
            if (model.RealName != null && model.RealName != "")
            {
                safeslq += "RealName='" + model.RealName + "',";
            }
            if (model.IDnum != null && model.IDnum != "")
            {
                safeslq += "IDnum='" + model.IDnum + "',";
            }
            if (model.IDimg != null && model.IDimg != "")
            {
                safeslq += "IDimg='" + model.IDimg + "',";
            }
            if (model.Phone != null && model.Phone != "")
            {
                safeslq += "Phone='" + model.Phone + "',";
            }
            if (model.UserPwd != null && model.UserPwd.ToString() != "")
            {
                safeslq += "UserPwd='" + model.UserPwd + "',";
            }
            if (model.Email != null && model.Email.ToString() != "")
            {
                safeslq += "Email='" + model.Email + "',";
            }
            if (model.QQnum != null && model.QQnum.ToString() != "")
            {
                safeslq += "QQnum='" + model.QQnum + "',";
            }
            if (model.HeadImg != null && model.HeadImg != "")
            {
                safeslq += "HeadImg='" + model.HeadImg + "',";
            }
            if (model.Pnote != null && model.Pnote != "")
            {
                safeslq += "Pnote='" + model.Pnote + "',";
            }
            safeslq += " Sex=" + (model.Sex == 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);
            }
        }
        void GetHtmlPage()
        {
            MSShop      shopModel = new MSShop();
            MSCustomers UserModel = new MSCustomers();

            #region -----------------店铺详情-----------------------
            if (strSID != null && strSID != "")
            {
                MSShopDAL shopDal = new MSShopDAL();
                DataSet   shopds  = shopDal.GetMSShopDetail(strSID);
                if (shopds != null && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0)
                {
                    shopModel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]);
                }
            }
            #endregion
            #region ---------------店铺用户资料详情--------------------
            if (strUid != null && strUid != "")
            {
                MSCustomersDAL UserDal = new MSCustomersDAL();
                DataSet        userds  = UserDal.GetCustomerDetail(strUid);
                if (userds != null && userds.Tables.Count > 0 && userds.Tables[0].Rows.Count > 0)
                {
                    UserModel = DataConvert.DataRowToModel <MSCustomers>(userds.Tables[0].Rows[0]);
                }
            }
            #endregion
            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/ApplyShop.html"));
            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            context.TempData["footer"]      = "奥琦微商易";
            context.TempData["errorscript"] = errorscript;
            context.TempData["shopdetail"]  = shopModel;
            context.TempData["usredetail"]  = UserModel;
            context.TempData["action"]      = action;
            context.TempData["sid"]         = strSID;

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
        /// <summary>
        /// 客户信息添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddCustomers(MSCustomers model)
        {
            string sql = @"INSERT INTO [MS_Customers]
                        ([ID],[OpenID],[NickName],[RealName],[IDnum],[IDimg],[Phone],[UserPwd],[Email],[QQnum],[HeadImg],[Sex],[Pnote],[IsDel],[AddTime])
                 VALUES
                        (@ID,@OpenID,@NickName,@RealName,@IDnum,@IDimg,@Phone,@UserPwd,@Email,@QQnum,@HeadImg,@Sex,@Pnote,@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("@OpenID", model.OpenID),
                new System.Data.SqlClient.SqlParameter("@NickName", model.NickName),
                new System.Data.SqlClient.SqlParameter("@RealName", model.RealName),
                new System.Data.SqlClient.SqlParameter("@IDnum", model.IDnum),
                new System.Data.SqlClient.SqlParameter("@IDimg", model.IDimg),
                new System.Data.SqlClient.SqlParameter("@Phone", model.Phone),
                new System.Data.SqlClient.SqlParameter("@UserPwd", model.UserPwd),
                new System.Data.SqlClient.SqlParameter("@Email", model.Email),
                new System.Data.SqlClient.SqlParameter("@QQnum", model.QQnum),
                new System.Data.SqlClient.SqlParameter("@HeadImg", model.HeadImg),
                new System.Data.SqlClient.SqlParameter("@Sex", (model.Sex == 1?1:0)),
                new System.Data.SqlClient.SqlParameter("@Pnote", model.Pnote),
                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);
            }
        }
 void getTemplate()
 {
     #region --------------获取客户详细-----------------
     MSCustomers    customerModel = new MSCustomers();
     MSCustomersDAL customerDal   = new MSCustomersDAL();
     DataSet        customerDs    = customerDal.GetCustomerDetail(strUid);
     if (null != customerDs && customerDs.Tables.Count > 0 && customerDs.Tables[0].Rows.Count > 0)
     {
         customerModel = DataConvert.DataRowToModel <MSCustomers>(customerDs.Tables[0].Rows[0]);
         if (customerModel.HeadImg != null && customerModel.HeadImg != "")
         {
             oldimgname = customerModel.HeadImg;
         }
     }
     #endregion
     string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/customerinfo.html"));
     JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
     JinianNet.JNTemplate.Template        t       = new JinianNet.JNTemplate.Template(context, text);
     context.TempData["customer"]    = customerModel;
     context.TempData["errorscript"] = errorscript;
     context.TempData["fid"]         = strfid;
     context.TempData["footer"]      = "奥琦微商易";
     t.Render(Response.Output);
 }
        /// <summary>
        /// 用户注册
        /// </summary>
        void ToSaveUserInfo()
        {
            string inputphone = string.Empty; string logpwd = string.Empty;

            if (Request["inputphone"] != null && Request["inputphone"] != "")
            {
                inputphone = Common.Common.NoHtml(Request["inputphone"]);
            }
            if (Request["logpwd"] != null && Request["logpwd"] != "")
            {
                logpwd = Common.Common.NoHtml(Request["logpwd"]);
            }
            if (inputphone.Trim() != null && inputphone.Trim() != "" && logpwd.Trim() != null && logpwd.Trim() != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                if (customerDal.ExistCustomer(strOpenID, inputphone, "", ""))
                {
                    Response.Write("{\"error\":true,\"msg\":\"该用户已经存在\"}");
                }
                else
                {
                    MSCustomers customerModel = new MSCustomers();
                    string      strID         = string.Empty;
                    strID                  = Guid.NewGuid().ToString("N").ToUpper();
                    customerModel.ID       = strID;
                    customerModel.Phone    = inputphone;
                    customerModel.OpenID   = strOpenID;
                    customerModel.NickName = regNickName;
                    customerModel.Sex      = regSex;
                    customerModel.HeadImg  = regHeadImg;
                    customerModel.UserPwd  = Common.Common.MD5(logpwd);
                    customerModel.IsDel    = 0;

                    MSVAcctDetailDAL vacctdetailDal = new MSVAcctDetailDAL();
                    MSVAcctDAL       vacctDal       = new MSVAcctDAL();

                    if (customerDal.AddCustomers(customerModel))
                    {
                        int vcount = 2;
                        if (!vacctDal.ExistMSVAcct(strID, ""))
                        {
                            MSVAcct vaccModel = new MSVAcct();
                            vaccModel.CustID   = strID;
                            vaccModel.SiteCode = "VYIGO";
                            vaccModel.V_Amont  = vcount;
                            MSVAcctDetail vaccDetailModel = new MSVAcctDetail();
                            vaccDetailModel.Amount     = vcount;
                            vaccDetailModel.ChargeType = "注册";
                            vaccDetailModel.CustID     = strID;
                            vaccDetailModel.Ext_Fld1   = "";
                            vaccDetailModel.IsReceive  = 1;
                            vaccDetailModel.SiteCode   = "VYIGO";
                            //vacctDal.AddMSVAcct(vaccModel);
                            //vacctdetailDal.AddMSVAcctDetail(vaccDetailModel);
                        }
                        Response.Write("{\"success\":true,\"msg\":\"操作成功\"}");
                    }
                    else
                    {
                        Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}");
                    }
                }
            }
            Response.End();
        }
        void editeCustomerinfo()
        {
            string nickname = string.Empty; string modelimgurl = string.Empty;

            try
            {
                nickname = HttpContext.Current.Request.Form.Get("nickname").ToString();
            }
            catch (Exception)
            {
                nickname = "";
            }
            MSCustomers    customerModel = new MSCustomers();
            MSCustomersDAL customerDal   = new MSCustomersDAL();

            customerModel.ID = strUid;
            if (nickname != null && nickname != "")
            {
                #region -----------------头像上传-------------------
                HttpFileCollection files = HttpContext.Current.Request.Files;
                if (files.Count > 0)
                {
                    //检查文件扩展名字
                    HttpPostedFile postedFile = files[0];
                    string         fileName, fileExtension, file_oldid, file_id;
                    //取出精确到毫秒的时间做文件的名称
                    string my_file_id = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                    fileName      = System.IO.Path.GetFileName(postedFile.FileName);
                    fileExtension = System.IO.Path.GetExtension(fileName);
                    file_id       = my_file_id + fileExtension;
                    if (fileName != "" && fileName != null && fileName.Length > 0)
                    {
                        fileExtension = System.IO.Path.GetExtension(fileName);
                        string saveurl;
                        modelimgurl = "HeadImg/";
                        saveurl     = "../PalmShop/ShopCode/" + modelimgurl;
                        saveurl     = Server.MapPath(saveurl);
                        if (!Directory.Exists(saveurl))
                        {
                            Directory.CreateDirectory(saveurl);
                        }
                        int length = postedFile.ContentLength;
                        if (length > 512000)
                        {
                            file_oldid = "old" + file_id;
                            postedFile.SaveAs(saveurl + file_oldid);
                            JQDialog.ystp(saveurl + file_oldid, saveurl + file_id, 15);
                            File.Delete(saveurl + file_oldid);
                        }
                        else
                        {
                            postedFile.SaveAs(saveurl + file_id);
                        }
                        modelimgurl = modelimgurl + file_id;
                    }
                }
                #endregion
                customerModel.NickName = nickname;
                if (modelimgurl != null && modelimgurl != "")
                {
                    customerModel.HeadImg = modelimgurl;
                }
                customerModel.IsDel = 0;
                if (customerDal.UpdateCustomers(customerModel))
                {
                    if (modelimgurl != null && modelimgurl != "")
                    {
                        if (oldimgname != null && oldimgname != "")
                        {
                            File.Delete(String.Format(@"{0}PalmShop/ShopCode/{1}",
                                                      Server.MapPath("~"), oldimgname));
                        }
                    }
                    errorscript = JQDialog.alertOKMsgBox(3, "操作成功", "MyTopicList.aspx?fid=" + strfid,
                                                         "succeed");
                }
                else
                {
                    errorscript = JQDialog.alertOKMsgBox(3, "操作失败,请核对后再操作", "Customerinfo.aspx?fid=" + strfid,
                                                         "error");
                }
            }
            else
            {
                errorscript = JQDialog.alertOKMsgBox(3, "操作失败,请核对后再操作",
                                                     "Customerinfo.aspx?fid=" + strfid, "error");
            }
        }
        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);
        }
Beispiel #9
0
        /// <summary>
        /// 获取购物信息
        /// </summary>
        void GetInfo()
        {
            #region 产品详细
            MSProductDAL      productDal       = new MSProductDAL();
            MSProduct         productModel     = new MSProduct();
            DataSet           productds        = productDal.GetProductDetail(strpid);
            MSProductAtlasDAL atlasDal         = new MSProductAtlasDAL();
            MSProductAtlas    atlasdetailmodel = null;
            DataSet           atlasDs          = null;
            if (null != productds && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0)
            {
                productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]);
            }
            #endregion
            #region 获取产品默认展示图
            atlasDs = atlasDal.GetDefaultAtlasByPid(strpid);
            foreach (DataRow atlasrow in atlasDs.Tables[0].Rows)
            {
                atlasdetailmodel = DataConvert.DataRowToModel <MSProductAtlas>(atlasrow);
            }
            #endregion
            #region -----------获取型号尺码----------------
            MSProductPara    paraModel = new MSProductPara();
            MSProductParaDAL paraDal   = new MSProductParaDAL();
            DataSet          parads    = paraDal.GetParaDetail(mid);
            if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0)
            {
                paraModel = DataConvert.DataRowToModel <MSProductPara>(parads.Tables[0].Rows[0]);
            }
            #endregion
            #region 获取收货地址
            MSDeliveryAddressDAL     addressDal     = new MSDeliveryAddressDAL();
            MSDeliveryAddress        defaultadModel = new MSDeliveryAddress();
            List <MSDeliveryAddress> damodellist    = new List <MSDeliveryAddress>();
            string stradwhere = string.Empty;
            stradwhere = "and [UID]='" + customid + "' ";
            DataSet addressds = addressDal.GetDAList(3, stradwhere);
            if (null != addressds && addressds.Tables.Count > 0 && addressds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in addressds.Tables[0].Rows)
                {
                    MSDeliveryAddress damodel = DataConvert.DataRowToModel <MSDeliveryAddress>(row);
                    damodellist.Add(damodel);
                }
            }
            #endregion
            string      customerphone = string.Empty;
            MSCustomers customerModel = new MSCustomers();
            if (customid != null && customid != "")
            {
                MSCustomersDAL CustomerDal = new MSCustomersDAL();
                DataSet        customerds  = CustomerDal.GetCustomerDetail(customid);
                if (customerds != null && customerds.Tables.Count > 0 && customerds.Tables[0].Rows.Count > 0)
                {
                    customerModel = DataConvert.DataRowToModel <MSCustomers>(customerds.Tables[0].Rows[0]);
                }
            }

            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/setOrder.html"));
            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            context.TempData["productdetail"] = productModel;
            context.TempData["atlas"]         = atlasdetailmodel;
            context.TempData["paramodel"]     = paraModel;
            context.TempData["errorscript"]   = errorscript;
            context.TempData["dalist"]        = damodellist;
            context.TempData["customer"]      = customerModel;
            context.TempData["openid"]        = openid;
            context.TempData["footer"]        = "奥琦微商易";

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
Beispiel #10
0
 void getTemplate()
 {
     #region -----------获取客户信息---------
     MSCustomers    CustomerModel = new MSCustomers();
     MSCustomersDAL CustomerDal   = new MSCustomersDAL();
     DataSet        CustomerDs;
     if (strUid != null && strUid != "")
     {
         CustomerDs = CustomerDal.GetCustomerDetail(strUid);
         if (null != CustomerDs && CustomerDs.Tables.Count > 0 && CustomerDs.Tables[0].Rows.Count > 0)
         {
             CustomerModel = DataConvert.DataRowToModel <MSCustomers>(CustomerDs.Tables[0].Rows[0]);
             if (CustomerModel.NickName == null || CustomerModel.NickName == "" ||
                 CustomerModel.NickName.ToLower() == "null")
             {
                 CustomerModel.NickName = "游客";
             }
         }
     }
     #endregion
     #region ----------获取帖子列表----------------
     MSForumTopicDAL       topicDal       = new MSForumTopicDAL();
     List <TopicModelList> topicModellist = new List <TopicModelList>();
     int     topicCount  = 0;
     DataSet topiclistds = topicDal.GetMSForumTopicList(" and a.[UID]='" + strUid + "' ", 0);
     if (topiclistds != null && topiclistds.Tables.Count > 0 && topiclistds.Tables[0].Rows.Count > 0)
     {
         topicCount = topiclistds.Tables[0].Rows.Count;
         foreach (DataRow row in topiclistds.Tables[0].Rows)
         {
             TopicModelList topicmodel = DataConvert.DataRowToModel <TopicModelList>(row);
             if (topicmodel.NickName == null || topicmodel.NickName == "" || topicmodel.NickName.Length < 1)
             {
                 topicmodel.NickName = "游客";
             }
             if (topicmodel.HeadImg == null || topicmodel.HeadImg == "")
             {
                 topicmodel.HeadImg = "images/2.png";
             }
             string msg = topicmodel.TopicDesc;
             msg = JQDialog.GetTextFromHTML(msg);
             if (msg.Length > 250)
             {
                 msg = msg.ToString().Substring(0, 100) + "...";
             }
             topicmodel.TopicDesc = msg;
             topicModellist.Add(topicmodel);
         }
     }
     #endregion
     #region --------------获取喜欢 总数------------------
     int likecount = 0;
     MSForumTopicLoveDAL likeDal = new MSForumTopicLoveDAL();
     try
     {
         likecount = likeDal.GetLoveOrLikeCountByUID(strUid, "tlike");
     }
     catch (Exception)
     {
         likecount = 0;
     }
     #endregion
     #region ------------获取消息总数---------------
     int msgcount = 0;
     MSForumCommentDAL commentDal = new MSForumCommentDAL();
     try
     {
         msgcount = commentDal.GetCommentCountByUID(strUid);
     }
     catch (Exception)
     {
         msgcount = 0;
     }
     #endregion
     string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/othertopiclist.html"));
     JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
     JinianNet.JNTemplate.Template        t       = new JinianNet.JNTemplate.Template(context, text);
     context.TempData["mytopiclist"] = topicModellist;
     context.TempData["topiccount"]  = topicCount;
     context.TempData["customer"]    = CustomerModel;
     context.TempData["fid"]         = strfid;
     context.TempData["likecount"]   = likecount;
     context.TempData["msgcount"]    = msgcount;
     context.TempData["errorscript"] = errorscript;
     context.TempData["uid"]         = strUid;
     context.TempData["myuid"]       = strMyUid;
     context.TempData["footer"]      = "奥琦微商易";
     t.Render(Response.Output);
 }
 public void getTemplate()
 {
     #region -----------获取客户信息---------
     MSCustomers    CustomerModel = new MSCustomers();
     MSCustomersDAL CustomerDal   = new MSCustomersDAL();
     DataSet        CustomerDs;
     if (strUid != null && strUid != "")
     {
         CustomerDs = CustomerDal.GetCustomerDetail(strUid);
         if (null != CustomerDs && CustomerDs.Tables.Count > 0 && CustomerDs.Tables[0].Rows.Count > 0)
         {
             CustomerModel = DataConvert.DataRowToModel <MSCustomers>(CustomerDs.Tables[0].Rows[0]);
             if (CustomerModel.NickName == null || CustomerModel.NickName == "" ||
                 CustomerModel.NickName.ToLower() == "null")
             {
                 CustomerModel.NickName = "游客";
             }
         }
     }
     #endregion
     #region ---------评论列表以及信息回复------------
     List <CommentListGetSet> commentModelList = new List <CommentListGetSet>();
     MSForumCommentDAL        commentDal       = new MSForumCommentDAL();
     DataSet commentDs = commentDal.GetCommentList(" and a.[uid]='" + strUid + "' ");
     DataSet repcommentds;
     List <CommentListGetSet> repcommentModelList = new List <CommentListGetSet>();
     int commentcount = 0;
     if (commentDs != null && commentDs.Tables.Count > 0 && commentDs.Tables[0].Rows.Count > 0)
     {
         foreach (DataRow row in commentDs.Tables[0].Rows)
         {
             CommentListGetSet commentModel = DataConvert.DataRowToModel <CommentListGetSet>(row);
             if (commentModel.NickName == null || commentModel.NickName == "")
             {
                 commentModel.NickName = "游客";
             }
             #region ----------------获取回复信息-----------------------
             string repid = commentModel.ID;
             repcommentds = commentDal.GetRepCommentList(" and a.[uid]='" + strUid + "' and a.UpID='" + repid + "' ");
             if (repcommentds != null && repcommentds.Tables.Count > 0 && repcommentds.Tables[0].Rows.Count > 0)
             {
                 foreach (DataRow reprow in repcommentds.Tables[0].Rows)
                 {
                     CommentListGetSet repcommentModel = DataConvert.DataRowToModel <CommentListGetSet>(reprow);
                     if (repcommentModel.NickName == null || repcommentModel.NickName == "")
                     {
                         repcommentModel.NickName = "游客";
                     }
                     repcommentModelList.Add(repcommentModel);
                 }
             }
             #endregion
             commentModelList.Add(commentModel);
         }
     }
     try
     {
         commentcount = commentDs.Tables[0].Rows.Count;
     }
     catch (Exception)
     {
         commentcount = 0;
     }
     #endregion
     #region --------------获取喜欢 总数------------------
     int likecount = 0;
     MSForumTopicLoveDAL likeDal = new MSForumTopicLoveDAL();
     try
     {
         likecount = likeDal.GetLoveOrLikeCountByUID(strUid, "tlike");
     }
     catch (Exception)
     {
         likecount = 0;
     }
     #endregion
     #region ------------获取消息总数---------------
     int msgcount = 0;
     try
     {
         msgcount = commentDal.GetCommentCountByUID(strUid);
     }
     catch (Exception)
     {
         msgcount = 0;
     }
     #endregion
     #region ---------帖子总数-------------
     int             topiccount = 0;
     MSForumTopicDAL topicdal   = new MSForumTopicDAL();
     try
     {
         topiccount = topicdal.GetTopicCountByUID(strUid);
     }
     catch (Exception)
     {
         topiccount = 0;
     }
     #endregion
     string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/Mycommentlist.html"));
     JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
     JinianNet.JNTemplate.Template        t       = new JinianNet.JNTemplate.Template(context, text);
     context.TempData["customer"]       = CustomerModel;
     context.TempData["commentlist"]    = commentModelList;
     context.TempData["repcommentlist"] = repcommentModelList;
     context.TempData["fid"]            = strfid;
     context.TempData["likecount"]      = likecount;
     context.TempData["msgcount"]       = msgcount;
     context.TempData["topiccount"]     = topiccount;
     context.TempData["errorscript"]    = errorscript;
     context.TempData["uid"]            = strUid;
     context.TempData["footer"]         = "奥琦微商易";
     t.Render(Response.Output);
 }
Beispiel #12
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
            {
                if (phone.Text.Trim() != null && phone.Text.Trim() != "" &&
                    password.Text.Trim() != null && password.Text.Trim() != "" &&
                    NickName.Text.Trim() != null && NickName.Text.Trim() != "")
                {
                    //上传图像
                    string strIconFileName     = string.Empty; //图像路径
                    string strIconSaveFileName = string.Empty; //网址路径
                    try
                    {
                        if (this.file0.PostedFile.FileName == "")
                        {
                            strIconSaveFileName = "";
                        }
                        else
                        {
                            if (!System.IO.Directory.Exists(Server.MapPath("~") + @"/PalmShop"))
                            {
                                System.IO.Directory.CreateDirectory(Server.MapPath("~") + @"/PalmShop");
                            }
                            if (!System.IO.Directory.Exists(String.Format(@"{0}/PalmShop/ShopCode/HeadImg/{1}", Server.MapPath("~"), phone.Text)))
                            {
                                System.IO.Directory.CreateDirectory(String.Format(@"{0}/PalmShop/ShopCode/HeadImg/{1}", Server.MapPath("~"), phone.Text));
                            }
                            string orignalName = this.file0.PostedFile.FileName;                      //获取客户机上传文件的文件名
                            string extendName  = orignalName.Substring(orignalName.LastIndexOf(".")); //获取扩展名

                            if (extendName != ".gif" && extendName != ".jpg" && extendName != ".jpeg" && extendName != ".png")
                            {
                                MessageBox.Show(this, "文件格式有误!");
                                return;
                            }//检查文件格式
                            string newName = String.Format("{0}_{1}{2}", DateTime.Now.Millisecond, file0.PostedFile.ContentLength, extendName);//对文件进行重命名
                            strIconFileName     = String.Format(@"{0}PalmShop/ShopCode/HeadImg/{1}/{2}", Server.MapPath("~"), phone.Text, newName);
                            strIconSaveFileName = String.Format(@"HeadImg/{0}/{1}", phone.Text, newName);
                            file0.PostedFile.SaveAs(strIconFileName);
                            if (oldimg.Trim() != null && oldimg.Trim() != "" && oldimg.Trim().ToLower() != "shoplogo/default.png")
                            {
                                System.IO.File.Delete(String.Format(@"{0}PalmShop/ShopCode/{1}", Server.MapPath("~"), oldimg));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, "上传发生错误!原因是:" + ex.ToString());
                    }
                    MSCustomersDAL CustomerDal   = new MSCustomersDAL();
                    MSCustomers    CustomerModel = new MSCustomers();
                    CustomerModel.Phone    = phone.Text;
                    CustomerModel.NickName = NickName.Text;
                    CustomerModel.Pnote    = hd_content.Value;
                    CustomerModel.Email    = email.Text;
                    CustomerModel.QQnum    = QQnum.Text;
                    CustomerModel.Sex      = isstateyes.Checked ? 0 : 1;
                    CustomerModel.UserPwd  = Common.Common.MD5(password.Text);
                    CustomerModel.IsDel    = 0;
                    CustomerModel.ID       = strID;
                    if (strIconSaveFileName.Trim() != null && strIconSaveFileName.Trim() != "")
                    {
                        CustomerModel.HeadImg = strIconSaveFileName;
                    }
                    if (CustomerDal.UpdateCustomers(CustomerModel))
                    {
                        MessageBox.Show(this, "操作成功!");
                    }
                    else
                    {
                        MessageBox.Show(this, "操作失败!");
                    }
                }
                else
                {
                    MessageBox.Show(this, "请输入相应店铺名称或电话!");
                }
            }
            else
            {
                return;
            }
        }