コード例 #1
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <StampTypeInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <StampTypeInfo> list = new List <StampTypeInfo>();

            Query q = StampType.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            StampTypeCollection collection = new  StampTypeCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (StampType stampType  in collection)
            {
                StampTypeInfo stampTypeInfo = new StampTypeInfo();
                LoadFromDAL(stampTypeInfo, stampType);
                list.Add(stampTypeInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Stamp" /> class.
 /// </summary>
 /// <param name="Type">Gets the stamp type. (required).</param>
 /// <param name="Background">Sets or gets a bool value that indicates the content is stamped as background. If the value is true, the stamp content is layed at the bottom. By defalt, the value is false, the stamp content is layed at the top..</param>
 /// <param name="BottomMargin">Gets or sets bottom margin of stamp..</param>
 /// <param name="HorizontalAlignment">Gets or sets Horizontal alignment of stamp on the page. .</param>
 /// <param name="LeftMargin">Gets or sets left margin of stamp..</param>
 /// <param name="Opacity">Gets or sets a value to indicate the stamp opacity. The value is from 0.0 to 1.0. By default the value is 1.0..</param>
 /// <param name="RightMargin">Gets or sets right margin of stamp..</param>
 /// <param name="Rotate">Sets or gets the rotation of stamp content according  values. Note. This property is for set angles which are multiples of 90 degrees (0, 90, 180, 270 degrees). To set arbitrary angle use RotateAngle property.  If angle set by ArbitraryAngle is not multiple of 90 then Rotate property returns Rotation.None..</param>
 /// <param name="RotateAngle">Gets or sets rotate angle of stamp in degrees. This property allows to set arbitrary rotate angle. .</param>
 /// <param name="TopMargin">Gets or sets top margin of stamp..</param>
 /// <param name="VerticalAlignment">Gets or sets vertical alignment of stamp on page..</param>
 /// <param name="XIndent">Horizontal stamp coordinate, starting from the left..</param>
 /// <param name="YIndent">Vertical stamp coordinate, starting from the bottom..</param>
 /// <param name="Zoom">Zooming factor of the stamp. Allows to scale stamp..</param>
 /// <param name="TextAlignment">Alignment of the text inside the stamp..</param>
 /// <param name="Value">Gets or sets string value which is used as stamp on the page..</param>
 /// <param name="TextState">Gets text properties of the stamp. See  for details..</param>
 /// <param name="FileName">Gets or sets the file name..</param>
 /// <param name="Width">Gets or sets image width. Setting this property allos to scal image horizontally..</param>
 /// <param name="Height">Gets or sets image height. Setting this image allows to scale image vertically..</param>
 /// <param name="PageIndex">Gets or sets the index of the page..</param>
 /// <param name="StartingNumber">Gets or sets value of the number of starting page. Other pages will be numbered starting from this value..</param>
 public Stamp(StampType Type = default(StampType), bool?Background = default(bool?), double?BottomMargin = default(double?), HorizontalAlignment HorizontalAlignment = default(HorizontalAlignment), double?LeftMargin = default(double?), double?Opacity = default(double?), double?RightMargin = default(double?), Rotation Rotate = default(Rotation), double?RotateAngle = default(double?), double?TopMargin = default(double?), VerticalAlignment VerticalAlignment = default(VerticalAlignment), double?XIndent = default(double?), double?YIndent = default(double?), double?Zoom = default(double?), HorizontalAlignment TextAlignment = default(HorizontalAlignment), string Value = default(string), TextState TextState = default(TextState), string FileName = default(string), double?Width = default(double?), double?Height = default(double?), int?PageIndex = default(int?), int?StartingNumber = default(int?))
 {
     // to ensure "Type" is required (not null)
     if (Type == null)
     {
         throw new InvalidDataException("Type is a required property for Stamp and cannot be null");
     }
     else
     {
         this.Type = Type;
     }
     this.Background          = Background;
     this.BottomMargin        = BottomMargin;
     this.HorizontalAlignment = HorizontalAlignment;
     this.LeftMargin          = LeftMargin;
     this.Opacity             = Opacity;
     this.RightMargin         = RightMargin;
     this.Rotate            = Rotate;
     this.RotateAngle       = RotateAngle;
     this.TopMargin         = TopMargin;
     this.VerticalAlignment = VerticalAlignment;
     this.XIndent           = XIndent;
     this.YIndent           = YIndent;
     this.Zoom           = Zoom;
     this.TextAlignment  = TextAlignment;
     this.Value          = Value;
     this.TextState      = TextState;
     this.FileName       = FileName;
     this.Width          = Width;
     this.Height         = Height;
     this.PageIndex      = PageIndex;
     this.StartingNumber = StartingNumber;
 }
コード例 #3
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
        //数据持久化
        internal static void  SaveToDb(StampTypeInfo pStampTypeInfo, StampType pStampType, bool pIsNew)
        {
            pStampType.StampTypeId = pStampTypeInfo.stampTypeId;
            pStampType.StampName   = pStampTypeInfo.stampName;
            pStampType.IsNew       = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pStampType.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(StampTypeInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pStampTypeInfo.stampTypeId = pStampType.StampTypeId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(StampTypeInfo)))
            {
                ResetCache();
            }
        }
コード例 #4
0
 public AppFilter(bool internalOnly = true) : base(ResourceType.App, internalOnly)
 {
     this.AppType      = AppType.All;
     this.PlatformType = PlatformType.Windows | PlatformType.Linux;
     this.StackType    = StackType.All;
     this.StampType    = StampType.All;
 }
コード例 #5
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
 /// <summary>
 /// 保存
 /// </summary>
 public override void Save()
 {
     if (!m_Loaded)           //新增
     {
         StampType stampType = new StampType();
         SaveToDb(this, stampType, true);
     }
     else            //修改
     {
         StampType stampType = new StampType(stampTypeId);
         if (stampType.IsNew)
         {
             throw new AppException("该数据已经不存在了");
         }
         SaveToDb(this, stampType, false);
     }
 }
コード例 #6
0
        public async Task <IActionResult> Post([FromBody] StampTypeView type)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var stampType = new StampType()
            {
                Name = type.Name, Desc = type.Desc
            };
            await db.StampTypes.AddAsync(stampType);

            await db.SaveAsync();

            return(Ok(stampType));
        }
