示例#1
0
        public bool DeleteUniqueStyles(UniqueStyle delStyle)
        {
            try
            {
                _DbContext.UniqueStyles.Attach(delStyle);
                _DbContext.UniqueStyles.Remove(delStyle);
                _DbContext.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            { return(false); }
        }
示例#2
0
        public bool DeleteUniqueStyles(int pID)
        {
            try
            {
                UniqueStyle delStyle = new UniqueStyle()
                {
                    ID = pID
                };
                _DbContext.UniqueStyles.Attach(delStyle);
                _DbContext.UniqueStyles.Remove(delStyle);
                _DbContext.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            { return(false); }
        }
示例#3
0
        public int AddNewUniqueStyle(int?pClassId, string pText, string pFillColor, string pStrokColor, double?pStrokWidth, double?pWidth)
        {
            try
            {
                UniqueStyle newStyle = new UniqueStyle();
                int         id       = -1;


                newStyle            = _DbContext.UniqueStyles.Create();
                newStyle.CLASS_ID   = pClassId;
                newStyle.TEXT       = pText;
                newStyle.FillColor  = pFillColor;
                newStyle.StrokColor = pStrokColor;
                newStyle.StrokWidth = pStrokWidth;
                newStyle.Width      = pWidth;
                _DbContext.UniqueStyles.Add(newStyle);
                _DbContext.SaveChanges();
                id = newStyle.ID;

                return(id);
            }
            catch { return(-1); }
        }
示例#4
0
        public bool UpdateUniqueStyle(UniqueStyle pUniqueStyles)
        {
            try
            {
                UniqueStyle updateStyle = new UniqueStyle()
                {
                    ID = pUniqueStyles.ID
                };


                updateStyle            = _DbContext.UniqueStyles.Attach(updateStyle);
                updateStyle.CLASS_ID   = pUniqueStyles.CLASS_ID;
                updateStyle.TEXT       = pUniqueStyles.TEXT;
                updateStyle.FillColor  = pUniqueStyles.FillColor;
                updateStyle.StrokColor = pUniqueStyles.StrokColor;
                updateStyle.StrokWidth = pUniqueStyles.StrokWidth;
                updateStyle.Width      = pUniqueStyles.Width;
                _DbContext.SaveChanges();

                return(true);
            }
            catch { return(false); }
        }