Esempio n. 1
0
    private void ToolBarMode(IconsSize size)
    {
        if (CurrentUserSettings.Settings.ToolBarIconsSize != size)
        {
            CurrentUserSettings.Settings.ToolBarIconsSize = size;
            CurrentUserSettings.SaveSettings();
        }
        switch (size)
        {
        case IconsSize.ExtraSmall:
            toolbarMain.IconSize = IconSize.SmallToolbar;
            break;

        case IconsSize.Small:
            toolbarMain.IconSize = IconSize.LargeToolbar;
            break;

        case IconsSize.Middle:
            toolbarMain.IconSize = IconSize.Dnd;
            break;

        case IconsSize.Large:
            toolbarMain.IconSize = IconSize.Dialog;
            break;
        }
    }
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(117, 2, true);
            WriteLiteral("\r\n");
            EndContext();
            BeginContext(239, 2, true);
            WriteLiteral("\r\n");
            EndContext();
#line 9 "C:\Users\Owner\Desktop\New folder (3)\MSSQL\WF.Sample\Views\Shared\Partial\Header.cshtml"

            Guid currentEmployeeId = CurrentUserSettings.GetCurrentUser(ContextAccessor.HttpContext);

            if (currentEmployeeId == Guid.Empty)
            {
                IList <Employee> list = EmployeeRepository.GetAll();
                if (list != null && list.Count > 0)
                {
                    currentEmployeeId = list[0].Id;
                    CurrentUserSettings.SetUserInCookies(ContextAccessor.HttpContext, currentEmployeeId);
                }
            }

            var htmlAtt = new Dictionary <string, object>();
            htmlAtt.Add("class", "ui dropdown");
            htmlAtt.Add("onchange", "CurrentEmployee_OnChange(this);");



#line default
#line hidden
            BeginContext(839, 285, true);
            WriteLiteral(@"<script>
    function CurrentEmployee_OnChange(sender) {
        window.location.search = ""CurrentEmployee="" + sender.value;
    }
</script>

<div class=""ui form"" style=""min-width: 300px; float: right;"">
    <div class=""field"">
        <label>Current employee</label>
        ");
            EndContext();
            BeginContext(1125, 511, false);
#line 37 "C:\Users\Owner\Desktop\New folder (3)\MSSQL\WF.Sample\Views\Shared\Partial\Header.cshtml"
            Write(Html.DropDownList("CurrentEmployee",
                                    EmployeeRepository.GetAll().Select(item => new SelectListItem()
            {
                Text     = string.Format("Name: {0}; StructDivision: {1}; Roles: {2}", item.Name, item.StructDivision.Name, item.GetListRoles()),
                Value    = item.Id.ToString(),
                Selected = item.Id == currentEmployeeId
            }).ToList(),
                                    htmlAtt));

#line default
#line hidden
            EndContext();
            BeginContext(1636, 20, true);
            WriteLiteral("\r\n    </div>\r\n</div>");
            EndContext();
        }
Esempio n. 3
0
 protected void OnActionMaxizizeOnStartToggled(object sender, EventArgs e)
 {
     if (CurrentUserSettings.Settings.MaximizeOnStart != ActionMaxizizeOnStart.Active)
     {
         CurrentUserSettings.Settings.MaximizeOnStart = ActionMaxizizeOnStart.Active;
         CurrentUserSettings.SaveSettings();
     }
 }
Esempio n. 4
0
        public override List <InboxDocumentModel> GetDocuments(out int count, int pageNumber, int pageSize)
        {
            string identityId = CurrentUserSettings.GetCurrentUser().ToString();

            List <InboxItem> inbox = WorkflowInit.Runtime.PersistenceProvider
                                     .GetInboxByIdentityIdAsync(identityId, Paging.Create(pageNumber, pageSize)).Result;

            count = WorkflowInit.Runtime.PersistenceProvider.GetInboxCountByIdentityIdAsync(identityId).Result;
            return(GetDocumentsByInbox(inbox));
        }
