Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id   = int.Parse(Request.QueryString["id"].ToString());
            var info = new WxMaterialData().Getidinfo(id);

            if (info != null)
            {
                price  = info.Price.ToString() == null ? "" : info.Price.ToString();
                titile = info.Title.ToString() == null ? "" : info.Title.ToString();
                contxt = info.Article.ToString() == null ? "" : info.Article.ToString();
                phone  = info.Price.ToString() == null ? "" : info.Phone.ToString();
                //图片链接
                var identityFileUpload = new FileUploadData().GetFileById(info.Imgpath.ToString().ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    imgurl = imgurl + identityFileUpload.Relativepath;
                }
                var wspt = new WxSalePromoteTypeData().GetWxMenu(int.Parse(info.SalePromoteTypeid.ToString()));

                if (wspt.Typename.ToString() == "精选推荐")
                {
                    type = "<a href=\"top10.aspx\">精选推荐</a> > ¥" + price + "起 -- " + titile + "";
                }
                else
                {
                    type = wspt.Typename.ToString();
                }
            }
            else
            {
                type = "不存在文章详细,<input type=\"button\" onclick=\"javascript:history.go(-1)\" value=\"返回上一页\" />";
            }
        }
Example #2
0
        private void ShowImgBind()
        {
            //var comid = Context.Request["comid"].ConvertTo<int>(0);
            var comid = UserHelper.CurrentCompany.ID;

            if (adid != 0)
            {
                var actdata = new WxAdData();
                var pro     = actdata.Getwxad(adid, comid);

                if (pro != null)
                {
                    Title = pro.Title;
                    Link  = pro.Link;
                }
            }

            if (id != 0)
            {
                var actdata = new WxAdImagesData();
                var imgpro  = actdata.Getwxadimages(id, adid);

                if (imgpro != null)
                {
                    FileUploadModel identityFileUpload = new FileUploadData().GetFileById(imgpro.Imageid);
                    if (identityFileUpload != null)
                    {
                        headPortraitImgSrc = identityFileUpload.Relativepath;
                    }
                }
            }
        }
        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;
                    }
                }
            }
        }
Example #4
0
        public RESTStatus GetFileDataMgmt(SQLLib sql, object dummy, NetworkConnectionInfo ni, Int64 ID)
        {
            if (ni.HasAcl(ACLFlags.ChangeServerSettings) == false)
            {
                ni.Error   = "Access denied";
                ni.ErrorID = ErrorFlags.AccessDenied;
                return(RESTStatus.Denied);
            }

            lock (ni.sqllock)
            {
                SqlDataReader dr = sql.ExecSQLReader("SELECT COUNT(*) FROM FileTransfers WHERE ID=@id",
                                                     new SQLParam("@id", ID));
                if (dr.HasRows == false)
                {
                    ni.Error   = "Not found";
                    ni.ErrorID = ErrorFlags.InvalidID;
                    dr.Close();
                    return(RESTStatus.NotFound);
                }

                dr.Read();

                UploadedData2 = FillUploadData(dr);

                dr.Close();
            }

            return(RESTStatus.Success);
        }
Example #5
0
        private void ShowImgBind(int id)
        {
            //根据产品id得到 产品信息
            B2bModelData modeldate = new B2bModelData();
            var          proo      = modeldate.GetModelById(id);

            if (proo != null)
            {
                var identityFileUpload = new FileUploadData().GetFileById(proo.Bgimage.ToString().ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    headPortraitImgSrc = identityFileUpload.Relativepath;
                }
                if (proo.Smallimg == null || proo.Smallimg == 0)
                {
                }
                else
                {
                    FileUploadModel smallidentityFileUpload = new FileUploadData().GetFileById(proo.Smallimg.ToString().ConvertTo <int>(0));
                    if (smallidentityFileUpload != null)
                    {
                        if (smallidentityFileUpload.Id != 0)
                        {
                            headSmalltraitImgSrc = smallidentityFileUpload.Relativepath;
                        }
                    }
                }
            }
        }
Example #6
0
 public void FileUpload(FileUploadData data, string filePathName, string fileName)
 {
     using (var fileStream = new FileStream(filePathName, FileMode.Open))
     {
         FileUpload(data, fileStream, fileName);
     }
 }
