コード例 #1
0
 public static string Getcomlogobyproid(int proid)
 {
     if (proid == 0)
     {
         return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
     }
     else
     {
         B2b_com_pro pro = new B2bComProData().GetProById(proid.ToString());
         if (pro != null)
         {
             B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(pro.Com_id.ToString());
             if (saleset != null)
             {
                 if (saleset.Smalllogo != null && saleset.Smalllogo != "")
                 {
                     return(JsonConvert.SerializeObject(new { type = 100, msg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0)) }));
                 }
                 else
                 {
                     return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
                 }
             }
             else
             {
                 return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
             }
         }
         else
         {
             return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
         }
     }
 }
コード例 #2
0
        private void ShowImgBind()
        {
            //var comid = Context.Request["comid"].ConvertTo<int>(0);
            var comid = UserHelper.CurrentCompany.ID;

            //根据公司id得到 直销设置
            B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

            if (saleset != null)
            {
                FileUploadModel identityFileUpload = new FileUploadData().GetFileById(saleset.Logo.ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    headPortraitImgSrc = identityFileUpload.Relativepath;
                }


                if (saleset.Smalllogo == null || saleset.Smalllogo == "" || saleset.Smalllogo == "0")
                {
                }
                else
                {
                    FileUploadModel smallidentityFileUpload = new FileUploadData().GetFileById(saleset.Smalllogo.ConvertTo <int>(0));
                    if (smallidentityFileUpload != null)
                    {
                        smallheadPortraitImgSrc = smallidentityFileUpload.Relativepath;
                    }
                }
            }
        }
コード例 #3
0
ファイル: Order.Master.cs プロジェクト: radtek/etowncode
        protected void Page_Load(object sender, EventArgs e)
        {
            Request.ValidateInput();

            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
                if (comid != 0)
                {
                    comName = B2bCompanyData.GetCompany(comid).Com_name;

                    B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                }
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                    if (comid != 0)
                    {
                        //comName = B2bCompanyData.GetCompany(comid).Com_name;
                    }
                }
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            orderid = Request["orderid"].ConvertTo <int>(0);
            string dikou = Request["dikou"].ConvertTo <string>("");

            if (dikou == "OK")
            {
                title = "订单支付 成功!";
            }
            else
            {
                title = dikou;
            }
            if (orderid != 0)
            {
                B2b_order orderdate = new B2bOrderData().GetOrderById(orderid);
                if (orderdate != null)
                {
                    var saleset = B2bCompanySaleSetData.GetDirectSellByComid(orderdate.Comid.ToString());
                    if (saleset != null)
                    {
                        phone = saleset.Service_Phone;
                    }
                }
            }
        }
コード例 #5
0
ファイル: Default.aspx.cs プロジェクト: radtek/etowncode
        protected void Page_Load(object sender, EventArgs e)
        {
            //string u = Request.ServerVariables["HTTP_USER_AGENT"];
            //bool bo = detectmobilebrowser.HttpUserAgent(u);
            bool bo = true;

            string RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();

            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }
            if (comid != 0)
            {
                //根据公司id得到公司logo地址和公司名称
                comname = B2bCompanyData.GetCompany(comid).Com_name;
                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    comlogo = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0));
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");

                if (weixincode != "")
                {
                    int questtype = 2;//1=微信授权验证
                    DealUserinfo1("", weixincode, comid, questtype);
                }
                else
                {
                    string openid     = Request["openid"].ConvertTo <string>("");
                    string weixinpass = Request["weixinpass"].ConvertTo <string>("");
                    int    questtype  = 1;                               //1=一次性密码验证
                    DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
                }

                B2bModelData mdate = new B2bModelData();
                //判断模板,进行跳转
                var h5model = mdate.SelectModelSearchComid(comid);
                if (h5model != null)
                {
                    if (h5model.Modelid != 1)
                    {
                        Response.Redirect("/h5/Default" + h5model.Modelid + ".aspx");
                    }
                }
            }
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            come = Request["come"].ConvertTo <string>("");

            string RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();

            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }
            if (comid != 0)
            {
                //根据公司id得到公司logo地址和公司名称

                var commodel = B2bCompanyData.GetCompany(comid);
                if (commodel != null)
                {
                    title       = commodel.Com_name;
                    CompanyName = commodel.Com_name;
                }

                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }
            }



            //获取微信平台端code
            string weixincode = Request["code"].ConvertTo <string>("");

            if (weixincode != "")
            {
                int questtype = 2;//1=微信授权验证
                DealUserinfo1("", weixincode, comid, questtype);
            }
            else
            {
                string openid     = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");
                int    questtype  = 1;                               //1=一次性密码验证
                DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
            }
        }
コード例 #7
0
        public void GetComLogo(int comid)
        {
            //根据公司id得到公司logo地址
            B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

            if (pro != null)
            {
                gongsilogo = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0));
            }
        }
コード例 #8
0
 public static string GetDirectSellByComid(string comid)
 {
     try
     {
         B2b_company_saleset com = B2bCompanySaleSetData.GetDirectSellByComid(comid);
         return(JsonConvert.SerializeObject(new { type = 100, msg = com }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));
     }
 }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }

                if (comid != 0)
                {
                    comName = B2bCompanyData.GetCompany(comid).Com_name;

                    B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                }
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                    if (comid != 0)
                    {
                        comName = B2bCompanyData.GetCompany(comid).Com_name;
                    }
                }
            }

            if (comid != 0)
            {
                B2b_company companyinfo = B2bCompanyData.GetCompany(comid);
                if (companyinfo != null)
                {
                    comName = companyinfo.Com_name;
                    if (comName.Length >= 9)
                    {
                        comName = comName.Substring(0, 9) + "..";
                    }
                }

                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    phone = saleset.Service_Phone;
                }
            }
        }
コード例 #10
0
ファイル: ProDefault.aspx.cs プロジェクト: radtek/etowncode
        protected void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            #region 限制手机端访问
            //if (bo == false)
            //{
            //    if (comid == 101)
            //    {
            //        Response.Redirect("http://vctrip.etown.cn/");
            //    }
            //    Response.Redirect("http://shop" + comid + ".etown.cn");
            //}
            #endregion

            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
                if (comid != 0)
                {
                    title = B2bCompanyData.GetCompany(comid).Com_name;

                    B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                    if (pro != null)
                    {
                        if (pro.Smalllogo != null && pro.Smalllogo != "")
                        {
                            comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                        }
                    }

                    //获取微信平台端code
                    string weixincode = Request["code"].ConvertTo <string>("");
                    //获取微信号和一次性密码
                    openid = Request["openid"].ConvertTo <string>("");
                    string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                    //获得会员信息
                    GetCrmInfo(weixincode, openid, weixinpass);
                }
            }
        }
コード例 #11
0
ファイル: Default.aspx.cs プロジェクト: radtek/etowncode
        protected void Page_Load(object sender, EventArgs e)
        {
            comid = Request["comid"].ConvertTo <int>(0);


            if (comid == 0)                                 //shop101标准格式获取comid
            {
                if (Domain_def.Domain_yanzheng(RequestUrl)) //如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
                {
                    //先通过正则表达式获取COMid
                    comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                }
            }

            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }


            if (comid != 0)
            {
                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    company = commodel.Com_name;
                    if (commodel.B2bcompanyinfo != null)
                    {
                        tel = commodel.B2bcompanyinfo.Tel;
                    }
                }


                var comtDirect = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (comtDirect != null)
                {
                    if (comtDirect.Smalllogo != null && comtDirect.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(comtDirect.Smalllogo.ConvertTo <int>(0));
                    }
                }
            }
        }