コード例 #7
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
        /// <summary>
        /// 删除
        /// </summary>
        /// <returns>是否成功</returns>
        public override void Delete()
        {
            if (!m_Loaded)
            {
                throw new AppException("尚未初始化");
            }
            bool result = (StampType.Delete(StampTypeId) == 1);

            //更新缓存
            if (result && CachedEntityCommander.IsTypeRegistered(typeof(StampTypeInfo)))
            {
                ResetCache();
            }
            if (!result)
            {
                throw new AppException("删除失败,数据可能被删除");
            }
        }
コード例 #8
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
 private void LoadFromId(int stampTypeId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(StampTypeInfo)))
     {
         StampTypeInfo stampTypeInfo = Find(GetList(), stampTypeId);
         if (stampTypeInfo == null)
         {
             throw new AppException("未能在缓存中找到相应的键值对象");
         }
         Copy(stampTypeInfo, this);
     }
     else
     {
         StampType stampType = new StampType(stampTypeId);
         if (stampType.IsNew)
         {
             throw new AppException("尚未初始化");
         }
         LoadFromDAL(this, stampType);
     }
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StampInfo" /> class.
 /// </summary>
 /// <param name="Links">Link to the document.</param>
 /// <param name="Id">Gets ID of the stamp.</param>
 /// <param name="IndexOnPage">Gets index on page of the stamp.</param>
 /// <param name="PageIndex">Gets PageIndex of the annotation.</param>
 /// <param name="Rect">Gets Rect of the annotation.</param>
 /// <param name="Text">Get the text content.</param>
 /// <param name="Visible">Gets the stamp is visible.</param>
 /// <param name="StampType">Gets stamp type. (required)</param>
 public StampInfo(List <Link> Links = default(List <Link>), string Id = default(string), int?IndexOnPage = default(int?), int?PageIndex = default(int?), Rectangle Rect = default(Rectangle), string Text = default(string), bool?Visible = default(bool?), StampType StampType = default(StampType))
 {
     // to ensure "StampType" is required (not null)
     if (StampType == null)
     {
         throw new InvalidDataException("StampType is a required property for StampInfo and cannot be null");
     }
     else
     {
         this.StampType = StampType;
     }
     this.Links       = Links;
     this.Id          = Id;
     this.IndexOnPage = IndexOnPage;
     this.PageIndex   = PageIndex;
     this.Rect        = Rect;
     this.Text        = Text;
     this.Visible     = Visible;
 }
