Exemplo n.º 1
0
        /// <summary>
        /// 生成二维码
        /// </summary>
        private string GenerateQR(string path, long shopId, string logo)
        {
            string fileName = shopId + "_QRCode.jpg";

            try
            {
                Bitmap map;
                if (!string.IsNullOrWhiteSpace(logo) && MallIO.ExistFile(logo))
                {
                    map = Core.Helper.QRCodeHelper.Create(path, MallIO.GetImagePath(logo));
                }
                else
                {
                    map = Core.Helper.QRCodeHelper.Create(path);
                }
                string fileFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Storage", "Shop", "VShop");
                string fileFullPath   = Path.Combine(fileFolderPath, fileName);
                if (!Directory.Exists(fileFolderPath))
                {
                    Directory.CreateDirectory(fileFolderPath);
                }
                map.Save(fileFullPath);
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            return("/Storage/Shop/VShop/" + fileName);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取信息内容
        /// </summary>
        /// <returns></returns>
        public static MessageContent GetMessageContentConfig()
        {
            MessageContent config = Core.Cache.Get <MessageContent>("SMSMessageContent") as MessageContent;

            if (config == null)
            {
                //using (FileStream fs = new FileStream(WorkDirectory + "\\Data\\MessageContent.xml", FileMode.Open))
                //{
                //    XmlSerializer xs = new XmlSerializer(typeof(MessageContent));
                //    config = (MessageContent)xs.Deserialize(fs);
                //    Core.Cache.Insert("MessageContent", config);
                //}

                string sDirectory = Mall.Core.Helper.IOHelper.urlToVirtual(WorkDirectory) + "/Data/MessageContent.xml";

                if (MallIO.ExistFile(sDirectory))
                {
                    XmlSerializer xs  = new XmlSerializer(typeof(MessageContent));
                    byte[]        b   = Mall.Core.MallIO.GetFileContent(sDirectory);
                    string        str = System.Text.Encoding.Default.GetString(b);
                    MemoryStream  fs  = new MemoryStream(b);
                    config = (MessageContent)xs.Deserialize(fs);
                    Core.Cache.Insert("SMSMessageContent", config);
                }
            }
            return(config);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取邮件发送内容
        /// </summary>
        /// <returns></returns>
        public static MessageContent GetMessageContentConfig()
        {
            Log.Info("email2---sss");
            MessageContent config = Core.Cache.Get <MessageContent>("EmailMessageContent") as MessageContent;

            if (config == null)
            {
                string sDirectory = Mall.Core.Helper.IOHelper.urlToVirtual(WorkDirectory) + "/Data/MessageContent.xml";

                if (MallIO.ExistFile(sDirectory))
                {
                    XmlSerializer xs  = new XmlSerializer(typeof(MessageContent));
                    byte[]        b   = Mall.Core.MallIO.GetFileContent(sDirectory);
                    string        str = System.Text.Encoding.Default.GetString(b);
                    MemoryStream  fs  = new MemoryStream(b);
                    config = (MessageContent)xs.Deserialize(fs);
                }
                else
                {
                    SaveMessageContentConfig(config);
                }
            }
            Log.Info("email2---eee");
            return(config);
        }
Exemplo n.º 4
0
        private string CreateQR(string shopLogo, string vshopUrl)
        {
            Image qrcode;

            //string logoFullPath = Server.MapPath( vshop.Logo );
            if (string.IsNullOrWhiteSpace(shopLogo) || !MallIO.ExistFile(shopLogo))// || !System.IO.File.Exists( logoFullPath )
            {
                qrcode = Core.Helper.QRCodeHelper.Create(vshopUrl);
            }
            else
            {
                qrcode = Core.Helper.QRCodeHelper.Create(vshopUrl, Core.MallIO.GetRomoteImagePath(shopLogo));
            }

            Bitmap       bmp = new Bitmap(qrcode);
            MemoryStream ms  = new MemoryStream();

            bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            byte[] arr = new byte[ms.Length];
            ms.Position = 0;
            ms.Read(arr, 0, (int)ms.Length);
            ms.Close();

            qrcode.Dispose();
            return(Convert.ToBase64String(arr));
        }
Exemplo n.º 5
0
        public ActionResult Edit(long id)
        {
            GiftViewModel model = new GiftViewModel();
            GiftInfo      data  = new GiftInfo();

            data = _iGiftService.GetById(id);
            if (data == null)
            {
                throw new MallException("错误的礼品编号。");
            }
            model = data.Map <GiftViewModel>();
            //补充图片数据
            if (string.IsNullOrWhiteSpace(model.ImagePath))
            {
                model.ImagePath = string.Format(@"/Storage/Gift/{0}", id);
            }
            string path     = model.ImagePath;
            string paths    = model.ImagePath;
            string _imgpath = paths + "/1.png";

            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl1 = Core.MallIO.GetImagePath(path + "/1.png");
            }
            _imgpath = paths + "/2.png";
            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl2 = Core.MallIO.GetImagePath(path + "/2.png");
            }
            _imgpath = paths + "/3.png";
            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl3 = Core.MallIO.GetImagePath(path + "/3.png");
            }
            _imgpath = paths + "/4.png";
            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl4 = Core.MallIO.GetImagePath(path + "/4.png");
            }
            _imgpath = paths + "/5.png";
            if (MallIO.ExistFile(_imgpath))
            {
                model.PicUrl5 = Core.MallIO.GetImagePath(path + "/5.png");
            }
            #region 会员等级列表
            List <SelectListItem> MemGradeSelList = GetMemberGradeSelectList(model.NeedGrade);
            ViewBag.MemberGradeSelect = MemGradeSelList;
            #endregion

            return(View(model));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取配置
        /// </summary>
        /// <returns></returns>
        public static MessageSMSConfig GetConfig()
        {
            MessageSMSConfig config     = new MessageSMSConfig();
            string           sDirectory = Mall.Core.Helper.IOHelper.urlToVirtual(WorkDirectory) + "/Data/SMS.config";

            if (MallIO.ExistFile(sDirectory))
            {
                XmlSerializer xs  = new XmlSerializer(typeof(MessageSMSConfig));
                byte[]        b   = Mall.Core.MallIO.GetFileContent(sDirectory);
                string        str = System.Text.Encoding.Default.GetString(b);
                MemoryStream  fs  = new MemoryStream(b);
                config = (MessageSMSConfig)xs.Deserialize(fs);
            }
            return(config);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取发送状态
        /// </summary>
        /// <returns></returns>
        public static MessageStatus GetMessageStatus()
        {
            MessageStatus config     = new MessageStatus();
            string        sDirectory = Mall.Core.Helper.IOHelper.urlToVirtual(WorkDirectory) + "/Data/config.xml";

            if (MallIO.ExistFile(sDirectory))
            {
                XmlSerializer xs = new XmlSerializer(typeof(MessageStatus));
                byte[]        b  = Mall.Core.MallIO.GetFileContent(sDirectory);
                MemoryStream  fs = new MemoryStream(b);

                config = (MessageStatus)xs.Deserialize(fs);
            }
            return(config);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取发送状态
        /// </summary>
        /// <returns></returns>
        public static MessageStatus GetMessageStatus()
        {
            Log.Info("email3---sss");
            MessageStatus config     = new MessageStatus();
            string        sDirectory = Mall.Core.Helper.IOHelper.urlToVirtual(WorkDirectory) + "/Data/config.xml";

            if (MallIO.ExistFile(sDirectory))
            {
                XmlSerializer xs  = new XmlSerializer(typeof(MessageStatus));
                byte[]        b   = Mall.Core.MallIO.GetFileContent(sDirectory);
                string        str = System.Text.Encoding.UTF8.GetString(b);
                Log.Info("email2---:" + str);
                MemoryStream fs = new MemoryStream(b);
                config = (MessageStatus)xs.Deserialize(fs);
            }
            Log.Info("email3---eee");
            return(config);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 强制初始产品图片列表
 /// </summary>
 private void CompelInitProductImages()
 {
     if (this.ProductImages == null)
     {
         this.ProductImages = new List <string>();
     }
     if (!string.IsNullOrWhiteSpace(this.ProductImgPath))
     {
         //补充图片地址
         for (var n = 2; n < 6; n++)
         {
             var _imgurl = MallIO.GetProductSizeImage(this.ProductImgPath, n, (int)Mall.CommonModel.ImageSize.Size_350);
             if (MallIO.ExistFile(_imgurl))
             {
                 this.ProductImages.Add(_imgurl);
             }
         }
     }
     isInitImagesed = true;
 }
Exemplo n.º 10
0
        /// <summary>
        /// 获取配置文件
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static T GetConfig(string workDirectory)
        {
            string sDirectory = Mall.Core.Helper.IOHelper.urlToVirtual(workDirectory) + "/data.config";
            T      config     = new T();

            if (MallIO.ExistFile(sDirectory))
            {
                XmlSerializer xs  = new XmlSerializer(typeof(T));
                byte[]        b   = Mall.Core.MallIO.GetFileContent(sDirectory);
                string        str = System.Text.Encoding.Default.GetString(b);
                MemoryStream  fs  = new MemoryStream(b);
                config = (T)xs.Deserialize(fs);
            }
            else
            {
                SaveConfig(config, workDirectory);
            }

            return(config);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取配置
        /// </summary>
        /// <returns></returns>
        public static MessageEmailConfig GetConfig()
        {
            Log.Info("email1---sss");
            string             sDirectory = Mall.Core.Helper.IOHelper.urlToVirtual(WorkDirectory) + "/Data/Email.config";
            MessageEmailConfig config     = new MessageEmailConfig();

            if (MallIO.ExistFile(sDirectory))
            {
                XmlSerializer xs  = new XmlSerializer(typeof(MessageEmailConfig));
                byte[]        b   = Mall.Core.MallIO.GetFileContent(sDirectory);
                string        str = System.Text.Encoding.Default.GetString(b);
                MemoryStream  fs  = new MemoryStream(b);
                config = (MessageEmailConfig)xs.Deserialize(fs);
            }
            else
            {
                SaveConfig(config);
            }

            Log.Info("email1---eee");
            return(config);
        }
Exemplo n.º 12
0
 /// <summary>
 /// XML反序列化
 /// </summary>
 /// <param name="type">目标类型(Type类型)</param>
 /// <param name="filePath">XML文件路径</param>
 /// <returns>序列对象</returns>
 public static object DeserializeFromXMLByOSS(Type type, string filePath)
 {
     try
     {
         string sDirectory = IOHelper.urlToVirtual(filePath);
         if (MallIO.ExistFile(sDirectory))
         {
             XmlSerializer xs  = new XmlSerializer(type);
             byte[]        b   = MallIO.GetFileContent(sDirectory);
             string        str = System.Text.Encoding.Default.GetString(b);
             MemoryStream  fs  = new MemoryStream(b);
             return(xs.Deserialize(fs));
         }
         else
         {
             return(DeserializeFromXML(type, filePath));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 13
0
        public object GetGiftDetail(long id)
        {
            GiftsDetailModel result = new GiftsDetailModel();
            var data = GiftApplication.GetById(id);

            // Mapper.CreateMap<Entities.GiftInfo, GiftsDetailModel>();
            result = data.Map <GiftsDetailModel>();
            if (data == null)
            {
                throw new Exception("礼品信息无效!");
            }
            result.EndDateStr = data.EndDate.ToString("yyyy-MM-dd HH:mm:ss");
            string tmpdefaultimg = result.GetImage(ImageSize.Size_100);

            result.DefaultShowImage = MallIO.GetRomoteImagePath(tmpdefaultimg);
            result.Images           = new List <string>();
            result.Description      = result.Description.Replace("src=\"/Storage/", "src=\"" + Core.MallIO.GetRomoteImagePath("/Storage/") + "/");

            //补充图片信息
            for (var _n = 1; _n < 6; _n++)
            {
                string _imgpath = data.ImagePath + "/" + _n.ToString() + ".png";
                if (MallIO.ExistFile(_imgpath))
                {
                    var tmp = MallIO.GetRomoteImagePath(result.GetImage(ImageSize.Size_500, _n));
                    result.Images.Add(tmp);
                }
            }

            #region 礼品是否可兑
            result.CanBuy = true;
            //礼品信息
            if (result.CanBuy)
            {
                if (result.GetSalesStatus != Mall.Entities.GiftInfo.GiftSalesStatus.Normal)
                {
                    result.CanBuy       = false;
                    result.CanNotBuyDes = "礼品" + result.ShowSalesStatus;
                }
            }

            if (result.CanBuy)
            {
                //库存判断
                if (result.StockQuantity < 1)
                {
                    result.CanBuy       = false;
                    result.CanNotBuyDes = "已兑完";
                }
            }

            if (result.CanBuy)
            {
                //积分数
                if (result.NeedIntegral < 1)
                {
                    result.CanBuy       = false;
                    result.CanNotBuyDes = "礼品信息错误";
                }
            }
            #endregion

            #region 用户信息判断

            if (result.CanBuy && CurrentUser != null)
            {
                //限购数量
                if (result.LimtQuantity > 0)
                {
                    int ownbuynumber = GiftsOrderApplication.GetOwnBuyQuantity(CurrentUser.Id, id);
                    if (ownbuynumber >= result.LimtQuantity)
                    {
                        result.CanBuy       = false;
                        result.CanNotBuyDes = "限兑数量已满";
                    }
                }
                if (result.CanBuy)
                {
                    var userInte = MemberIntegralApplication.GetMemberIntegral(CurrentUserId);
                    if (userInte.AvailableIntegrals < result.NeedIntegral)
                    {
                        result.CanBuy       = false;
                        result.CanNotBuyDes = "积分不足";
                    }
                }
            }
            #endregion
            return(Json(result));
        }
Exemplo n.º 14
0
        public object GetVShopIntroduce(long id)
        {
            var vshop = ServiceProvider.Instance <IVShopService> .Create.GetVShop(id);

            var    env             = EngineContext.Current.Resolve <IWebHostEnvironment>();
            string qrCodeImagePath = string.Empty;

            if (vshop != null)
            {
                Image  qrcode;
                string vshopUrl = CurrentUrlHelper.CurrentUrlNoPort() + "/m-" + PlatformType.WeiXin.ToString() + "/vshop/detail/" + id;
                if (!string.IsNullOrWhiteSpace(vshop.StrLogo) && MallIO.ExistFile(vshop.StrLogo))
                {
                    qrcode = Core.Helper.QRCodeHelper.Create(vshopUrl, MallIO.GetImagePath(vshop.StrLogo));
                }
                else
                {
                    qrcode = Core.Helper.QRCodeHelper.Create(vshopUrl);
                }
                string fileName = DateTime.Now.ToString("yyMMddHHmmssffffff") + ".jpg";
                qrCodeImagePath = CurrentUrlHelper.CurrentUrlNoPort() + "/temp/" + fileName;
                qrcode.Save(env.ContentRootPath + "/temp/" + fileName);
            }
            var  qrCode   = qrCodeImagePath;
            bool favorite = false;

            if (CurrentUser != null)
            {
                favorite = ServiceProvider.Instance <IShopService> .Create.IsFavoriteShop(CurrentUser.Id, vshop.ShopId);
            }

            var mark     = ShopServiceMark.GetShopComprehensiveMark(vshop.ShopId);
            var shopMark = mark.ComprehensiveMark.ToString();

            #region 获取店铺的评价统计
            var shopStatisticOrderComments = ServiceProvider.Instance <IShopService> .Create.GetShopStatisticOrderComments(vshop.ShopId);

            var productAndDescription = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.ProductAndDescription).FirstOrDefault();
            var sellerServiceAttitude = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerServiceAttitude).FirstOrDefault();
            var sellerDeliverySpeed   = shopStatisticOrderComments.Where(c => c.CommentKey ==
                                                                         Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerDeliverySpeed).FirstOrDefault();

            var productAndDescriptionPeer = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.ProductAndDescriptionPeer).FirstOrDefault();
            var sellerServiceAttitudePeer = shopStatisticOrderComments.Where(c => c.CommentKey == Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerServiceAttitudePeer).FirstOrDefault();
            var sellerDeliverySpeedPeer   = shopStatisticOrderComments.Where(c => c.CommentKey ==
                                                                             Entities.StatisticOrderCommentInfo.EnumCommentKey.SellerDeliverySpeedPeer).FirstOrDefault();

            decimal defaultValue           = 5;
            var     _productAndDescription = defaultValue;
            var     _sellerServiceAttitude = defaultValue;
            var     _sellerDeliverySpeed   = defaultValue;
            //宝贝与描述
            if (productAndDescription != null && productAndDescriptionPeer != null)
            {
                _productAndDescription = productAndDescription.CommentValue;
            }
            //卖家服务态度
            if (sellerServiceAttitude != null && sellerServiceAttitudePeer != null)
            {
                _sellerServiceAttitude = sellerServiceAttitude.CommentValue;
            }
            //卖家发货速度
            if (sellerDeliverySpeedPeer != null && sellerDeliverySpeed != null)
            {
                _sellerDeliverySpeed = sellerDeliverySpeed.CommentValue;
            }
            #endregion
            var vshopModel = new
            {
                QRCode                = qrCode,
                Name                  = vshop.Name,
                IsFavorite            = favorite,
                ProductAndDescription = _productAndDescription,
                SellerDeliverySpeed   = _sellerDeliverySpeed,
                SellerServiceAttitude = _sellerServiceAttitude,
                Description           = vshop.Description,
                ShopId                = vshop.ShopId,
                Id = vshop.Id,
                //Logo = "http://" + Url.Request.RequestUri.Host+vshop.Logo
                Logo = Core.MallIO.GetRomoteImagePath(vshop.StrLogo)
            };
            dynamic result = new ExpandoObject();
            result.VShop = vshopModel;
            return(Json(new { result }));
        }
Exemplo n.º 15
0
        public ActionResult ShopDetail()
        {
            //Note:DZY[151010] 有form数据返回,传参暂时不能改
            var shopid = CurrentSellerManager.ShopId;
            var shop   = _iShopService.GetShop(shopid, true);
            var model  = new ShopModel(shop);

            model.BusinessCategory = new List <CategoryKeyVal>();
            foreach (var key in shop.BusinessCategory.Keys)
            {
                var category = _iCategoryService.GetCategory(key);
                model.BusinessCategory.Add(new CategoryKeyVal
                {
                    CommisRate = shop.BusinessCategory[key],
                    Name       = category != null ? category.Name : "分类不存在"
                });
            }
            ViewBag.CompanyRegionIds    = _iRegionService.GetRegionPath(shop.CompanyRegionId);
            ViewBag.BusinessLicenseCert = shop.BusinessLicenseCert;
            //var model= _iShopService.GetShopBasicInfo(shopid);

            string businessLicenseCerts = "";
            string productCerts         = "";
            string otherCerts           = "";

            for (int i = 0; i < 3; i++)
            {
                if (MallIO.ExistFile(shop.BusinessLicenseCert + string.Format("{0}.png", i + 1)))
                {
                    businessLicenseCerts += MallIO.GetImagePath(shop.BusinessLicenseCert + string.Format("{0}.png", i + 1)) + ",";
                }
                else
                {
                    businessLicenseCerts += "null,";
                }
                if (MallIO.ExistFile(shop.ProductCert + string.Format("{0}.png", i + 1)))
                {
                    productCerts += MallIO.GetImagePath(shop.ProductCert + string.Format("{0}.png", i + 1)) + ",";
                }
                else
                {
                    productCerts += "null,";
                }
                if (MallIO.ExistFile(shop.OtherCert + string.Format("{0}.png", i + 1)))
                {
                    otherCerts = MallIO.GetImagePath(shop.OtherCert + string.Format("{0}.png", i + 1)) + ",";
                }
                else
                {
                    otherCerts += "null,";
                }
            }
            ViewBag.BusinessLicenseCerts = businessLicenseCerts.TrimEnd(',');
            ViewBag.ProductCerts         = productCerts.TrimEnd(',');
            ViewBag.OtherCerts           = otherCerts.TrimEnd(',');

            //管理员信息
            long uid   = ShopApplication.GetShopManagers(CurrentSellerManager.ShopId);
            var  mUser = MemberApplication.GetMembers(uid);

            ViewBag.RealName = mUser.RealName;
            var mMemberAccountSafety = MemberApplication.GetMemberAccountSafety(uid);

            ViewBag.MemberEmail = mMemberAccountSafety.Email;
            ViewBag.MemberPhone = mMemberAccountSafety.Phone;

            if (model.BusinessType.Equals(ShopBusinessType.Enterprise))
            {
                return(View(model));
            }
            else
            {
                return(View("ShopPersonalDetail", model));
            }
        }
Exemplo n.º 16
0
        public JsonResult Edit(GiftViewModel model)
        {
            var result = new AjaxReturnData {
                success = false, msg = "未知错误"
            };

            if (ModelState.IsValid)
            {
                GiftViewModel postdata = new GiftViewModel();
                if (model.Id > 0)
                {
                    GiftInfo dbdata = _iGiftService.GetByIdAsNoTracking(model.Id);
                    //数据补充
                    if (dbdata == null)
                    {
                        result.success = false;
                        result.msg     = "编号有误";
                        return(Json(result));
                    }
                    postdata = dbdata.Map <GiftViewModel>();
                }
                else
                {
                    if (model.StockQuantity < 1)
                    {
                        result.success = false;
                        result.msg     = "库存必须大于0";
                        return(Json(result));
                    }
                }
                // UpdateModel(postdata);
                GiftInfo data = new GiftInfo();
                data = postdata.Map <GiftInfo>();
                if (model.Id > 0)
                {
                    _iGiftService.UpdateGift(data);
                }
                else
                {
                    data.Sequence    = 100;
                    data.AddDate     = DateTime.Now;
                    data.SalesStatus = GiftInfo.GiftSalesStatus.Normal;
                    _iGiftService.AddGift(data);
                }

                #region 转移图片
                int           index   = 1;
                List <string> piclist = new List <string>();

                piclist.Add(model.PicUrl1);
                piclist.Add(model.PicUrl2);
                piclist.Add(model.PicUrl3);
                piclist.Add(model.PicUrl4);
                piclist.Add(model.PicUrl5);

                string path = data.ImagePath;
                foreach (var item in piclist)
                {
                    if (!string.IsNullOrWhiteSpace(item))
                    {
                        string source = string.Empty;

                        if (item.IndexOf("temp/") > 0)
                        {
                            source = item.Substring(item.LastIndexOf("/temp"));
                        }
                        else if (item.Contains(data.ImagePath))
                        {
                            source = item.Substring(item.LastIndexOf(data.ImagePath));
                        }

                        try
                        {
                            string dest = string.Format("{0}/{1}.png", path, index);
                            if (source == dest)
                            {
                                index++;
                                continue;
                            }
                            if (!string.IsNullOrWhiteSpace(source))
                            {
                                Core.MallIO.CopyFile(source, dest, true);
                            }
                            var imageSizes = EnumHelper.ToDictionary <ImageSize>().Select(t => t.Key);

                            foreach (var imageSize in imageSizes)
                            {
                                string size = string.Format("{0}/{1}_{2}.png", path, index, imageSize);
                                Core.MallIO.CreateThumbnail(dest, size, imageSize, imageSize);
                            }

                            //using (Image image = Image.FromFile(source))
                            //{

                            //    image.Save(dest, System.Drawing.Imaging.ImageFormat.Png);

                            //    var imageSizes = EnumHelper.ToDictionary<GiftInfo.ImageSize>().Select(t => t.Key);
                            //    foreach (var imageSize in imageSizes)
                            //    {
                            //        string size = string.Format("{0}/{1}_{2}.png", path, index, imageSize);
                            //        ImageHelper.CreateThumbnail(dest, size, imageSize, imageSize);
                            //    }

                            //}
                            index++;
                        }
                        catch (FileNotFoundException fex)
                        {
                            index++;
                            Core.Log.Error("发布礼品时候,没有找到文件", fex);
                        }
                        catch (System.Runtime.InteropServices.ExternalException eex)
                        {
                            index++;
                            Core.Log.Error("发布礼品时候,ExternalException异常", eex);
                        }
                        catch (Exception ex)
                        {
                            index++;
                            Core.Log.Error("发布礼品时候,Exception异常", ex);
                        }
                    }
                    else
                    {
                        string dest = string.Format("{0}/{1}.png", path, index);
                        if (MallIO.ExistFile(dest))
                        {
                            MallIO.DeleteFile(dest);
                        }

                        var imageSizes = EnumHelper.ToDictionary <ImageSize>().Select(t => t.Key);
                        foreach (var imageSize in imageSizes)
                        {
                            string size = string.Format("{0}/{1}_{2}.png", path, index, imageSize);
                            if (MallIO.ExistFile(size))
                            {
                                MallIO.DeleteFile(size);
                            }
                        }
                        index++;
                    }
                }

                #endregion

                result.success = true;
                result.msg     = "操作成功";
            }
            else
            {
                result.success = false;
                result.msg     = "数据有误";
            }

            return(Json(result));
        }
Exemplo n.º 17
0
        /// <summary>
        /// 商家入驻第二部
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static ShopProfileStep1 GetShopProfileStep1(long id, out long CompanyRegionId, out long BusinessLicenceRegionId, out string RefuseReason)
        {
            var shop = Service.GetShop(id);

            var step1 = new ShopProfileStep1();

            step1.Address = shop.CompanyAddress;


            step1.BusinessLicenceArea        = shop.BusinessLicenceRegionId;
            step1.BusinessLicenceNumber      = shop.BusinessLicenceNumber;
            step1.BusinessLicenceNumberPhoto = shop.BusinessLicenceNumberPhoto;
            if (shop.BusinessLicenceEnd.HasValue)
            {
                step1.BusinessLicenceValidEnd = shop.BusinessLicenceEnd.Value;
            }

            if (shop.BusinessLicenceStart.HasValue)
            {
                step1.BusinessLicenceValidStart = shop.BusinessLicenceStart.Value;
            }
            string BusinessLicenseCert = string.Empty;

            for (int i = 1; i < 4; i++)
            {
                if (MallIO.ExistFile(shop.BusinessLicenseCert + string.Format("{0}.png", i)))
                {
                    BusinessLicenseCert += shop.BusinessLicenseCert + string.Format("{0}.png", i) + ",";
                }
            }
            step1.BusinessLicenseCert = BusinessLicenseCert.TrimEnd(',');
            step1.BusinessSphere      = shop.BusinessSphere;
            step1.CityRegionId        = shop.CompanyRegionId;
            if (shop.CompanyFoundingDate.HasValue)
            {
                step1.CompanyFoundingDate = shop.CompanyFoundingDate.Value;
            }
            step1.CompanyName           = shop.CompanyName;
            step1.ContactName           = shop.ContactsName;
            step1.ContactPhone          = shop.ContactsPhone;
            step1.Email                 = shop.ContactsEmail;
            step1.EmployeeCount         = shop.CompanyEmployeeCount;
            step1.GeneralTaxpayerPhoto  = shop.GeneralTaxpayerPhot;
            step1.legalPerson           = shop.legalPerson;
            step1.OrganizationCode      = shop.OrganizationCode;
            step1.OrganizationCodePhoto = shop.OrganizationCodePhoto;
            step1.BusinessType          = shop.BusinessType;

            string OtherCert = string.Empty;

            for (int i = 1; i < 4; i++)
            {
                if (MallIO.ExistFile(shop.OtherCert + string.Format("{0}.png", i)))
                {
                    OtherCert += shop.OtherCert + string.Format("{0}.png", i) + ",";
                }
            }
            step1.OtherCert = OtherCert.TrimEnd(',');
            step1.Phone     = shop.CompanyPhone;

            string ProductCert = string.Empty;

            for (int i = 1; i < 4; i++)
            {
                if (MallIO.ExistFile(shop.ProductCert + string.Format("{0}.png", i)))
                {
                    ProductCert += shop.ProductCert + string.Format("{0}.png", i) + ",";
                }
            }
            step1.ProductCert         = ProductCert.TrimEnd(',');
            step1.RegisterMoney       = shop.CompanyRegisteredCapital;
            step1.taxRegistrationCert = shop.TaxRegistrationCertificate;
            step1.Settled             = GetSettled();

            CompanyRegionId         = shop.CompanyRegionId;
            BusinessLicenceRegionId = shop.BusinessLicenceRegionId;
            RefuseReason            = null;
            if (shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.Refuse)
            {
                RefuseReason = shop.RefuseReason;
            }

            return(step1);
        }