コード例 #12
0
        public static string Updatesms(B2b_company_saleset saleset)
        {
            try
            {
                var saledata = new B2bCompanySaleSetData();
                var crmid    = saledata.Updatesms(saleset);

                return(JsonConvert.SerializeObject(new { type = 100, msg = crmid }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {  //获取访问的域名
            RequestDomin = Request.ServerVariables["SERVER_NAME"].ToLower();
            Requestfile  = Request.ServerVariables["Url"].ToLower();

            //通过域名查询商户号
            B2b_company_info companyinfo = B2bCompanyData.AdminDomainGetComId(RequestDomin);

            if (companyinfo != null)
            {
                comid = companyinfo.Com_id;
            }


            B2b_company         com        = B2bCompanyData.GetAllComMsg(comid);
            B2b_company_saleset comsetinfo = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

            if (com != null)
            {
                Com_name     = com.Com_name;
                Scenic_name  = com.Scenic_name;
                Scenic_intro = com.B2bcompanyinfo.Scenic_intro;

                if (comsetinfo != null)
                {
                    Logourl = comsetinfo.Logo;
                    if (Logourl != "")
                    {
                        Logourl = "<img src=\"" + FileSerivce.GetImgUrl(Logourl.ConvertTo <int>(0)) + "\" alt=\"" + Scenic_name + "\" height=\"80\" />";
                    }

                    Service_Phone = comsetinfo.Service_Phone;
                    if (Service_Phone != "")
                    {
                        Service_Phone = "客服电话:" + Service_Phone;
                    }

                    Copyright = comsetinfo.Copyright;
                }
            }
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comid = Request["comid"].ConvertTo <int>(0);
            if (comid > 0)
            {
                B2b_company company = new B2bCompanyData().GetCompanyBasicById(comid);
                //判断公司是否含有项目,不含有的话,添加默认项目
                int count = new B2b_com_projectData().GetProjectCountByComId(company.ID);
                if (count == 0)
                {
                    B2b_company_info    companyinfo = new B2bCompanyInfoData().GetCompanyInfo(company.ID);
                    B2b_company_saleset saleset     = B2bCompanySaleSetData.GetDirectSellByComid(company.ID.ToString());

                    B2b_com_project model = new B2b_com_project()
                    {
                        Id               = 0,
                        Projectname      = company.Com_name,
                        Projectimg       = saleset.Logo.ConvertTo <int>(0),
                        Province         = companyinfo.Province.ConvertTo <string>(""),
                        City             = companyinfo.City,
                        Industryid       = company.Com_type,
                        Briefintroduce   = companyinfo.Scenic_intro,
                        Address          = companyinfo.Scenic_address,
                        Mobile           = companyinfo.Tel,
                        Coordinate       = "",
                        Serviceintroduce = companyinfo.Serviceinfo,
                        Onlinestate      = "1",
                        Comid            = company.ID,
                        Createtime       = DateTime.Now,
                        Createuserid     = 0
                    };
                    int result = new B2b_com_projectData().EditProject(model);

                    //设置公司下产品的项目id都改为默认项目id
                    int result2 = new B2bComProData().UpProjectId(company.ID.ToString(), result);
                }
            }
        }
コード例 #15
0
ファイル: evaluate.aspx.cs プロジェクト: radtek/etowncode
        protected void Page_Load(object sender, EventArgs e)
        {
            evatype   = Request["evatype"].ConvertTo <int>(0);
            channelid = Request["channelid"].ConvertTo <int>(0);

            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            //根据域名读取商户ID,如果没有绑定域名直接跳转后台
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }

            if (comid != 0)
            {
                title = B2bCompanyData.GetCompany(comid).Com_name;
                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

                if (pro != null)
                {
                    logoimg = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0));
                }
            }
        }
コード例 #16
0
        private void GetUser()
        {
            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "004");

            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            atypee  = user.Atype;
            userid  = user.Id;
            comid   = company.ID;
            comname = company.Com_name;



            //根据comid得到公司logo信息
            B2b_company_saleset logoset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

            if (logoset != null)
            {
                int logo_temp = 0;

                if (logoset.Logo != "")
                {
                    logo_temp = int.Parse(logoset.Logo);
                }

                FileUploadModel identityFileUpload = new FileUploadData().GetFileById(logo_temp);
                if (identityFileUpload != null)
                {
                    comlogo = fileUrl + identityFileUpload.Relativepath;
                }
            }
            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "005");

            username = user.Accounts;
            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid);

            if (companyinfo.B2bcompanyinfo.Domainname != "")
            {
                companydo = "http://" + companyinfo.B2bcompanyinfo.Domainname;
            }
            else
            {
                companydo = "http://shop" + company.ID + ".etown.cn";
            }

            //根据userid得到用户信息,如果用户没有渠道公司的分配,则显示全部门市
            B2b_company_manageuser muser = B2bCompanyManagerUserData.GetUser(UserHelper.CurrentUserId());

            if (muser != null)
            {
                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "006");
                Sys_Group gg = new Sys_GroupData().GetGroupByUserId(muser.Id);
                if (gg == null)
                {
                    //Response.Write("<script>alert('用户尚未分配角色,请联系管理员!');location.href='/Manage/index1.html'</script>");
                }
                else
                {
                    iscanverify = gg.Iscanverify;
                    groupname   = gg.Groupname;
                    groupid     = gg.Groupid;
                }
            }
        }
コード例 #17
0
        public int viewtop        = 1; //头部及左侧相关显示控制
        protected void Page_Load(object sender, EventArgs e)
        {
            Request.ValidateInput();


            if (Session["AccountId"] != null)
            {
                AccountId   = Session["AccountId"].ToString();
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                Today       = DateTime.Now.ToString("yyyy-MM-dd");
            }

            comid      = Request["comid"].ConvertTo <int>(0);
            proid      = Request["proid"].ConvertTo <string>("");
            orderid    = Request["orderid"].ConvertTo <int>(0);
            ordertype  = Request["ordertype"].ConvertTo <string>("1");
            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();

            if (orderid != 0)
            {
                B2bOrderData dataorder     = new B2bOrderData();
                B2b_order    modelb2border = dataorder.GetOrderById(orderid);
                if (modelb2border != null)
                {
                    proid = modelb2border.Pro_id.ToString();
                }
            }

            if (proid != "")
            {
                B2b_com_pro pro = new B2bComProData().GetProById(proid);
                if (pro != null)
                {
                    //如果是 云顶旅游大巴的 不显示头部
                    if (pro.Projectid == 2179)
                    {
                        viewtop     = 0;
                        Scenic_name = pro.Pro_name;
                        Com_name    = pro.Pro_name;
                    }

                    //绿野 不显示头部
                    if (pro.Com_id == 2553)
                    {
                        viewtop = 0;
                    }
                }
            }


            //根据域名读取商户ID,如果没有绑定域名直接跳转后台
            B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);

            if (companyinfo != null)
            {
                comid = companyinfo.Com_id;
            }
            else
            {
                //判定是否为自助域名规则安 shop1.etown.cn
                if (Domain_def.Domain_yanzheng(RequestUrl))
                {
                    comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                }
            }

            //判断商户ID(域名未绑定)
            if (comid != 0)
            {
                B2b_company         com        = B2bCompanyData.GetAllComMsg(comid);
                B2b_company_saleset comsetinfo = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (com != null)
                {
                    if (Com_name == "")
                    {
                        Com_name = com.Com_name;
                    }
                    if (Scenic_name == "")
                    {
                        Scenic_name = com.Scenic_name;
                    }
                    Scenic_intro = com.B2bcompanyinfo.Scenic_intro;

                    if (comsetinfo != null)
                    {
                        Logourl = comsetinfo.Logo;
                        if (Logourl != "")
                        {
                            FileUploadModel url = new FileUploadData().GetFileById(int.Parse(Logourl));
                            if (url != null)
                            {
                                Logourl = "<img src=\"" + fileUrl + url.Relativepath + "\" alt=\"" + Scenic_name + "\" height=\"24\" />";
                            }
                        }

                        Service_Phone = comsetinfo.Service_Phone;
                        if (Service_Phone != "")
                        {
                            Service_Phone = "客服电话:" + Service_Phone;
                        }

                        Copyright = comsetinfo.Copyright;
                    }
                }
            }
            else
            {
                //如果没有商户ID(域名未绑定) 则跳转管理登陆页面。
                // Response.Redirect("/Manage/index1.html");
            }
        }