コード例 #10
0
 /// <summary>
 /// Является ли тип штампа основным
 /// </summary>
 public static bool IsStampTypeMain(StampType stampType) => StampMainTypes.Contains(stampType);
コード例 #11
0
 public TableStampType(StampType stampType, ITableElementWord tableWord)
 {
     StampType = stampType;
     TableWord = tableWord ?? throw new ArgumentNullException(nameof(tableWord));
 }
コード例 #12
0
        public string AddOrganizationStamp(HttpPostedFileBase uploadImage, int OrganizationId, StampType type = StampType.Stamp)
        {
            if (ModelState.IsValid && uploadImage != null)
            {
                string Name = string.Empty;

                using (UserContext db = new UserContext())
                {
                    Organization org = db.Organizations.Find(OrganizationId);
                    if (org == null)
                    {
                        return(string.Empty);
                    }
                    Directory.CreateDirectory(stamppath);
                    switch (type)
                    {
                    case StampType.Stamp:
                        if (!string.IsNullOrEmpty(org.Stamp) && System.IO.File.Exists(Path.Combine(stamppath, org.Stamp)))
                        {
                            System.IO.File.Delete(Path.Combine(stamppath, org.Stamp));
                        }
                        Name = Path.GetRandomFileName() + ".png";
                        using (Image image = Image.FromStream(uploadImage.InputStream))
                            image.Save(Path.Combine(stamppath, Name));
                        org.Stamp = Name;
                        break;

                    case StampType.СhairmanSignature:
                        if (!string.IsNullOrEmpty(org.СhairmanSignature) && System.IO.File.Exists(Path.Combine(stamppath, org.СhairmanSignature)))
                        {
                            System.IO.File.Delete(Path.Combine(stamppath, org.СhairmanSignature));
                        }
                        Name = Path.GetRandomFileName() + ".png";
                        using (Image image = Image.FromStream(uploadImage.InputStream))
                            image.Save(Path.Combine(stamppath, Name));
                        org.СhairmanSignature = Name;
                        break;

                    case StampType.TeacherSignature:
                        if (!string.IsNullOrEmpty(org.TeacherSignature) && System.IO.File.Exists(Path.Combine(stamppath, org.TeacherSignature)))
                        {
                            System.IO.File.Delete(Path.Combine(stamppath, org.TeacherSignature));
                        }
                        Name = Path.GetRandomFileName() + ".png";
                        using (Image image = Image.FromStream(uploadImage.InputStream))
                            image.Save(Path.Combine(stamppath, Name));
                        org.TeacherSignature = Name;
                        break;

                    case StampType.SecretarySignature:
                        if (!string.IsNullOrEmpty(org.SecretarySignature) && System.IO.File.Exists(Path.Combine(stamppath, org.SecretarySignature)))
                        {
                            System.IO.File.Delete(Path.Combine(stamppath, org.SecretarySignature));
                        }
                        Name = Path.GetRandomFileName() + ".png";
                        using (Image image = Image.FromStream(uploadImage.InputStream))
                            image.Save(Path.Combine(stamppath, Name));
                        org.SecretarySignature = Name;
                        break;
                    }
                    db.SaveChanges();
                }
                return(Name);
            }

            return(string.Empty);
        }
