Example #1
0
        public void DeleteImage(Guid imageID)
        {
            var img = Imgs.Where(i => i.ImageID == imageID).SingleOrDefault();

            if (img == null)
            {
                return;
            }

            Imgs.DeleteOnSubmit(img);
            SubmitChanges();
        }
Example #2
0
        public IQueryable <Data.FootPrintImg> UpdateFootPrintRotatedImage(long imgId, string imageKey)
        {
            ExceptionHelper.ThrowIfNotId(imgId, nameof(imgId));
            ExceptionHelper.ThrowIfNullOrWhiteSpace(imageKey, nameof(imageKey));
            var img = Imgs.FirstOrDefault(p => p.id == imgId);

            ExceptionHelper.ThrowIfTrue(img == null, nameof(img), "该图片不存在");
            ExceptionHelper.ThrowIfTrue(img.isEnabled != true, nameof(img), "该图片审核不通过,不可进行旋转后保存操作");
            img.imageKey = imageKey;
            _FootPrintImgRepository.SaveChanges();
            return(Imgs);
        }
Example #3
0
 public IQueryable <Data.FootPrintImg> SetFootPrintImageIsEnabled(long operatorId, long imgId, bool isEnabled)
 {
     ExceptionHelper.ThrowIfNotId(imgId, nameof(imgId));
     using (var scope = new TransactionScope())
     {
         var img = Imgs.FirstOrDefault(p => p.id == imgId);
         ExceptionHelper.ThrowIfTrue(img == null, nameof(img), "该图片不存在");
         img.isEnabled   = isEnabled;
         img.isComfirm   = true;
         img.comfirmDate = DateTime.Now;
         img.comfirmer   = operatorId;
         _FootPrintImgRepository.SaveChanges();
         scope.Complete();
         return(Imgs);
     }
 }
Example #4
0
        public WeProductBase(string[] categoryIds, WeProductProperty[] propertys, string name, SkuInfo[] skuInfos,
                             string mainImg, string[] imgs, WeProductDetail[] details)
            : this(name, mainImg)
        {
            TkDebug.AssertArgumentNull(categoryIds, "categoryIds", null);
            TkDebug.AssertArgumentNull(propertys, "propertys", null);
            TkDebug.AssertArgumentNull(skuInfos, "propertys", null);
            TkDebug.AssertArgumentNull(imgs, "img", null);
            TkDebug.AssertArgumentNull(details, "details", null);

            CategoryIds.AddRange(categoryIds);
            Properties.AddRange(propertys);
            SkuInfos.AddRange(skuInfos);
            Imgs.AddRange(imgs);
            Details.AddRange(details);
        }
Example #5
0
        public WeProductBase(string categoryId, WeProductProperty property, string name, SkuInfo skuInfo,
                             string mainImg, string img, WeProductDetail detail)
            : this(name, mainImg)
        {
            TkDebug.AssertArgumentNullOrEmpty(categoryId, "categoryId", null);
            TkDebug.AssertArgumentNull(property, "property", null);
            TkDebug.AssertArgumentNull(skuInfo, "skuInfo", null);
            TkDebug.AssertArgumentNullOrEmpty(img, "img", null);
            TkDebug.AssertArgumentNull(detail, "detail", null);

            CategoryIds.Add(categoryId);
            Properties.Add(property);
            SkuInfos.Add(skuInfo);
            Imgs.Add(img);
            Details.Add(detail);
        }
Example #6
0
        public void UpdateImage(Guid imageID, byte[] data, string name)
        {
            var img = Imgs.Where(i => i.ImageID == imageID).SingleOrDefault();

            if (img == null)
            {
                img = new Img {
                    ImageID = imageID, Data = data, Name = name
                };
                Imgs.InsertOnSubmit(img);
            }
            else
            {
                img.Data = data;
                img.Name = name;
            }
            SubmitChanges();
        }
Example #7
0
        private void InitUI()
        {
            MainViewManage.MainView = this.mainPanel;
            //添加按钮列
            List <HomePageNodeModel> modelList = XMLDataManage.GetNodesXML();

            for (int i = modelList.Count - 1; i >= 0; i--)
            {
                HomePageNodeModel nodeModel = modelList[i];
                SimpleButton      button    = new SimpleButton();
                button.Text                 = nodeModel.nodeName;
                button.ButtonStyle          = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
                button.Appearance.BackColor = NOR_BACK_COLOR;
                button.Size                 = new Size(50, 40);
                button.ForeColor            = Color.White;
                button.Font                 = new Font("宋体", 12, GraphicsUnit.Pixel);
                button.Margin               = new Padding(0);
                button.Padding              = new Padding(0);
                button.Dock                 = DockStyle.Top;
                button.AllowFocus           = false;
                button.ShowFocusRectangle   = DevExpress.Utils.DefaultBoolean.False;
                //button.ImageToTextAlignment = ImageAlignToText.LeftCenter;
                button.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
                button.Click += Button_Click;
                button.Tag    = nodeModel;
                button.Paint += Button_Paint;
                if (nodeModel.imgName == null || nodeModel.imgName == "")
                {
                    button.Image = Imgs.icon_huiyuan;
                }
                else
                {
                    button.Image = Imgs.GetBitImg(nodeModel.imgName);
                }
                this.functionPanel.Controls.Add(button);
                Image img = Imgs.GetBitImg(nodeModel.imgName);
            }
            ////添加首页视图
            AddHomePageView();
            //添加系统消息监听
            AddMsgDelegate();
        }