コード例 #18
0
        public string comlogo = ""; //公司logo地址

        protected void Page_Load(object sender, EventArgs e)
        {
            comid      = Request["comid"].ConvertTo <int>(0);
            openid     = Request["openid"].ConvertTo <string>("");
            weixinpass = Request["weixinpass"].ConvertTo <string>("");

            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }
            if (comid != 0)
            {
                //根据公司id得到公司logo地址和公司名称
                comname = B2bCompanyData.GetCompany(comid).Com_name;
                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    comlogo = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0));
                }
            }


            if (openid != null && openid != "")
            {
                //只要传递过来微信ID 直接SESSION
                Session["Openid"] = openid;
            }



            //判断登陆状态
            if (Session["AccountId"] != null)
            {//先判断Session
                AccountId   = Session["AccountId"].ToString();
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                Today       = DateTime.Now.ToString("yyyy-MM-dd");

                B2bCrmData dateuser = new B2bCrmData();
                dateuser.WeixinConPass(openid, comid);//只要包含SESSION登陆成功,清空微信密码
            }
            else
            {//再判断COOKIES
                if (Request.Cookies["AccountId"] != null && Request.Cookies["AccountKey"] != null)
                {
                    AccountId = Request.Cookies["AccountId"].Value;
                    string  accountmd5 = Request.Cookies["AccountKey"].Value;
                    B2b_crm userinfo;

                    var data = CrmMemberJsonData.WeixinCookieLogin(AccountId, accountmd5, comid, out userinfo);
                    if (data == "OK")
                    {
                        Session["AccountId"]   = userinfo.Id;
                        Session["AccountName"] = userinfo.Name;
                        Session["AccountCard"] = userinfo.Idcard;

                        HttpCookie cookie = new HttpCookie("AccountId", userinfo.Id.ToString());     //实例化HttpCookie类并添加值
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                        cookie         = new HttpCookie("AccountName", userinfo.Name.ToString()); //实例化HttpCookie类并添加值
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                        var returnmd5 = EncryptionHelper.ToMD5(userinfo.Idcard.ToString() + userinfo.Id.ToString(), "UTF-8");
                        cookie         = new HttpCookie("AccountKey", returnmd5); //实例化HttpCookie类并添加值
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                        Response.Redirect(Request.Url.ToString()); //登陆成功,刷新页面
                    }
                    else
                    {
                        //如果微信ID,递实现自动登陆
                        if (openid != null && openid != "" && weixinpass != "" && weixinpass != null)
                        {
                            //只要传递过来微信ID 直接SESSION
                            Session["Openid"] = openid;

                            B2bCrmData dateuser = new B2bCrmData();

                            data = CrmMemberJsonData.WeixinLogin(openid, weixinpass, comid, out userinfo);

                            if (data == "OK")
                            {
                                dateuser.WeixinConPass(openid, comid);//登陆成功,清空微信密码
                                Session["AccountId"]   = userinfo.Id;
                                Session["AccountName"] = userinfo.Name;
                                Session["AccountCard"] = userinfo.Idcard;

                                HttpCookie cookie = new HttpCookie("AccountId", userinfo.Id.ToString());     //实例化HttpCookie类并添加值
                                cookie.Expires = DateTime.Now.AddDays(120);
                                Response.Cookies.Add(cookie);
                                cookie         = new HttpCookie("AccountName", userinfo.Name.ToString()); //实例化HttpCookie类并添加值
                                cookie.Expires = DateTime.Now.AddDays(120);
                                Response.Cookies.Add(cookie);
                                var returnmd5 = EncryptionHelper.ToMD5(userinfo.Idcard.ToString() + userinfo.Id.ToString(), "UTF-8");
                                cookie         = new HttpCookie("AccountKey", returnmd5); //实例化HttpCookie类并添加值
                                cookie.Expires = DateTime.Now.AddDays(120);
                                Response.Cookies.Add(cookie);
                                Response.Redirect(Request.Url.ToString());
                            }
                        }
                    }
                }
                else
                {  //最后判断传递过来的微信一次性密码
                    //如果微信ID,递实现自动登陆
                    if (openid != null && openid != "" && weixinpass != "" && weixinpass != null)
                    {
                        //只要传递过来微信ID 直接SESSION
                        Session["Openid"] = openid;

                        B2bCrmData dateuser = new B2bCrmData();

                        B2b_crm userinfo = new B2b_crm();
                        var     data     = CrmMemberJsonData.WeixinLogin(openid, weixinpass, comid, out userinfo);

                        if (data == "OK")
                        {
                            dateuser.WeixinConPass(openid, comid);//登陆成功,清空微信密码
                            Session["AccountId"]   = userinfo.Id;
                            Session["AccountName"] = userinfo.Name;
                            Session["AccountCard"] = userinfo.Idcard;

                            HttpCookie cookie = new HttpCookie("AccountId", userinfo.Id.ToString());     //实例化HttpCookie类并添加值
                            cookie.Expires = DateTime.Now.AddDays(120);
                            Response.Cookies.Add(cookie);
                            cookie         = new HttpCookie("AccountName", userinfo.Name.ToString()); //实例化HttpCookie类并添加值
                            cookie.Expires = DateTime.Now.AddDays(120);
                            Response.Cookies.Add(cookie);
                            var returnmd5 = EncryptionHelper.ToMD5(userinfo.Idcard.ToString() + userinfo.Id.ToString(), "UTF-8");
                            cookie         = new HttpCookie("AccountKey", returnmd5); //实例化HttpCookie类并添加值
                            cookie.Expires = DateTime.Now.AddDays(120);
                            Response.Cookies.Add(cookie);
                            Response.Redirect(Request.Url.ToString());
                        }
                    }
                }
            }
        }
コード例 #19
0
ファイル: payment.aspx.cs プロジェクト: radtek/etowncode
        public string pricedetail = "";        //价格详情(暂时只有用来描述旅游)
        protected void Page_Load(object sender, EventArgs e)
        {
            //RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            if (Request.QueryString["code"] != null)
            {
                #region 获取用户openid
                code = Request.QueryString["code"];
                string url =
                    string.Format(
                        "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code",
                        appId, appsecret, code);
                string returnStr = HttpUtil.Send("", url);

                var obj = JsonConvert.DeserializeObject <ModelOpenID>(returnStr);

                url = string.Format(
                    "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={0}&grant_type=refresh_token&refresh_token={1}",
                    appId, obj.refresh_token);
                returnStr = HttpUtil.Send("", url);
                obj       = JsonConvert.DeserializeObject <ModelOpenID>(returnStr);

                WriteFile(Server.MapPath("") + "\\Log.txt", obj.access_token);
                WriteFile(Server.MapPath("") + "\\Log.txt", obj.openid);

                //url = string.Format(
                //    "https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}",
                //    obj.access_token, obj.openid);
                //returnStr = HttpUtil.Send("", url);
                //WriteFile(Server.MapPath("") + "\\Log.txt", returnStr);
                #endregion
                ///////////////////////////////////////////////////////////////////////////////////////////////

                orderid = Request["orderid"].ConvertTo <int>(0);
                if (orderid != 0)
                {
                    //根据订单id得到订单信息
                    B2bOrderData dataorder     = new B2bOrderData();
                    B2b_order    modelb2border = dataorder.GetOrderById(orderid);

                    //根据产品id得到产品信息
                    B2bComProData datapro     = new B2bComProData();
                    B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString());

                    if (modelb2border != null && modelcompro != null)
                    {
                        #region    务类型订单金额
                        servertype = modelcompro.Server_type;
                        //如果服务类型是“酒店客房”,则根据酒店扩展订单表中房态信息,获取支付金额
                        if (modelcompro.Server_type == 9)
                        {
                            B2b_order_hotel hotelorder = new B2b_order_hotelData().GetHotelOrderByOrderId(orderid);
                            if (hotelorder != null)
                            {
                                string   fangtai    = hotelorder.Fangtai;
                                DateTime start_data = hotelorder.Start_date;
                                DateTime end_data   = hotelorder.End_date;
                                int      bookdaynum = hotelorder.Bookdaynum;

                                decimal  everyroomprice = 0;
                                string[] ftstr          = fangtai.Split(',');
                                for (int i = 0; i < ftstr.Length; i++)
                                {
                                    if (ftstr[i].ConvertTo <decimal>(0) > 0)
                                    {
                                        everyroomprice += ftstr[i].ConvertTo <decimal>(0);
                                    }
                                }
                                price = everyroomprice.ToString();

                                p_totalprice1 = (modelb2border.U_num * everyroomprice - modelb2border.Integral1 - modelb2border.Imprest1);
                            }
                            else
                            {
                            }
                        }
                        else if (servertype == 2 || servertype == 8)//当地游;跟团游
                        {
                            string outdate = modelb2border.U_traveldate.ToString("yyyy-MM-dd");

                            //读取団期价格,根据实际选择的団期报价
                            B2b_com_LineGroupDate linemode = new B2b_com_LineGroupDateData().GetLineDayGroupDate(DateTime.Parse(outdate), modelcompro.Id);
                            if (linemode != null)
                            {
                                price = linemode.Menprice.ToString();
                                decimal childreduce = modelcompro.Childreduce;
                                decimal childprice  = decimal.Parse(price) - childreduce;
                                if (childprice < 0)
                                {
                                    childprice = 0;
                                }
                                pricedetail = modelb2border.U_num + "成人," + modelb2border.Child_u_num + "儿童(成人" + price + "元/人,儿童" + childprice + "元/人)";

                                p_totalprice1 = (modelb2border.U_num * (linemode.Menprice) + (modelb2border.Child_u_num) * childprice - modelb2border.Integral1 - modelb2border.Imprest1);
                            }
                        }
                        else //票务
                        {
                            p_totalprice1 = (modelb2border.U_num * modelcompro.Advise_price - modelb2border.Integral1 - modelb2border.Imprest1);
                            price         = modelcompro.Advise_price.ToString(); //modelb2border.Pay_price.ToString();
                            if (price == "0.00" || price == "0")
                            {
                                price = "";
                            }
                            else
                            {
                                price = CommonFunc.OperTwoDecimal(price);
                            }
                        }
                        #endregion

                        proname     = modelcompro.Pro_name;
                        u_name      = modelb2border.U_name.Substring(0, 1) + "**";
                        u_mobile    = modelb2border.U_phone.Substring(0, 4) + "****" + modelb2border.U_phone.Substring(modelb2border.U_phone.Length - 3, 3);
                        travel_date = modelb2border.U_traveldate.ToString();
                        buy_num     = modelb2border.U_num;
                        u_youxiaoqi = modelcompro.Pro_start.ToString() + " - " + modelcompro.Pro_end.ToString();

                        p_totalprice   = CommonFunc.OperTwoDecimal(p_totalprice1.ToString());
                        wxp_totalprice = (p_totalprice1 * 100).ToString("F0");
                        price          = modelb2border.Pay_price.ToString();

                        price = CommonFunc.OperTwoDecimal(price);
                        comid = modelcompro.Com_id;
                        if (comid != 0)
                        {
                            comName = B2bCompanyData.GetCompany(comid).Com_name;
                            if (bo == false)
                            {
                                Response.Redirect("http://shop" + comid + ".etown.cn");
                            }
                        }

                        if ((int)modelb2border.Order_state != (int)OrderStatus.WaitPay)
                        {
                            order_status = EnumUtils.GetName((OrderStatus)modelb2border.Order_state);
                            return;
                        }

                        var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                        if (saleset != null)
                        {
                            phone = saleset.Service_Phone;
                        }

                        //写入支付数据库,先判定是否有此订单支付
                        B2bPayData datapay    = new B2bPayData();
                        B2b_pay    modelb2pay = datapay.GetPayByoId(orderid);


                        #region  微信支付
                        //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                        B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(modelcompro.Com_id);

                        if (model != null)
                        {
                            //商家微信支付的所有参数都存在
                            if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                            {
                                appId     = model.Wx_appid;
                                appsecret = model.Wx_appkey;
                                appkey    = model.Wx_paysignkey;
                                mchid     = model.Wx_partnerid;
                            }
                            else
                            {
                                return;
                            }
                        }
                        else
                        {
                            return;
                        }



                        //创建支付应答对象
                        var packageReqHandler = new RequestHandler(Context);
                        //初始化
                        packageReqHandler.init();

                        timeStamp = TenpayUtil.getTimestamp();
                        nonceStr  = TenpayUtil.getNoncestr();


                        //设置package订单参数
                        string productname = modelcompro.Pro_name.Replace("\"", "").Replace("“", "").Replace("'", "").Replace("‘", "").Replace(";", "").Replace(";", "");
                        packageReqHandler.setParameter("body", productname); //商品信息 127字符
                        packageReqHandler.setParameter("appid", appId);
                        packageReqHandler.setParameter("mch_id", mchid);
                        packageReqHandler.setParameter("nonce_str", nonceStr.ToLower());
                        packageReqHandler.setParameter("notify_url", "http://shop" + modelcompro.Com_id + ".etown.cn/wxpay/backpaynotice.aspx");
                        packageReqHandler.setParameter("openid", obj.openid);
                        packageReqHandler.setParameter("out_trade_no", orderid.ToString());               //商家订单号
                        packageReqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP
                        packageReqHandler.setParameter("total_fee", wxp_totalprice);                      //商品金额,以分为单位(money * 100).ToString()
                        packageReqHandler.setParameter("trade_type", "JSAPI");

                        //获取package包
                        sign = packageReqHandler.CreateMd5Sign("key", appkey);
                        WriteFile(Server.MapPath("") + "\\Log.txt", sign);
                        packageReqHandler.setParameter("sign", sign);

                        string data = packageReqHandler.parseXML();

                        WriteFile(Server.MapPath("") + "\\Log.txt", data);

                        string prepayXml = HttpUtil.Send(data, "https://api.mch.weixin.qq.com/pay/unifiedorder");

                        WriteFile(Server.MapPath("") + "\\Log.txt", prepayXml);

                        //获取预支付ID
                        var xdoc = new XmlDocument();
                        xdoc.LoadXml(prepayXml);
                        XmlNode     xn  = xdoc.SelectSingleNode("xml");
                        XmlNodeList xnl = xn.ChildNodes;
                        if (xnl.Count > 7)
                        {
                            prepayId = xnl[7].InnerText;
                            package  = string.Format("prepay_id={0}", prepayId);
                            WriteFile(Server.MapPath("") + "\\Log.txt", package);
                        }

                        //设置支付参数
                        var paySignReqHandler = new RequestHandler(Context);
                        paySignReqHandler.setParameter("appId", appId);
                        paySignReqHandler.setParameter("timeStamp", timeStamp);
                        paySignReqHandler.setParameter("nonceStr", nonceStr);
                        paySignReqHandler.setParameter("package", package);
                        paySignReqHandler.setParameter("signType", "MD5");
                        paySign = paySignReqHandler.CreateMd5Sign("key", appkey);


                        WriteFile(Server.MapPath("") + "\\Log.txt", paySign);
                        #endregion

                        //订单提交支付信息
                        if (modelb2pay == null)
                        {
                            B2b_pay eticket = new B2b_pay()
                            {
                                Id           = 0,
                                Oid          = orderid,
                                Pay_com      = "wx",
                                Pay_name     = modelb2border.U_name,
                                Pay_phone    = modelb2border.U_phone,
                                Total_fee    = p_totalprice1,
                                Trade_no     = "",
                                Trade_status = "trade_pendpay",
                                Uip          = ""
                            };
                            int payid = datapay.InsertOrUpdate(eticket);
                        }
                        else
                        {
                            //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付
                            if (modelb2pay.Trade_status != "TRADE_SUCCESS")
                            {
                                //防止金额有所改动
                                modelb2pay.Pay_com   = "wx";
                                modelb2pay.Total_fee = p_totalprice1;
                                datapay.InsertOrUpdate(modelb2pay);
                            }
                        }
                    }
                }
            }
        }