Example #7
0
 private void cmdCancelTrans_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem i in lstFiles.SelectedItems)
     {
         FileUploadData t = (FileUploadData)i.Tag;
         Program.net.File_MGMT_CancelUpload(t.ID);
     }
     LoadList();
 }
Example #8
0
        public static IList <FileUploadModel> GetFiles(string id)
        {
            if (String.IsNullOrEmpty(id))
            {
                return(null);
            }
            var data = new FileUploadData(null);

            return(data.GetById(id));
        }
Example #9
0
 public static string GetFileupload(string id)
 {
     try
     {
         FileUploadModel com = new FileUploadData().GetFileById(int.Parse(id));
         return(JsonConvert.SerializeObject(new { type = 100, msg = com }));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));
     }
 }
Example #10
0
        public static string GetProChildImg(int objId)
        {
            try{
                IList <FileUploadModel> list = new FileUploadData().GetProChildImg(objId);
                return(JsonConvert.SerializeObject(new { type = 100, msg = list }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Example #11
0
        private void ShowImgBind()
        {
            //根据素材id得到素材信息
            WxMaterial wxmaterial = new WxMaterialData().GetWxMaterial(materialid);

            if (wxmaterial != null)
            {
                var identityFileUpload = new FileUploadData().GetFileById(wxmaterial.Imgpath.ToString().ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    headPortraitImgSrc = identityFileUpload.Relativepath;
                }
            }
        }
        public FileId Write(FileUploadData uploadData)
        {
            var id    = FileId.NewId();
            var path  = GetFilePath(id);
            var block = container.GetBlockBlobReference(path);

            block.Metadata[Metadata.FileId]         = id.ToString();
            block.Metadata[Metadata.ContentType]    = uploadData.ContentType;
            block.Metadata[Metadata.OriginalName]   = uploadData.OriginalName;
            block.Metadata[Metadata.DateCreatedUtc] = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);

            block.UploadFromStreamAsync(uploadData.FileStream).ConfigureAwait(false).GetAwaiter().GetResult();
            return(id);
        }
Example #13
0
        private void ShowImgBind(int id)
        {
            //根据产品id得到 产品信息
            B2bModelData modeldate = new B2bModelData();
            var          proo      = modeldate.GetModelMenuById(id);

            if (proo != null)
            {
                var identityFileUpload = new FileUploadData().GetFileById(proo.Imgurl.ToString().ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    headPortraitImgSrc = identityFileUpload.Relativepath;
                }
            }
        }
Example #14
0
        private void ShowImgBind(int roomtypeid)
        {
            //根据产品id得到 房型信息

            B2b_com_roomtype proo = new B2b_com_roomtypeData().GetRoomType(roomtypeid, UserHelper.CurrentCompany.ID);

            if (proo != null)
            {
                var identityFileUpload = new FileUploadData().GetFileById(proo.Roomtypeimg.ToString().ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    headPortraitImgSrc = identityFileUpload.Relativepath;
                }
            }
        }
        public async Task <FileId> WriteAsync(FileUploadData uploadData, CancellationToken cancellationToken)
        {
            var id    = FileId.NewId();
            var path  = GetFilePath(id);
            var block = container.GetBlockBlobReference(path);

            block.Metadata[Metadata.FileId]         = id.ToString();
            block.Metadata[Metadata.ContentType]    = uploadData.ContentType;
            block.Metadata[Metadata.OriginalName]   = uploadData.OriginalName;
            block.Metadata[Metadata.DateCreatedUtc] = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);

            await block.UploadFromStreamAsync(uploadData.FileStream);

            return(id);
        }
 private void ShowImgBind()
 {
     if (UserHelper.ValidateLogin())
     {
         //根据素材id得到素材信息
         MemberShipCardMaterial material = new MemberShipCardMaterialData().GetMembershipcardMaterial(UserHelper.CurrentCompany.ID, materialid);
         if (material != null)
         {
             var identityFileUpload = new FileUploadData().GetFileById(material.Imgpath.ToString().ConvertTo <int>(0));
             if (identityFileUpload != null)
             {
                 headPortraitImgSrc = identityFileUpload.Relativepath;
             }
         }
     }
 }
Example #17
0
        private void ShowImgBind(int proid)
        {
            //根据产品id得到 产品信息

            B2b_com_pro proo = new B2bComProData().GetProById(proid.ToString());

            if (proo != null)
            {
                Source_type = proo.Source_type;
                var identityFileUpload = new FileUploadData().GetFileById(proo.Imgurl.ToString().ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    headPortraitImgSrc = identityFileUpload.Relativepath;
                }
            }
        }
Example #18
0
        private void ShowImgBind()
        {
            var comid = UserHelper.CurrentCompany.ID;
            //根据公司id得到公司附加信息
            B2b_company_info B2bcompanyinfo = new B2bCompanyInfoData().GetCompanyInfo(comid);



            if (B2bcompanyinfo != null)
            {
                FileUploadModel identityFileUpload = new FileUploadData().GetFileById(B2bcompanyinfo.Weixinimg.ConvertTo <int>(0));
                if (identityFileUpload != null)
                {
                    weixinqrcodeurl = identityFileUpload.Relativepath;
                }
            }
        }
Example #19
0
        static FileUploadData FillUploadData(SqlDataReader dr)
        {
            FileUploadData d = new FileUploadData();

            d.Direction        = Convert.ToInt32(dr["Direction"]);
            d.FileLastModified = SQLLib.GetDTUTC(dr["FileLastModified"]);
            d.ID          = Convert.ToInt64(dr["ID"]);
            d.LastUpdated = SQLLib.GetDTUTC(dr["DTUpdated"]);
            d.MachineID   = Convert.ToString(dr["MachineID"]);
            d.MD5CheckSum = Convert.ToString(dr["MD5Sum"]);
            d.OverrideMeteredConnection = Convert.ToInt32(dr["OverrideMeteredConnection"]) == 1 ? true : false;
            d.ProgressSize       = Convert.ToInt64(dr["ProgressSize"]);
            d.RemoteFileLocation = Convert.ToString(dr["RemoteFileLocation"]);
            d.Size        = Convert.ToInt64(dr["Size"]);
            d.RequestOnly = Convert.ToInt32(dr["RequestOnly"]) == 1 ? true : false;
            return(d);
        }
Example #20
0
        private void ShowImgBind()
        {
            var comid = UserHelper.CurrentCompany.ID;

            if (id != 0)
            {
                var imagemodel = B2bCompanyImageData.GetimageLibraryByid(id);
                if (imagemodel != null)
                {
                    usetype = imagemodel.Usetype;
                    modelid = imagemodel.Modelid;

                    FileUploadModel identityFileUpload = new FileUploadData().GetFileById(imagemodel.Imgurl);
                    if (identityFileUpload != null)
                    {
                        headPortraitImgSrc = identityFileUpload.Relativepath;
                    }
                }
            }
        }
Example #21
0
        public void FileUpload(FileUploadData data, FileStream fileStream, string fileName)
        {
            var message       = new HttpRequestMessage();
            var content       = new MultipartFormDataContent();
            var stringContent = new StringContent(data.ToJson());

            stringContent.Headers.Add("Content-Disposition", "form-data;name =\"CaseBaseRequest\"");
            content.Add(stringContent);



            var streamContent = new StreamContent(fileStream);

            streamContent.Headers.Add("Content-Type", "application/octet-stream");
            streamContent.Headers.Add("Content-Disposition", "form-data; name=\"file\";filename =\"" + fileName + "\"");
            content.Add(streamContent, "file", fileName);

            message.Method  = HttpMethod.Post;
            message.Content = content;

            string requestUrl = RequestUrl("FileUpload");

            message.RequestUri = new Uri(requestUrl);
            using (var client = new HttpClient())
            {
                var request      = client.SendAsync(message, HttpCompletionOption.ResponseContentRead, CancellationToken.None);
                var httpResponse = request.Result;
                var statusCode   = httpResponse.StatusCode;
                if (httpResponse.Content == null)
                {
                    // ToDo är detta rätt?!
                    return;
                }
                var stringContentsTask = httpResponse.Content.ReadAsStringAsync();
                var stringContents     = stringContentsTask.Result;
                if (statusCode != System.Net.HttpStatusCode.OK)
                {
                    throw new AbouApiException(statusCode, stringContents);
                }
            }
        }
Example #22
0
        public static string defaultimgurl = "/Images/defaultThumb.png";//默认图片
        public static string GetImgUrl(int imgid)
        {
            string fileUrl = AppSettings.CommonSetting.GetValue("FileUpload/FileUrl").ConvertTo <string>();//文件访问地址

            if (imgid == 0)
            {
                return(defaultimgurl);
            }
            else
            {
                FileUploadModel identityFileUpload = new FileUploadData().GetFileById(imgid);
                if (identityFileUpload != null)
                {
                    return(fileUrl + identityFileUpload.Relativepath);
                }
                else
                {
                    return(defaultimgurl);
                }
            }
        }
Example #23
0
        private void ShowImgBind()
        {
            //var comid = Context.Request["comid"].ConvertTo<int>(0);
            var comid = UserHelper.CurrentCompany.ID;

            if (id != 0)
            {
                B2b_company_image imagemodel = B2bCompanyImageData.GetimageByComid(comid, id);
                if (imagemodel != null)
                {
                    Title   = imagemodel.Title;
                    linkurl = imagemodel.Linkurl;



                    FileUploadModel identityFileUpload = new FileUploadData().GetFileById(imagemodel.Imgurl);
                    if (identityFileUpload != null)
                    {
                        headPortraitImgSrc = identityFileUpload.Relativepath;
                    }
                }
            }
        }
Example #24
0
        private void ShowImgBind()
        {
            //var comid = Context.Request["comid"].ConvertTo<int>(0);
            var comid = UserHelper.CurrentCompany.ID;

            if (id != 0)
            {
                var actdata = new WxAdData();
                var pro     = actdata.Getwxad(id, comid);

                if (pro != null)
                {
                    Adtype  = pro.Adtype;
                    id      = pro.Id;
                    Title   = pro.Title;
                    Link    = pro.Link;
                    Author  = pro.Author;
                    Keyword = pro.Keyword;

                    Applystate = pro.Applystate;
                    Votecount  = pro.Votecount;
                    Lookcount  = pro.Lookcount;

                    Musicid = pro.Musicid;
                    if (Musicid != 0)
                    {
                        Musicscr = FileSerivce.GetImgUrl(Musicid);
                    }

                    FileUploadModel identityFileUpload = new FileUploadData().GetFileById(pro.Musicid);
                    if (identityFileUpload != null)
                    {
                        headPortraitImgSrc = identityFileUpload.Relativepath;
                    }
                }
            }
        }
Example #25
0
        /// <summary>
        /// 删除文件
        /// </summary>
        /// <param name="context"></param>
        private static void DeleteFile(HttpContext context)
        {
            try
            {
                FileUploadModel model = new FileUploadModel();
                if (context.Request["fileUploadId"] != null)
                {
                    int fileUploadId = Convert.ToInt32(context.Request["fileUploadId"]);
                    model = new FileUploadData().GetFileById(fileUploadId);
                    if (model != null)
                    {
                        //删除产品子级图片表
                        new B2bComProData().DelProChildImg(fileUploadId);

                        //删除数据库里的附件信息
                        new FileUploadData().DeleteById(fileUploadId);

                        ImgUploadService upload = new ImgUploadService();
                        //删除文件
                        upload.DelFile(model.Savepath);
                        //File.Delete(model.Savepath);
                    }
                    context.Response.Write("success");
                }
                else
                {
                    //int objId = Convert.ToInt32(context.Request["objId"]);
                    //int objType = Convert.ToInt32(context.Request["objType"]);
                    //model = new FileUploadData().GetFileByObjIdType(objId, objType);
                    context.Response.Write("fail");
                }
            }
            catch (Exception ex)
            {
                context.Response.Write("Exception:" + ex.ToString());
            }
        }
Example #26
0
        private void ShowImgBind()
        {
            //var comid = Context.Request["comid"].ConvertTo<int>(0);
            var comid = UserHelper.CurrentCompany.ID;

            if (id != 0)
            {
                B2b_company_menu menumodel = B2bCompanyMenuData.GetConsultantByComid(comid, id);
                if (menumodel != null)
                {
                    Name    = menumodel.Name;
                    linkurl = menumodel.Linkurl;
                    typeid  = menumodel.Linktype;



                    FileUploadModel identityFileUpload = new FileUploadData().GetFileById(menumodel.Imgurl);
                    if (identityFileUpload != null)
                    {
                        headPortraitImgSrc = identityFileUpload.Relativepath;
                    }
                }
            }
        }
Example #27
0
        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");
            }
        }
Example #28
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;
                }
            }
        }
Example #29
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");
            }
        }
Example #30
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,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
                }
            }
        }