Esempio n. 5
0
 private void ToolBarMode(ToolbarStyle style)
 {
     if (CurrentUserSettings.Settings.ToolbarStyle != style)
     {
         CurrentUserSettings.Settings.ToolbarStyle = style;
         CurrentUserSettings.SaveSettings();
     }
     toolbarMain.ToolbarStyle        = style;
     ActionIconsExtraSmall.Sensitive = ActionIconsSmall.Sensitive = ActionIconsMiddle.Sensitive = ActionIconsLarge.Sensitive =
         style != ToolbarStyle.Text;
 }
Esempio n. 6
0
        public ActionResult Outbox(int page = 0)
        {
            int       count    = 0;
            const int pageSize = 15;

            return(View("Index", new DocumentListModel()
            {
                Page = page,
                PageSize = pageSize,
                Docs = DocumentHelper.GetOutbox(CurrentUserSettings.GetCurrentUser(), out count, page, pageSize),
                Count = count,
            }));
        }
Esempio n. 7
0
        /// <summary>
        /// 根据文档ID以及当前的用户ID获取该用户的可执行操作Commands
        /// </summary>
        /// <param name="id">文档ID,该ID作为WorkflowProcessInstance的 ID主键值</param>
        /// <returns></returns>
        private Dictionary <string, string> GetCommands(Guid id)
        {
            var result   = new Dictionary <string, string>();
            var commands = WorkflowInit.Runtime.GetAvailableCommands(id, CurrentUserSettings.GetCurrentUser());

            foreach (var workflowCommand in commands)
            {
                if (!result.ContainsKey(workflowCommand.CommandName))
                {
                    result.Add(workflowCommand.CommandName, workflowCommand.LocalizedName);
                }
            }
            return(result);
        }
Esempio n. 8
0
        public ActionResult Edit(Guid?Id)
        {
            DocumentModel model = null;

            if (Id.HasValue) //用户单击某个文档的编辑界面
            {
                var d = DocumentHelper.Get(Id.Value);
                if (d != null)
                {
                    CreateWorkflowIfNotExists(Id.Value);

                    var h = DocumentHelper.GetHistory(Id.Value);
                    model = new DocumentModel()
                    {
                        Id                   = d.Id,
                        AuthorId             = d.AuthorId,
                        AuthorName           = d.Employee1.Name,
                        Comment              = d.Comment,
                        EmloyeeControlerId   = d.EmloyeeControlerId,
                        EmloyeeControlerName =
                            d.EmloyeeControlerId.HasValue ? d.Employee.Name : string.Empty,
                        Name             = d.Name,
                        Number           = d.Number,
                        StateName        = d.State,
                        Sum              = d.Sum,
                        Commands         = GetCommands(Id.Value),
                        AvailiableStates = GetStates(Id.Value),
                        HistoryModel     = new DocumentHistoryModel {
                            Items = h
                        }                                                             // 关联文档流转历史记录
                    };
                }
            }
            else //新建文档的用户界面
            {
                Guid userId = CurrentUserSettings.GetCurrentUser();
                model = new DocumentModel()
                {
                    AuthorId         = userId,
                    AuthorName       = EmployeeHelper.GetNameById(userId),
                    StateName        = "Draft",
                    Commands         = new Dictionary <string, string> {
                    },
                    AvailiableStates = new Dictionary <string, string>()
                };
            }

            return(View(model));
        }