コード例 #20
0
ファイル: ProductAdd.aspx.cs プロジェクト: radtek/etowncode
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UserHelper.ValidateLogin())
            {
                comid = UserHelper.CurrentCompany.ID;
            }

            projectid = Request["projectid"].ConvertTo <int>(0);

            nowdate   = DateTime.Now.ToString("yyyy-MM-dd");
            monthdate = DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd");

            proid = Request["proid"].ConvertTo <int>(0);

            servertype = Request["servertype"].ConvertTo <int>(1);

            if (proid > 0)
            {
                int bindingid = new B2bComProData().GetbindingidbyProid(proid);
                if (bindingid > 0)
                {
                    new B2bComProData().Getsalenum(bindingid, out limitbuytotalnum, out buynum);
                }
                else
                {
                    new B2bComProData().Getsalenum(proid, out limitbuytotalnum, out buynum);
                }
            }

            //产品主图片
            BindHeadPortrait(proid);
            ShowImgBind(proid);

            //产品子级图片(多图片)上传
            BindChildImg(proid);


            //获取所属行业
            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;
            var comdata = B2bCompanyData.GetCompany(company.ID);

            if (comdata != null)
            {
                industryid = comdata.Com_type;
            }

            //判断公司是否含有项目,不含有的话,添加默认项目
            int count = new B2b_com_projectData().GetProjectCountByComId(company.ID);

            if (count == 0)
            {
                B2b_company_info    companyinfo = new B2bCompanyInfoData().GetCompanyInfo(company.ID);
                B2b_company_saleset saleset     = B2bCompanySaleSetData.GetDirectSellByComid(company.ID.ToString());

                B2b_com_project model = new B2b_com_project()
                {
                    Id               = 0,
                    Projectname      = company.Com_name,
                    Projectimg       = saleset.Logo.ConvertTo <int>(0),
                    Province         = companyinfo.Province.ConvertTo <string>(""),
                    City             = companyinfo.City,
                    Industryid       = company.Com_type,
                    Briefintroduce   = companyinfo.Scenic_intro,
                    Address          = companyinfo.Scenic_address,
                    Mobile           = companyinfo.Tel,
                    Coordinate       = "",
                    Serviceintroduce = companyinfo.Serviceinfo,
                    Onlinestate      = "1",
                    Comid            = company.ID,
                    Createtime       = DateTime.Now,
                    Createuserid     = 0
                };
                int result = new B2b_com_projectData().EditProject(model);

                //设置公司下产品的项目id都改为默认项目id
                int result2 = new B2bComProData().UpProjectId(company.ID.ToString(), result);
            }
        }
