Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var comid = UserHelper.CurrentCompany.ID;

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

            BindHeadPortrait();
            ShowImgBind();

            B2bModelData mdate = new B2bModelData();
            //判断模板,进行跳转
            var h5model = mdate.SelectModelSearchComid(comid);

            if (h5model != null)
            {
                Modelid = h5model.Modelid;
            }


            if (Modelid != 0)
            {
                var modeldata = new B2bModelData();
                var modelinfo = modeldata.GetModelById(Modelid);
                if (modelinfo != null)
                {
                    Daohangimg = modelinfo.Daohangimg;
                }
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var comid = UserHelper.CurrentCompany.ID;

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

            BindHeadPortrait();
            ShowImgBind();
            B2bModelData mdate = new B2bModelData();
            //判断模板,进行跳转
            var h5model = mdate.SelectModelSearchComid(comid);

            if (h5model != null)
            {
                Modelid = h5model.Modelid;
            }

            if (Modelid != 0)
            {
                var modeldata = new B2bModelData();
                var modelinfo = modeldata.GetModelById(Modelid);
                if (modelinfo != null)
                {
                    bjimage_w = modelinfo.Bgimage_w;
                    bjimage_h = modelinfo.Bgimage_h;
                }
            }

            if (bjimage_h != 0)
            {
                bgtishi = "图片大小 高:" + bjimage_h + "px 宽:" + bjimage_w + "px .请对图片进行处理,上传过大图片会影响浏览!";
            }
        }
Пример #3
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;
                        }
                    }
                }
            }
        }
Пример #4
0
        public static string GetModelById(int modelid)
        {
            try
            {
                B2bModelData modedata = new B2bModelData();
                var          list     = modedata.GetModelById(modelid);
                if (list == null)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "没有查询到列表", totalCount = 0 }));
                }
                return(JsonConvert.SerializeObject(new { type = 100, msg = list }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var          comid = UserHelper.CurrentCompany.ID;
            B2bModelData mdate = new B2bModelData();
            //判断模板,进行跳转
            var h5model = mdate.SelectModelSearchComid(comid);

            if (h5model != null)
            {
                Modelid = h5model.Modelid;
            }


            if (Modelid != 0)
            {
                var modelinfo = mdate.GetModelById(Modelid);
                if (modelinfo != null)
                {
                    Daohangimg = modelinfo.Daohangimg;
                }
            }
        }
Пример #6
0
        public static string GetimageLibraryList(int usetype, int pageindex, int pagesize, int modelid = 0)
        {
            int totalcount = 0;

            try
            {
                B2bCompanyImageData modedata = new B2bCompanyImageData();
                var modelmodel = new B2bModelData();
                var list       = modedata.GetimageLibraryList(usetype, pageindex, pagesize, out totalcount, modelid);
                if (list == null)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "没有查询到图片", totalCount = 0 }));
                }

                IEnumerable result = "";
                if (list != null)
                {
                    result = from pro in list
                             select new
                    {
                        Id             = pro.Id,
                        Imgurl_address = FileSerivce.GetImgUrl(pro.Imgurl),
                        Imgurl         = pro.Imgurl,
                        Usetype        = pro.Usetype,
                        Width          = pro.Width,
                        Height         = pro.Height,
                        ModelName      = modelmodel.GetModelById(pro.Modelid) == null ? "" : modelmodel.GetModelById(pro.Modelid).Title
                    };
                }

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

                throw;
            }
        }
Пример #7
0
        /// <summary>
        ///  选定模板
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public static string SelectModel(int modelid, int comid)
        {
            using (var helper = new SqlHelper())
            {
                int totalcount  = 0;
                int totalcount1 = 0;
                try
                {
                    B2bModelData modeldata    = new B2bModelData();
                    var          b2bmodel     = modeldata.GetModelById(modelid);
                    var          b2bmodelmenu = modeldata.ModelMenuPageList(modelid, 1, 100, out totalcount);

                    if (b2bmodel != null)
                    {
                        var delemodel = modeldata.DeleteSelectModel(comid);//删除已选择模板

                        H5_html model = new H5_html();
                        model.Comid     = comid;
                        model.Modelid   = modelid;
                        model.Style_str = b2bmodel.Style_str;
                        model.Html_str  = b2bmodel.Html_str;

                        //插入模板
                        int orderid = modeldata.SelectModel(model);

                        //原有图片都下线
                        var saledata   = new B2bCompanyImageData();
                        var bannerlist = saledata.UpAllDownState(comid);


                        //插入默认banner(也用于背景图片),重新选择模板后可能重复插入
                        B2bCompanyImageData modedata = new B2bCompanyImageData();
                        var imglist = modedata.GettypemodelidimageLibraryList(1, modelid, 1, 3, out totalcount1);
                        if (imglist != null)
                        {
                            for (int i = 0; i < imglist.Count; i++)
                            {
                                B2b_company_image imagemodel = new B2b_company_image()
                                {
                                    Id               = 0,
                                    Com_id           = comid,
                                    Typeid           = 0,
                                    Imgurl           = imglist[i].Imgurl,
                                    Linkurl          = "#",
                                    Title            = "#",
                                    Channelcompanyid = 0,
                                };
                                var crmid = saledata.InsertOrUpdate(imagemodel);
                            }
                        }


                        if (b2bmodelmenu != null)//首先判断模板里是否有默认栏目
                        {
                            var insertmenu = 0;
                            var imagedata  = new B2bCompanyMenuData();
                            var list       = imagedata.GetMenuList(comid, 1, 10, out totalcount);//如果已经有菜单的模板将不删除菜单,以后可增加判断是否删除菜单,有利于方便切换模板导航不需要重复修改,但容易出现因栏目图片不符新模板而影响使用。可先删除已有模板再进行切换

                            if (totalcount == 0)
                            {
                                insertmenu = modeldata.InsertSelectModelMenu(modelid, comid);//插入已选择模板菜单
                            }

                            //var deletemenu= modeldata.DeleteSelectModelMenu(comid);//删除已选择模板菜单
                            return(JsonConvert.SerializeObject(new { type = 100, msg = insertmenu }));
                        }
                    }

                    return(JsonConvert.SerializeObject(new { type = 1, msg = "选择模板错误,请重新尝试" }));
                }
                catch (Exception ex)
                {
                    helper.Rollback();
                    return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));
                }
            }
        }