Esempio n. 9
0
        public DocumentModel GetModel()
        {
            var id = RouteData.Values["id"] != null ? new Guid(RouteData.Values["id"].ToString()) : Guid.Empty;

            DocumentModel model = null;

            if (id != Guid.Empty)
            {
                var d = DocumentRepository.Get(id);
                if (d != null)
                {
                    CreateWorkflowIfNotExists(id);

                    var h = DocumentRepository.GetHistory(id);
                    model = new DocumentModel()
                    {
                        Id               = d.Id,
                        AuthorId         = d.AuthorId,
                        AuthorName       = d.Author.Name,
                        Comment          = d.Comment,
                        ManagerId        = d.ManagerId,
                        ManagerName      = d.ManagerId.HasValue ? d.Manager.Name : string.Empty,
                        Name             = d.Name,
                        Number           = d.Number,
                        StateName        = d.StateName,
                        Sum              = d.Sum,
                        Commands         = GetCommands(id),
                        AvailiableStates = GetStates(id),
                        HistoryModel     = new DocumentHistoryModel {
                            Items = h
                        }
                    };
                    model.StateNameToSet = model.AvailiableStates.Keys.FirstOrDefault();
                }
            }
            else
            {
                Guid userId = CurrentUserSettings.GetCurrentUser();
                model = new DocumentModel()
                {
                    AuthorId   = userId,
                    AuthorName = EmployeeRepository.GetNameById(userId),
                    StateName  = "Vacation request created"
                };
            }

            return(model);
        }
Esempio n. 10
0
    private void ToolBarShow(bool show)
    {
        if (toolbarMain.Visible == show)
        {
            return;
        }

        if (CurrentUserSettings.Settings.ShowToolbar != show)
        {
            CurrentUserSettings.Settings.ShowToolbar = show;
            CurrentUserSettings.SaveSettings();
        }
        toolbarMain.Visible                 = show;
        ActionIconsExtraSmall.Sensitive     = ActionIconsSmall.Sensitive = ActionIconsMiddle.Sensitive = ActionIconsLarge.Sensitive =
            ActionToolBarIconOnly.Sensitive = ActionToolBarTextOnly.Sensitive = ActionToolBarTextAndIcon.Sensitive =
                show;
    }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EmployeeList.Attributes["onchange"] = "CurrentEmployee_OnChange(this);";

            Guid currentEmployeeId = CurrentUserSettings.GetCurrentUser();

            if (currentEmployeeId == Guid.Empty)
            {
                IList <Employee> list = EmployeeRepository.GetAll();
                if (list != null && list.Count > 0)
                {
                    currentEmployeeId = list[0].Id;
                    CurrentUserSettings.SetUserInCookies(currentEmployeeId);
                }
            }

            EmployeeList.DataSource = GetData();
            EmployeeList.DataBind();
            EmployeeList.SelectedValue = currentEmployeeId.ToString();
        }
Esempio n. 12
0
        public ActionResult Edit(Guid?Id)
        {
            Document model = null;

            if (Id.HasValue)
            {
                CreateWorkflowIfNotExists(Id.Value);
                model = DocumentHelper.Get(Id.Value);
            }
            else
            {
                Guid userId = CurrentUserSettings.GetCurrentUser();
                model = new Document()
                {
                    AuthorId   = userId,
                    AuthorName = EmployeeHelper.GetNameById(userId),
                    StateName  = "Draft"
                };
            }

            return(View(model));
        }
        public ActionResult Assignments(AssignmentFilterModel model = null)
        {
            var identityId = CurrentUserSettings.GetCurrentUser(HttpContext).ToString();

            AssignmentFilter customFilter;

            var assignmentFilters = GenerateFilters(identityId);

            if (model != null && assignmentFilters.TryGetValue(model.FilterName, out var res))
            {
                customFilter = res;

                if (model.DocumentNumber != null)
                {
                    var doc = _documentRepository.GetByNumber((int)model.DocumentNumber);
                    if (doc != null)
                    {
                        customFilter.ProcessIdEqual(doc.Id);
                    }
                    else
                    {
                        customFilter.ProcessIdEqual(Guid.Empty);
                    }
                }
                if (model.AssignmentCode != null)
                {
                    customFilter.CodeEquals(model.AssignmentCode);
                }
                if (model.StatusState != "Any")
                {
                    customFilter.StatusStateEquals(model.StatusState);
                }
            }
            else
            {
                customFilter = new AssignmentFilter();
                model        = new AssignmentFilterModel()
                {
                    Page = model?.Page ?? 1, PageChanged = 0
                };
            }

            int count = WorkflowInit.Runtime.PersistenceProvider.GetAssignmentCountAsync(customFilter).Result;

            model.Page = model?.Page ?? 1;
            var maxPage = Math.Ceiling(count / (decimal)pageSize);

            if (model.Page > maxPage)
            {
                model.Page = (int)maxPage;
            }

            List <Assignment> assignments = WorkflowInit.Runtime.AssignmentApi.GetAssignmentsAsync(customFilter, new Paging(model.Page, pageSize)).Result;

            var statuses = WorkflowInit.Runtime.AssignmentApi.GetAssignmentStatuses();

            statuses.Add("Any");

            return(View("Assignments", new AssignmentListModel()
            {
                Assignments = GetAssignmentModels(assignments),
                PageSize = pageSize,
                Count = count,
                Filters = assignmentFilters,
                CustomFilter = model,
                Statuses = statuses
            }));
        }