コード例 #21
0
        public int isrightwxset = 1;  //微信接口设置信息是否正确
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            materialid = Request["materialid"].ConvertTo <int>(0);
            uid        = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            WxMaterial wxmaterial = new WxMaterialData().GetWxMaterial(materialid);

            string weixincode = Request["code"].ConvertTo <string>("");

            openid = Request["openid"].ConvertTo <string>("");


            #region  材信息
            if (wxmaterial != null)
            {
                authorpayurl = wxmaterial.Authorpayurl;
                Author       = wxmaterial.Author;
                datetime     = wxmaterial.Operatime.ToString("yyyy-MM-dd");

                comid = wxmaterial.Comid;

                id         = wxmaterial.MaterialId;
                title      = wxmaterial.Title;
                thisday    = DateTime.Now.ToString("yyyy-MM-dd");
                article    = wxmaterial.Article;
                phone_tel  = wxmaterial.Phone;
                Articleurl = wxmaterial.Articleurl;
                phone      = "客服电话:";
                price      = wxmaterial.Price.ToString();

                if (price == "0.00" || price == "0")
                {
                    price = "";
                }
                else
                {
                    price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                    price = "¥" + price + "元-";
                }



                summary = wxmaterial.Summary;
                var identityFileUpload = new FileUploadData().GetFileById(wxmaterial.Imgpath.ToString().ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    if (identityFileUpload.Relativepath != "")
                    {
                        headPortraitImgSrc = fileUrl + identityFileUpload.Relativepath;
                    }
                    else
                    {
                        headPortraitImgSrc = "";
                    }
                }
            }
            #endregion

            #region 微信转发访问统计
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //查询是否有此cookies,有此cooki则证明已经访问过的用户
                if (Request.Cookies["wxact" + materialid.ToString()] == null)
                {
                    var forward = new MemberForwardingData().Forwardingcount(uid, materialid, uip, comid);
                    if (forward > 0)
                    {
                        HttpCookie cookie = new HttpCookie("wxact" + materialid.ToString());     //实例化HttpCookie类并添加值
                        cookie.Value   = "yes";
                        cookie.Expires = DateTime.Now.AddDays(365);
                        Response.Cookies.Add(cookie);
                    }
                }


                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }


                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);

                        cookie         = new HttpCookie("ZF_WxmaterialId"); //实例化HttpCookie类并添加值
                        cookie.Value   = materialid.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
            #endregion



            if (comid != 0)
            {
                #region  微信语音播放接口会用到
                string url = Request.Url.ToString();

                //根据传入参数openid、comid 得到 access_token、jsapi_ticket、noncestr、timestamp、 url(当前网页的URL,不包含#及其后面部分)
                WeiXinBasic basic = new WeiXinBasicData().GetWxBasicByComId(comid);
                if (basic != null)
                {
                    appId     = basic.AppId;
                    timestamp = new WeixinVoiceUtil().CreatenTimestamp();
                    nonceStr  = new WeixinVoiceUtil().CreatenNonce_str();

                    WXAccessToken maccesstoken = new WeixinVoiceUtil().GetAccessToken(comid, basic.AppId, basic.AppSecret);
                    if (maccesstoken != null)
                    {
                        string jsapi_ticket = new WeixinVoiceUtil().GetTickect(maccesstoken.ACCESS_TOKEN, comid);
                        if (jsapi_ticket == "")
                        {
                            isrightwxset = 0;
                        }
                        else
                        {
                            string beforesha1_signature = "";
                            signature = new WeixinVoiceUtil().GetSignature(jsapi_ticket, nonceStr, timestamp, url, out beforesha1_signature);
                        }
                    }
                    else
                    {
                        isrightwxset = 0;
                    }
                }
                else
                {
                    isrightwxset = 0;
                }
                #endregion



                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }
                    Com_name = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }



                if (weixincode != "")
                {
                    int questtype = 2;//1=微信授权验证
                    DealUserinfo1("", weixincode, comid, questtype);
                }
                else if (openid != "")
                {
                    string weixinpass = Request["weixinpass"].ConvertTo <string>("");
                    int    questtype  = 1;                               //1=一次性密码验证
                    DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
                }
            }
        }
コード例 #22
0
        public string Pro_name = ""; //产品名称

        protected void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            oid     = Request["oid"].ConvertTo <int>(0);
            evatype = Request["evatype"].ConvertTo <int>(0);

            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            //根据域名读取商户ID,如果没有绑定域名直接跳转后台
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }

            if (openid != null && openid != "")
            {
                //只要传递过来微信ID 直接SESSION
                Session["Openid"] = openid;
            }

            if (comid != 0)
            {
                //根据公司id得到公司logo地址和公司名称
                title = B2bCompanyData.GetCompany(comid).Com_name;
                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

                if (pro != null)
                {
                    logoimg = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0));
                }


                //获取微信平台端code
                weixincode = Request["code"].ConvertTo <string>("");
                openid     = Request["openid"].ConvertTo <string>("");
                weixinpass = Request["weixinpass"].ConvertTo <string>("");

                GetMemberCard(openid, weixincode, weixinpass, comid);//登陆或得到会员信息


                //最后判断登陆
                if (AccountId == 0)
                {
                    Response.Redirect("/h5/order/login.aspx");
                }

                //读取订单
                var orderdata = new B2bOrderData();
                var orderinfo = orderdata.GetOrderById(oid);
                if (orderinfo != null)
                {
                    var prodata = new B2bComProData();
                    var proinfo = prodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid);
                    if (proinfo != null)
                    {
                        Pro_name = proinfo.Pro_name;
                        if (evatype == 1)
                        {
                            Pro_name = "教练为用户提交教学档案:" + Pro_name + " 预约时间:" + orderinfo.U_traveldate.ToString("yyyy-MM-dd HH:mm");
                        }
                    }


                    uid       = orderinfo.U_id;
                    channelid = orderinfo.channelcoachid;
                }


                //权限不匹配 跳转会员登陆页面
                if (evatype == 0)
                {
                    //if (AccountId != uid)
                    //{
                    //    Response.Redirect("/h5/order/login.aspx");
                    //}
                }
                else  //如果是 教练评价 客户
                      //查询渠道是否匹配,可能遇到不针对教练预约 ,暂时不做判定,这样 出现所有教练都有可能对客户进行评价,未指定教练,如何评价



                {
                }
            }
        }
コード例 #23
0
ファイル: yuyuesuc.aspx.cs プロジェクト: radtek/etowncode
        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            id = Request["id"].ConvertTo <int>(0);
            string md5 = Request["md5"].ConvertTo <string>("");

            string Returnmd5 = EncryptionHelper.ToMD5(id.ToString() + "lixh1210", "UTF-8");


            var orderdata = new B2bOrderData();
            var orderinfo = orderdata.GetOrderById(id);

            if (orderinfo != null)
            {
                u_name = orderinfo.U_name;

                //判断登陆状态
                //if (Session["AccountId"] != null)
                //{
                //先判断Session
                //int AccountId = int.Parse(Session["AccountId"].ToString());

                if (Returnmd5 == md5)       //必须符合加密的才能打开
                {
                    yuyuetime = orderinfo.U_traveldate.ToString("yyyy-MM-dd hh:mm:ss");
                    var prodata = new B2bComProData();
                    var proinfo = prodata.GetProById(orderinfo.Pro_id.ToString());
                    if (proinfo != null)
                    {
                        Pro_name  = proinfo.Pro_name;
                        bindiname = proinfo.bookpro_bindname;
                        bindphone = proinfo.bookpro_bindphone;

                        var managedata = new B2bCompanyManagerUserData();
                        var manageinfo = managedata.GetCompanyUserByPhone(bindphone, proinfo.Com_id);
                        if (manageinfo != null)
                        {
                            bindimg = FileSerivce.GetImgUrl(manageinfo.Headimg);
                        }
                    }
                }
                //}
            }



            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            key = Request["key"].ConvertTo <string>("");

            if (key != "")
            {
                biaoti = key;
            }

            proclass = Request["class"].ConvertTo <int>(0);
            price    = Request["price"].ConvertTo <int>(0);



            if (proclass != 0)
            {
                var prodata = new B2bComProData();
                var result  = prodata.Proclassbyid(proclass);
                if (result != null)
                {
                    biaoti = result.Classname;
                }
            }

            //获取随机用户ID
            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }

            buyuid  = Request["buyuid"].ConvertTo <int>(0);
            tocomid = Request["tocomid"].ConvertTo <int>(0);


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }



            if (comid != 0)
            {
                //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(comid);
                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                if (model != null)
                {
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                    //商家微信支付的所有参数都存在
                    if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                    {
                        //appId = model.Wx_appid;
                        //appsecret = model.Wx_appkey;
                        //appkey = model.Wx_paysignkey;
                        //mchid = model.Wx_partnerid;
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                        issetfinancepaytype = true;
                    }
                }


                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }


            //获取BANNER,及logo
            if (comid != 0)
            {
                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }
            }



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
コード例 #24
0
ファイル: Orderlist.aspx.cs プロジェクト: radtek/etowncode
        protected void Page_Load(object sender, EventArgs e)
        {
            Request.ValidateInput();
            string u = Request.ServerVariables["HTTP_USER_AGENT"];

            //bool bo = detectmobilebrowser.HttpUserAgent(u);
            proclass = Request["proclass"].ConvertTo <int>(0);

            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            buyuid    = Request["buyuid"].ConvertTo <int>(0);
            tocomid   = Request["tocomid"].ConvertTo <int>(0);
            projectid = Request["id"].ConvertTo <int>(0);

            pno = Request["pno"].ConvertTo <string>("");

            string pno1 = EncryptionHelper.EticketPnoDES(pno, 1);//解密

            var B2bEticketdata = new B2bEticketData();
            var eticketinfo    = B2bEticketdata.GetEticketDetail(pno1);

            if (eticketinfo != null)
            {
                comid     = eticketinfo.Com_id;
                usepnonum = eticketinfo.Use_pnum;
            }


            if (comid == 0)
            {
                if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
                {
                    comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                }
                else
                {
                    B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                    if (companyinfo != null)
                    {
                        comid = companyinfo.Com_id;
                    }
                }
            }

            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }


            //根据项目id得到项目信息
            if (projectid != 0)
            {
                B2b_com_project mod = new B2b_com_projectData().GetProject(projectid, comid);
                if (mod != null)
                {
                    projectname   = mod.Projectname;
                    projectimgurl = FileSerivce.GetImgUrl(mod.Projectimg);
                    projectbrief  = mod.Briefintroduce;
                }


                B2bComProData prodata1 = new B2bComProData();
                var           prohotel = prodata1.Selectpro_hotel(comid, projectid);
                if (prohotel == 1)
                {
                    // Response.Redirect("hotel/hotelshow.aspx?projectid=" + projectid + "&id=" + comid + "&uid =" + uid + "&buyuid=" + buyuid + "&tocomid=" + tocomid + " ");
                }
            }


            if (comid != 0)
            {
                B2b_company companyinfo = B2bCompanyData.GetCompany(comid);

                B2bCompanyInfoData info = new B2bCompanyInfoData();
                if (companyinfo != null)
                {
                    comName = companyinfo.Com_name;
                    if (comName.Length >= 9)
                    {
                        comName = comName.Substring(0, 9) + "..";
                    }

                    remark = info.GetCompanyInfo(comid).Scenic_intro + "&nbsp;&nbsp;<a style=\"color:#1a9ed9\" href=\"OrderinfoTitle.aspx?id=" + comid + "\">(查看全部)</a>";
                    if (remark.Length > 42)
                    {
                        remark = remark.Substring(0, 42) + "&nbsp;&nbsp;<a style=\"color:#1a9ed9\" href=\"OrderinfoTitle.aspx?id=" + comid + "\">(查看全部)</a>";
                    }


                    if (companyinfo.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = companyinfo.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = companyinfo.B2bcompanyinfo.Wxfocus_author;;
                    }
                }

                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    if (saleset.Smalllogo != null && saleset.Smalllogo != "")
                    {
                        headPortraitImgSrc = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                    }
                }
            }


            //------------------------------新添加代码(主要目的就是获取微信号使用户处于登录状态以及判断用户转发时引发的微信号混乱问题)===========================

            string weixincode = Request["code"].ConvertTo <string>("");

            if (weixincode == "")//未认证微信
            {
                openid     = Request["openid"].ConvertTo <string>("");
                weixinpass = Request["weixinpass"].ConvertTo <string>("");
                int questtype = 1;                                   //1=一次性密码验证
                DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
            }
            else//已认证微信

            {
                int questtype = 2;                               //1=微信授权验证
                DealUserinfo1("", weixincode, comid, questtype); //获取微信号;使用户处于登录状态
            }
        }