コード例 #13
0
 /// <summary>
 /// Выбрать главный штамп
 /// </summary>
 public static IStamp GetMainStamp(StampType stampType, ITableElementWord tableWord, StampSettingsWord stampSettings,
                                   SignaturesSearching signaturesSearching, IReadOnlyList <ITableElementWord> tables) =>
 stampType switch
 {
コード例 #14
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
 //数据持久化
 internal static void SaveToDb(StampTypeInfo pStampTypeInfo, StampType  pStampType,bool pIsNew)
 {
     pStampType.StampTypeId = pStampTypeInfo.stampTypeId;
      		pStampType.StampName = pStampTypeInfo.stampName;
     pStampType.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pStampType.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(StampTypeInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pStampTypeInfo.stampTypeId = pStampType.StampTypeId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(StampTypeInfo)))
     {
         ResetCache();
     }
 }
コード例 #15
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
 //从后台获取数据
 internal static void  LoadFromDAL(StampTypeInfo pStampTypeInfo, StampType pStampType)
 {
     pStampTypeInfo.stampTypeId = pStampType.StampTypeId;
     pStampTypeInfo.stampName   = pStampType.StampName;
     pStampTypeInfo.Loaded      = true;
 }
コード例 #16
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
 /// <summary>
 /// 保存
 /// </summary>
 public override void Save()
 {
     if(!m_Loaded)//新增
     {
         StampType stampType=new StampType();
         SaveToDb(this, stampType,true);
     }
     else//修改
     {
         StampType stampType=new StampType(stampTypeId);
         if(stampType.IsNew)
             throw new AppException("该数据已经不存在了");
         SaveToDb(this, stampType,false);
     }
 }
コード例 #17
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
 //从后台获取数据
 internal static void LoadFromDAL(StampTypeInfo pStampTypeInfo, StampType  pStampType)
 {
     pStampTypeInfo.stampTypeId = pStampType.StampTypeId;
      		pStampTypeInfo.stampName = pStampType.StampName;
     pStampTypeInfo.Loaded=true;
 }
コード例 #18
0
        public static DataTable getStampType()
        {
            Query q = StampType.Query();

            return(q.ExecuteDataSet().Tables[0]);
        }
コード例 #19
0
ファイル: StampTypeInfo.cs プロジェクト: xingfudaiyan/OA
 private void LoadFromId(int stampTypeId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(StampTypeInfo)))
     {
         StampTypeInfo stampTypeInfo=Find(GetList(), stampTypeId);
         if(stampTypeInfo==null)
             throw new AppException("未能在缓存中找到相应的键值对象");
         Copy(stampTypeInfo, this);
     }
     else
     {	StampType stampType=new StampType( stampTypeId);
         if(stampType.IsNew)
         throw new AppException("尚未初始化");
        	LoadFromDAL(this, stampType);
     }
 }
コード例 #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StampInfo" /> class.
 /// </summary>
 /// <param name="Links">Link to the document..</param>
 /// <param name="Id">Gets ID of the stamp..</param>
 /// <param name="IndexOnPage">Gets index on page of the stamp..</param>
 /// <param name="PageIndex">Gets PageIndex of the annotation..</param>
 /// <param name="Rect">Gets Rect of the annotation..</param>
 /// <param name="Text">Get the text content..</param>
 /// <param name="Visible">Gets the stamp is visible..</param>
 /// <param name="StampType">Gets stamp type..</param>
 public StampInfo(List <Link> Links = default(List <Link>), string Id = default(string), int?IndexOnPage = default(int?), int?PageIndex = default(int?), Rectangle Rect = default(Rectangle), string Text = default(string), bool?Visible = default(bool?), StampType StampType = default(StampType))
 {
     this.Links       = Links;
     this.Id          = Id;
     this.IndexOnPage = IndexOnPage;
     this.PageIndex   = PageIndex;
     this.Rect        = Rect;
     this.Text        = Text;
     this.Visible     = Visible;
     this.StampType   = StampType;
 }