Example #8
0
 public IQueryable <Data.FootPrintImg> SetFootPrintImgOrder(long imgId, int order)
 {
     ExceptionHelper.ThrowIfNotId(imgId, nameof(imgId));
     ExceptionHelper.ThrowIfTrue(order <= 0, nameof(order));
     using (var scope = new TransactionScope())
     {
         var oldCover = Imgs.FirstOrDefault(p => p.order == order);
         if (oldCover != null)
         {
             oldCover.order = null;
         }
         var img = Imgs.FirstOrDefault(p => p.id == imgId);
         ExceptionHelper.ThrowIfTrue(img == null, nameof(img), "该图片不存在");
         ExceptionHelper.ThrowIfTrue(img.isEnabled != true, nameof(img), "该图片审核不通过,不可设置为封面");
         img.order = order;
         _FootPrintImgRepository.SaveChanges();
         scope.Complete();
         return(Imgs);
     }
 }
Example #9
0
        public override string ToString()
        {
            string json = string.Concat(
                __jsonIgnore.ContainsKey("Category_id") ? string.Empty : string.Format(", Category_id : {0}", Category_id == null ? "null" : Category_id.ToString()),
                __jsonIgnore.ContainsKey("Content") ? string.Empty : string.Format(", Content : {0}", Content == null ? "null" : string.Format("'{0}'", Content.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))),
                __jsonIgnore.ContainsKey("Create_time") ? string.Empty : string.Format(", Create_time : {0}", Create_time == null ? "null" : string.Concat("", Create_time.Value.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds, "")),
                __jsonIgnore.ContainsKey("Id") ? string.Empty : string.Format(", Id : {0}", Id == null ? "null" : Id.ToString()),
                __jsonIgnore.ContainsKey("Imgs") ? string.Empty : string.Format(", Imgs : {0}", Imgs == null ? "null" : string.Format("'{0}'", Imgs.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))),
                __jsonIgnore.ContainsKey("Name") ? string.Empty : string.Format(", Name : {0}", Name == null ? "null" : string.Format("'{0}'", Name.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))),
                __jsonIgnore.ContainsKey("Stock") ? string.Empty : string.Format(", Stock : {0}", Stock == null ? "null" : Stock.ToString()),
                __jsonIgnore.ContainsKey("Title") ? string.Empty : string.Format(", Title : {0}", Title == null ? "null" : string.Format("'{0}'", Title.Replace("\\", "\\\\").Replace("\r\n", "\\r\\n").Replace("'", "\\'"))),
                __jsonIgnore.ContainsKey("Update_time") ? string.Empty : string.Format(", Update_time : {0}", Update_time == null ? "null" : string.Concat("", Update_time.Value.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds, "")), " }");

            return(string.Concat("{", json.Substring(1)));
        }
Example #10
0
        private void Button_Click(object sender, EventArgs e)
        {
            HomePageNodeModel nodeModel = (HomePageNodeModel)(((SimpleButton)sender).Tag);
            //列表类型
            bool isList = nodeModel.childNodes.Count > 0;


            if (selectButton == sender && !isList)
            {
                return;
            }

            //设置回原来的样子
            if (selectButton != null)
            {
                HomePageNodeModel selectNodeModel = (HomePageNodeModel)(selectButton.Tag);
                selectButton.ForeColor            = Color.White;
                selectButton.Appearance.BackColor = NOR_BACK_COLOR;
                if (selectNodeModel.imgName == null || selectNodeModel.imgName == "")
                {
                    selectButton.Image = Imgs.icon_huiyuan;
                }
                else
                {
                    selectButton.Image = Imgs.GetBitImg(selectNodeModel.imgName);
                }
            }

            //设置成选择状态
            selectButton                      = sender as SimpleButton;
            selectButton.ForeColor            = Color.FromArgb(108, 140, 190);
            selectButton.Appearance.BackColor = SEL_BACK_COLOR;
            if (nodeModel.selName == null || nodeModel.selName == "")
            {
                selectButton.Image = Imgs.icon_huiyuan2;
            }
            else
            {
                selectButton.Image = Imgs.GetBitImg(nodeModel.selName);
            }
            //判断是否有子菜单
            //设置右键弹出框
            if (isList)
            {
                this.popupMenu1.ClearLinks();
                foreach (HomePageNodeModel model in nodeModel.childNodes)
                {
                    BarButtonItem item = new BarButtonItem();
                    item.Caption    = model.nodeName;
                    item.Tag        = model.nodeid;
                    item.ItemClick += Item_ItemClick;
                    this.popupMenu1.AddItem(item);
                }

                Point screenPoint = selectButton.PointToScreen(new Point(selectButton.Width, 0));
                popupMenu1.ShowPopup(screenPoint);
            }
            else
            {
                //显示右侧内容列表
                ShowView(nodeModel);
            }
        }