コード例 #25
0
        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            uid      = Request["uid"].ConvertTo <int>(0);
            MasterId = Request["MasterId"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            id       = Request["id"].ConvertTo <int>(0);
            nowdate  = DateTime.Now.ToString("yyyy-MM-dd");
            nowtoday = DateTime.Now;

            buyuid  = Request["buyuid"].ConvertTo <int>(0);
            tocomid = Request["tocomid"].ConvertTo <int>(0);



            //获取随机用户ID


            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }


            if (id != 0)
            {
                B2b_com_pro pro = new B2bComProData().GetProById(id.ToString());
                if (pro != null)
                {
                    channelcoachid = new MemberChannelData().GetChannelidbymanageuserid(MasterId, pro.Com_id);
                    if (pro.Server_type == 13)
                    {
                        //如果 产品为教练产品
                        if (channelcoachid == 0)
                        {
                            //当未选择教练 则 跳转到教练页面
                            Response.Redirect("/h5/coachList.aspx?come=" + id);
                        }
                    }

                    Ispanicbuy       = pro.Ispanicbuy;       //是否抢购或限购
                    Limitbuytotalnum = pro.Limitbuytotalnum; //限购数量
                    bindname         = pro.bookpro_bindname;
                    bindphone        = pro.bookpro_bindphone;
                    manyspeci        = pro.Manyspeci;
                    Wrentserver      = pro.Wrentserver;
                    //如果多规格读取规格
                    if (manyspeci == 1)
                    {
                        gglist = new B2b_com_pro_SpeciData().Getgglist(pro.Id);
                    }


                    //对默认只显示预约电话进行
                    if (pro.Server_type == 12 || pro.Server_type == 13)
                    {
                        //当时预约产品就先设定显示预约电话
                        view_phone = 1;

                        //先判断渠道来路,如果没有渠道则安默认,如果有来路渠道,则显示来路渠道
                        if (MasterId != 0)
                        {
                            B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId);
                            if (manageruser != null)
                            {
                                bindname  = manageruser.Employeename;
                                bindphone = manageruser.Tel;
                            }
                        }


                        //判断 绑定渠道电话 与 访问来的渠道电话相同 则 显示电话,并显示预订
                        if (bindphone == pro.bookpro_bindphone)
                        {
                            view_phone = 2;
                        }

                        //如果为教练产品,显示订购和 和图像 不显示电话
                        if (pro.Server_type == 13)
                        {
                            view_phone = 3;
                        }
                    }


                    //通过 显示渠道的电话 来查找头像


                    B2b_company_manageuser manageruser_temp = new B2bCompanyManagerUserData().GetCompanyUserByPhone(bindphone, pro.Com_id);
                    if (manageruser_temp != null)
                    {
                        channleimg = FileSerivce.GetImgUrl(manageruser_temp.Headimg);
                        if (channleimg == "/Images/defaultThumb.png")
                        {
                            channleimg = "";
                        }
                    }



                    //查询相关项目名称
                    var proprojectdata = new B2b_com_projectData();

                    var proprejectinfo = proprojectdata.GetProject(pro.Projectid, pro.Com_id);
                    if (proprejectinfo != null)
                    {
                        projectname = proprejectinfo.Projectname;
                        Coordinate  = proprejectinfo.Coordinate;
                        Address     = proprejectinfo.Address;
                    }

                    projectname = proprojectdata.GetProjectNameByid(pro.Projectid);



                    //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                    B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(pro.Com_id);
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                    if (model != null)
                    {
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                        //商家微信支付的所有参数都存在
                        if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                        {
                            //appId = model.Wx_appid;
                            //appsecret = model.Wx_appkey;
                            //appkey = model.Wx_paysignkey;
                            //mchid = model.Wx_partnerid;
                            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                            issetfinancepaytype = true;
                        }
                    }



                    //票务产品,判断 是否抢购/限购,是的话 作废超时未支付订单,完成回滚操作
                    if (pro_servertype == 1)
                    {
                        if (pro.Ispanicbuy == 1 || pro.Ispanicbuy == 2)
                        {
                            int rs = new B2bComProData().CancelOvertimeOrder(pro);
                        }
                    }

                    iscanbook      = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                    pro_servertype = pro.Server_type;
                    pickuppoint    = pro.pickuppoint;
                    dropoffpoint   = pro.dropoffpoint;


                    childreduce = pro.Childreduce;

                    if (pro.Ispanicbuy == 1)
                    {
                        panic_begintime  = pro.Panic_begintime;
                        panicbuy_endtime = pro.Panicbuy_endtime;


                        TimeSpan tss = pro.Panic_begintime - nowtoday;
                        var      day = tss.Days * 24 * 3600;; //这是相差的天数
                        var      h   = tss.Hours * 3600;      //这是相差的小时数,
                        var      m   = tss.Minutes * 60;
                        var      s   = tss.Seconds;
                        shijiacha = day + h + m + s;
                    }
                    projectid        = pro.Projectid;
                    comid            = pro.Com_id;
                    pro_name         = pro.Pro_name;
                    price            = pro.Advise_price;
                    face_price       = pro.Face_price;
                    limitbuytotalnum = pro.Limitbuytotalnum;
                    imgurl           = FileSerivce.GetImgUrl(pro.Imgurl);

                    //如果含有规格读取规格价格中最低价
                    if (manyspeci == 1)
                    {
                        if (gglist != null)
                        {
                            price      = 0;
                            face_price = 0;
                            for (int i = 0; i < gglist.Count(); i++)
                            {
                                if (gglist[i].speci_advise_price != 0)
                                {
                                    if (price == 0 || price > gglist[i].speci_advise_price)
                                    {
                                        price      = gglist[i].speci_advise_price;
                                        face_price = gglist[i].speci_face_price;
                                    }
                                }
                            }
                        }
                    }



                    if (price == 0)
                    {
                        price = 0;
                    }
                    else
                    {
                        CommonFunc.OperTwoDecimal(price.ToString());
                        //price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price;
                    }

                    if (face_price != 0)
                    {
                        CommonFunc.OperTwoDecimal(face_price.ToString());
                    }


                    nowdate = DateTime.Now.ToString("yyyy-MM-dd");


                    if (pro.Service_Contain != "")
                    {
                        sumaryend = pro.Service_Contain;
                    }

                    if (pro.Service_NotContain != "")
                    {
                        sumaryend = sumaryend + "</br> " + pro.Service_NotContain;
                    }

                    if (pro.Precautions != "")
                    {
                        sumaryend = sumaryend + "</br> " + pro.Precautions;
                    }

                    Server_type = pro.Server_type;

                    bookpro_ispay = pro.bookpro_ispay;

                    //如果服务类型是 票务;  则备注信息中 显示 电子码使用限制
                    if (pro.Server_type == 1)
                    {
                        if (pro.Iscanuseonsameday == 0)//电子码当天不可用
                        {
                            youxianshiduan = "此产品当天预订不可用";
                        }
                        if (pro.Iscanuseonsameday == 1)//电子码当天可用
                        {
                            youxianshiduan = "此产品当天预订可用";
                        }
                        if (pro.Iscanuseonsameday == 2)//电子码出票2小时内不可用
                        {
                            youxianshiduan = "此产品出票2小时内不可用";
                        }
                    }

                    remark  = pro.Pro_Remark;
                    pro_num = pro.Pro_number;
                    if (pro_num == 0)
                    {
                        pro_max = 100;
                        pro_min = 1;
                    }
                    else
                    {
                        pro_min = 1;
                        pro_max = pro_num;
                    }
                    pro_explain = pro.Pro_explain;



                    #region 产品有效期判定(微信模板--门票订单预订成功通知 中也有用到)
                    provalidatemethod = pro.ProValidateMethod; //判断 1按产品有效期,2指定有效期
                    appointdate       = pro.Appointdata;       //1=一星期,,2=1个月,3=3个月,4=6个月,5=一年
                    iscanuseonsameday = pro.Iscanuseonsameday; //1当天可用,0当天不可用

                    pro_end     = pro.Pro_end;
                    pro_end_str = pro.Pro_end.AddMonths(-1).ToString("yyyy,MM,dd");
                    //返回有效期
                    pro_youxiaoqi = new B2bComProData().GetPro_Youxiaoqi(pro.Pro_start, pro.Pro_end, provalidatemethod, appointdate, iscanuseonsameday);

                    #endregion


                    //如果是 教练产品 根据教练信息 获取教练 上班时间

                    if (pro.Server_type == 13 || pro.Server_type == 12)
                    {                      //必须是教练产品
                        if (MasterId != 0) //必须有教练参数
                        {
                            B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId);
                            if (manageruser != null)
                            {
                                if (manageruser.Workdays != "")
                                {
                                    if (manageruser.worktimestar != 0)
                                    {
                                        if (manageruser.worktimestar < manageruser.worktimeend)
                                        {
                                            for (var i = manageruser.worktimestar; i < manageruser.worktimeend; i++)
                                            {
                                                workh += "<option value=\"" + i + "\">" + i + "点</option>";
                                            }
                                        }
                                        else
                                        {
                                            var day1 = 24 - manageruser.worktimestar;
                                            var day2 = manageruser.worktimeend;
                                            var day3 = day1 + day2;

                                            for (var i = 0; i > day3; i++)
                                            {
                                                if (i > day1)
                                                {
                                                    workh += "<option value=\"" + (manageruser.worktimestar + i) + "\">" + (manageruser.worktimestar + i) + "点</option>";
                                                }
                                                else
                                                {
                                                    workh += "<option value=\"" + (manageruser.worktimestar - i) + "\">" + (manageruser.worktimestar - i) + "点</option>";
                                                }
                                            }
                                        }
                                    }



                                    if (!manageruser.Workdays.Contains("2"))                                              //检验不含周一
                                    {
                                        DateTime dt        = DateTime.Now;                                                //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))); //本周周一

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }

                                    if (!manageruser.Workdays.Contains("3"))                                                         //检验不含周二
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(1); //本周周二

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("4"))                                                         //检验不含周3
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(2); //本周周3

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("5"))                                                         //检验不含周4
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(3); //本周周4

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("6"))                                                         //检验不含周5
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(4); //本周周5


                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("7"))                                                         //检验不含周6
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(5); //本周周6

                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                    if (!manageruser.Workdays.Contains("1"))                                                         //检验不含周日
                                    {
                                        DateTime dt        = DateTime.Now;                                                           //当前时间
                                        DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(6); //本周周日


                                        //初始日期为今天,到产品有效期结束 增加一周(7天)方式
                                        for (var i = startWeek; i < pro_end; i.AddDays(7))
                                        {
                                            nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],";
                                            i       = i.AddDays(7);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }



                var commodel = B2bCompanyData.GetCompany(comid);
                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                    }
                }


                var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    phone = saleset.Service_Phone;
                }

                //查询项目电话,如果有项目电话调取项目电话
                var projectdata  = new B2b_com_projectData();
                var projectmodel = projectdata.GetProject(projectid, comid);
                if (projectmodel != null)
                {
                    if (projectmodel.Mobile != "")
                    {
                        phone = projectmodel.Mobile;
                    }
                }


                //从cookie中得到微信号
                if (Request.Cookies["openid"] != null)
                {
                    openid = Request.Cookies["openid"].Value;
                }
                B2bCrmData b2b_crm = new B2bCrmData();
                if (openid != "")
                {
                    B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid);
                    if (b2bmodle != null)
                    {
                        Imprest  = b2bmodle.Imprest;
                        Integral = b2bmodle.Integral;
                    }
                }
            }



            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var wxdomain = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl);
                if (wxdomain != null)
                {
                    comid = wxdomain.Comid;
                }
            }
            if (comid != 0)
            {
                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }



            //获取BANNER,及logo
            if (comid != 0)
            {
                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }
            }


            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