Esempio n. 14
0
        private AssignmentFilterModel GetAssignmentsWithCustomFilter()
        {
            var model = new AssignmentFilterModel()
            {
                FilterName     = Request.Form[$"{Master.UniqueID}$MainContent$formFilter$FilterName"],
                AssignmentCode = Request.Form[$"{Master.UniqueID}$MainContent$formFilter$AssignmentCode"],
                StatusState    = Request.Form[$"{Master.UniqueID}$MainContent$formFilter$StatusState"],
                Page           = Int32.Parse(Request.Form[$"{Master.UniqueID}$MainContent$formFilter$Page"]),
            };

            var isCorrect = Int32.TryParse(Request.Form[$"{Master.UniqueID}$MainContent$formFilter$DocumentNumber"], out int documentNumber);

            model.DocumentNumber = isCorrect ? documentNumber : (int?)null;

            Guid identityId        = CurrentUserSettings.GetCurrentUser();
            var  assignmentFilters = GenerateFilters(identityId.ToString());

            AssignmentFilter customFilter;

            if (assignmentFilters.TryGetValue(model.FilterName, out var res))
            {
                customFilter = res;

                if (model.DocumentNumber != null)
                {
                    var doc = DocumentRepository.GetByNumber((int)model.DocumentNumber);
                    if (doc != null)
                    {
                        customFilter.ProcessIdEqual(doc.Id);
                    }
                    else
                    {
                        customFilter.ProcessIdEqual(Guid.Empty);
                    }
                }
                if (!model.AssignmentCode.IsNullOrWhiteSpace())
                {
                    customFilter.CodeEquals(model.AssignmentCode);
                }
                if (model.StatusState != "Any")
                {
                    customFilter.StatusStateEquals(model.StatusState);
                }
            }
            else
            {
                customFilter = new AssignmentFilter();
                model        = new AssignmentFilterModel()
                {
                    Page = model?.Page ?? 1
                };
            }

            int count = WorkflowInit.Runtime.PersistenceProvider.GetAssignmentCountAsync(customFilter).Result;

            model.Page = model?.Page ?? 1;
            var maxPage = Math.Ceiling(count / (decimal)PageSize);

            if (model.Page > maxPage)
            {
                model.Page = (int)maxPage;
            }

            List <Assignment> assignments = WorkflowInit.Runtime.AssignmentApi.GetAssignmentsAsync(customFilter, new Paging(model.Page, PageSize)).Result;

            Count      = count;
            PageNumber = model.Page;
            AssignmentsTableRepeater.DataSource = GetAssignmentModels(assignments);
            AssignmentsTableRepeater.DataBind();

            return(model);
        }
Esempio n. 15
0
        public Dictionary <string, AssignmentFilter> GetFilters()
        {
            Guid identityId = CurrentUserSettings.GetCurrentUser();

            return(GenerateFilters(identityId.ToString()));
        }