コード例 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            comid  = company.ID;//获取登陆账户公司id
            userid = user.Id.ToString();
            if (comid == 0)
            {
                Response.Redirect("/");//如果没有COMID 返回 首页
            }


            //判断商户ID(域名未绑定)
            if (comid != 0)
            {
                B2b_company modlecom = B2bCompanyData.GetAllComMsg(comid);
                if (modlecom != null)
                {
                    Com_name       = modlecom.Com_name;
                    txtServiceInfo = modlecom.B2bcompanyinfo.Serviceinfo;
                    Scenic_name    = modlecom.Scenic_name;
                    scenic_address = modlecom.B2bcompanyinfo.Scenic_address;
                    coordinate     = modlecom.B2bcompanyinfo.Coordinate;
                    coordinatesize = modlecom.B2bcompanyinfo.Coordinatesize;
                    weixinimg      = modlecom.B2bcompanyinfo.Weixinimg;
                    weixinname     = modlecom.B2bcompanyinfo.Weixinname;
                    Qq             = modlecom.B2bcompanyinfo.Qq;
                }

                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                    Copyright = pro.Copyright;
                    Tel       = pro.Service_Phone;
                }



                //读取首页栏目,只读取前10个栏目,太多影响打开
                //var shopmenudata = new B2bCompanyMenuData();
                //menulist = shopmenudata.GetMenuList(comid, 1, 10, out menutotalcount, 1);
                //if (menulist != null)
                //{
                //    for (int i = 0; i < menutotalcount; i++)
                //    {
                //        menulist[i].Imgurl_address = FileSerivce.GetImgUrl(menulist[i].Imgurl);
                //    }
                //}

                //如果没有栏目读取项目
                if (menutotalcount == 0)
                {
                    var prodata = new B2b_com_projectData();
                    projectlist = prodata.Projectpagelist(comid.ToString(), 1, 20, "1", out porjectcount, "", 1);
                }
            }
        }
コード例 #27
0
ファイル: ShangJia.Master.cs プロジェクト: radtek/etowncode
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AccountId"] != null)
            {
                AccountId   = Session["AccountId"].ToString();
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                Today       = DateTime.Now.ToString("yyyy-MM-dd");
            }

            comid      = Request["comid"].ConvertTo <int>(0);
            proid      = Request["proid"].ConvertTo <string>("");
            orderid    = Request["orderid"].ConvertTo <int>(0);
            ordertype  = Request["ordertype"].ConvertTo <string>("1");
            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            if (Request.QueryString["out_trade_no"] != null)
            {
                orderid = Request.QueryString["out_trade_no"].ConvertTo <int>(0);
                //根据订单id得到订单信息
                B2bOrderData dataorder     = new B2bOrderData();
                B2b_order    modelb2border = dataorder.GetOrderById(orderid);
                proid = modelb2border.Pro_id.ToString();
            }


            //读产品信息
            if (proid != "")
            {
                //根据产品id得到产品信息
                B2bComProData datapro     = new B2bComProData();
                B2b_com_pro   modelcompro = datapro.GetProById(proid);

                if (modelcompro != null)
                {
                    proname = modelcompro.Pro_name;
                    comid   = modelcompro.Com_id;
                }
            }

            //针对支付同步返回页,暂时无法绑定域名
            if (Request.QueryString["out_trade_no"] == null)
            {
                //根据域名读取商户ID,如果没有绑定域名直接跳转后台
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
                else
                {
                    //判定是否为自助域名规则安 shop1.etown.cn
                    if (Domain_def.Domain_yanzheng(RequestUrl))
                    {
                        comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                    }
                    else
                    {
                        if (RequestUrl == "shop.etown.cn" || RequestUrl == "test.etown.cn" || RequestUrl == "admin.etown.cn" || RequestUrl == "admin.vctrip.com")
                        {
                            Response.Redirect("/Manage/index1.html");
                        }
                        else
                        {
                            Response.Redirect("/admin/");
                        }
                    }
                }
            }



            //判断商户ID(域名未绑定)
            if (comid != 0)
            {
                B2b_company         com        = B2bCompanyData.GetAllComMsg(comid);
                B2b_company_saleset comsetinfo = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (com != null)
                {
                    Com_name     = com.Com_name;
                    Scenic_name  = com.Scenic_name;
                    Scenic_intro = com.B2bcompanyinfo.Scenic_intro;

                    if (comsetinfo != null)
                    {
                        if (comsetinfo.Logo != "")
                        {
                            FileUploadModel comlogo = new FileUploadData().GetFileById(int.Parse(comsetinfo.Logo));
                            if (comlogo != null)
                            {
                                Logourl = "<img src=\"" + fileUrl + comlogo.Relativepath + "\" alt=\"" + Scenic_name + "\" height=\"80\"  id=\"imglogo\" />";
                            }
                        }
                        else
                        {
                            Logourl = "";
                        }

                        Service_Phone = comsetinfo.Service_Phone;
                        if (Service_Phone != "")
                        {
                            Service_Phone = "客服电话:" + Service_Phone;
                        }

                        Copyright = comsetinfo.Copyright;
                    }
                }
            }
            else
            {
                //如果没有商户ID(域名未绑定) 则跳转管理登陆页面。
                Response.Redirect("/Manage/index1.html");
            }
        }
コード例 #28
0
ファイル: ProductList.aspx.cs プロジェクト: radtek/etowncode
        public int viewtop   = 1;   //头部及左侧相关显示控制
        protected void Page_Load(object sender, EventArgs e)
        {
            //如果判断手机浏览器 跳转手机版
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            if (bo)
            {
                Response.Redirect("/h5/order/");
            }


            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToString();
            comid      = Request["comid"].ConvertTo <int>(0);
            menuindex  = Request["menuindex"].ConvertTo <int>(0);


            B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);

            if (companyinfo != null)
            {
                comid = companyinfo.Com_id;
            }
            else
            { //判定是否为自助域名规则安 shop1.etown.cn
                if (Domain_def.Domain_yanzheng(RequestUrl))
                {
                    comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                }
            }


            //绿野 不显示头部
            if (comid == 2553)
            {
                viewtop = 0;
            }

            //判断商户ID(域名未绑定)
            if (comid != 0)
            {
                B2b_company modlecom = B2bCompanyData.GetAllComMsg(comid);
                if (modlecom != null)
                {
                    Com_name       = modlecom.Com_name;
                    txtServiceInfo = modlecom.B2bcompanyinfo.Serviceinfo;
                    Scenic_name    = modlecom.Scenic_name;
                    scenic_address = modlecom.B2bcompanyinfo.Scenic_address;
                    coordinate     = modlecom.B2bcompanyinfo.Coordinate;
                    coordinatesize = modlecom.B2bcompanyinfo.Coordinatesize;
                    weixinimg      = modlecom.B2bcompanyinfo.Weixinimg;
                    weixinname     = modlecom.B2bcompanyinfo.Weixinname;
                    Qq             = modlecom.B2bcompanyinfo.Qq;
                }

                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                    Copyright = pro.Copyright;
                    Tel       = pro.Service_Phone;
                }



                //读取首页栏目,只读取前10个栏目,太多影响打开
                var shopmenudata = new B2bCompanyMenuData();
                menulist = shopmenudata.GetMenuList(comid, 1, 10, out menutotalcount, 1, menuindex);
                if (menulist != null)
                {
                    for (int i = 0; i < menulist.Count; i++)
                    {
                        menulist[i].Imgurl_address = FileSerivce.GetImgUrl(menulist[i].Imgurl);
                    }
                }

                //如果没有栏目读取项目
                if (menutotalcount == 0)
                {
                    var prodata = new B2b_com_projectData();
                    projectlist = prodata.Projectpagelist(comid.ToString(), 1, 10, "1", out porjectcount, "");
                }
            }


            int totalcount = 0;

            if (Session["AccountId"] != null)
            {
                //账户信息
                AccountId   = Int32.Parse(Session["AccountId"].ToString());
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                RequestUrl  = Request.ServerVariables["SERVER_NAME"].ToLower();

                //会员信息
                B2bCrmData dateuser  = new B2bCrmData();
                B2b_crm    modeluser = dateuser.Readuser(AccountId, comid);

                if (modeluser != null)
                {
                    AccountWeixin = modeluser.Weixin;
                    AccountEmail  = modeluser.Email;
                    Accountphone  = modeluser.Phone;
                    Imprest       = modeluser.Imprest;
                    Integral      = modeluser.Integral;
                    //密码
                    AccountPass = modeluser.Password1;
                    //微信关注
                    weixin = modeluser.Weixin == "" ? "未关注" : "已关注";
                }

                //用户订单
                //List<B2b_order> orderlist = new B2bOrderData().ComOrderPageList(comid,1, 100, AccountId, out totalcount);
                //Rporder.DataSource = orderlist;
                //Rporder.DataBind();
            }
        }
コード例 #29
0
        public string userid  = "0";//用户临时 Uid 或 实际Uid



        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            key = Request["key"].ConvertTo <string>("");

            if (key != "")
            {
                biaoti = key;
            }

            proclass = Request["class"].ConvertTo <int>(0);
            price    = Request["price"].ConvertTo <int>(0);

            //获取随机用户ID
            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }



            if (proclass != 0)
            {
                var prodata = new B2bComProData();
                var result  = prodata.Proclassbyid(proclass);
                if (result != null)
                {
                    biaoti = result.Classname;
                }
            }



            buyuid  = Request["buyuid"].ConvertTo <int>(0);
            tocomid = Request["tocomid"].ConvertTo <int>(0);


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }


            if (comid != 0)
            {
                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }



            //获取BANNER,及logo
            if (comid != 0)
            {
                var imagedata  = new B2bCompanyImageData();
                int totalcount = 0;
                List <B2b_company_image> list = imagedata.PageGetimageList(comid, 2, out totalcount);

                if (list != null)
                {
                    for (int i = 0; i < totalcount; i++)
                    {
                        bannerimg   = FileSerivce.GetImgUrl(list[i].Imgurl);
                        bannerlink  = list[i].Linkurl;
                        bannertitle = list[i].Title;
                    }
                }

                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }


                //读取首页栏目,只读取前10个栏目,太多影响打开
                var shopmenudata = new B2bCompanyMenuData();
                menulist = shopmenudata.GetMenuList(comid, 1, 10, out menutotalcount, 1);
                if (menulist != null)
                {
                    for (int i = 0; i < menutotalcount; i++)
                    {
                        menulist[i].Imgurl_address = FileSerivce.GetImgUrl(menulist[i].Imgurl);
                    }
                }
            }



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
コード例 #30
0
        private void GetUser()
        {
            B2b_company_manageuser user    = UserHelper.CurrentUser();
            B2b_company            company = UserHelper.CurrentCompany;

            atypee  = user.Atype;
            userid  = user.Id;
            comid   = company.ID;
            comname = company.Com_name;

            //判断页面是否在权限页面链接中:没有,不做处理;有,判断角色是否可以访问此页面
            bool isactionurl = new Sys_ActionData().Isactionurl(Requestfile);

            if (isactionurl)
            {
                bool iscanvisit = new Sys_ActionData().Iscanvisit(Requestfile, userid);
                if (iscanvisit == false)
                {
                    //Response.Redirect("/manage.aspx");
                    Response.Write("<script>window.location.href='/manage.aspx'</script>");
                }
            }



            //根据comid得到公司logo信息
            B2b_company_saleset logoset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

            if (logoset != null)
            {
                int logo_temp = 0;

                if (logoset.Logo != "")
                {
                    logo_temp = int.Parse(logoset.Logo);
                }

                FileUploadModel identityFileUpload = new FileUploadData().GetFileById(logo_temp);
                if (identityFileUpload != null)
                {
                    comlogo = fileUrl + identityFileUpload.Relativepath;
                }
            }

            username = user.Accounts;
            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid);

            if (companyinfo.B2bcompanyinfo.Domainname != "")
            {
                companydo = "http://" + companyinfo.B2bcompanyinfo.Domainname;
            }
            else
            {
                companydo = "http://shop" + company.ID + ".etown.cn";
            }

            //根据userid得到用户信息,如果用户没有渠道公司的分配,则显示全部门市
            B2b_company_manageuser muser = B2bCompanyManagerUserData.GetUser(UserHelper.CurrentUserId());

            if (muser != null)
            {
                //控制只有平台总账户才可以进入/ui/permissionui目录
                if (Requestfile.Contains("/ui/permissionui"))
                {
                    if (muser.Id != 1035)
                    {
                        Response.Redirect("http://shop.etown.cn");
                    }
                }

                Sys_Group gg = new Sys_GroupData().GetGroupByUserId(muser.Id);
                if (gg == null)
                {
                    //Response.Write("<script>alert('用户尚未分配角色,请联系管理员!');location.href='/Manage/index1.html'</script>");
                }
                else
                {
                    iscanverify = gg.Iscanverify;
                    groupname   = gg.Groupname;
                    groupid     = gg.Groupid;
                }
            }



            //根据不同用户显示不同的左侧栏
            int totalcount = 0;
            List <Sys_ActionColumn> topList = new Sys_ActionColumnData().GetActionColumnByUser(UserHelper.CurrentUserId(), out totalcount);


            rptTopMenuList.DataSource = topList;
            rptTopMenuList.DataBind();

            foreach (RepeaterItem item in rptTopMenuList.Items)
            {
                int funcId = (item.FindControl("HideFuncId") as HiddenField).Value.ConvertTo <int>();

                int totalaction = 0;
                var menuList    = new Sys_ActionData().GetActionsByColumnId(UserHelper.CurrentUserId(), funcId, out totalaction);

                Repeater rptMenuList = item.FindControl("rptMenuList") as Repeater;
                rptMenuList.DataSource = menuList;
                rptMenuList.DataBind();
            }
        }