/// <summary>
 /// Update applicationAction object.
 /// </summary>
 /// <param name="userContext">User context.</param>
 /// <param name="applicationAction">ApplicationAction.</param>
 /// <param name="webApplicationAction">Web application version.</param>
 private void UpdateApplicationAction(IUserContext userContext,
                                      IApplicationAction applicationAction,
                                      WebApplicationAction webApplicationAction)
 {
     applicationAction.Identifier = webApplicationAction.Identifier;
     if (webApplicationAction.IsAdministrationRoleIdSpecified)
     {
         applicationAction.AdministrationRoleId = webApplicationAction.AdministrationRoleId;
     }
     else
     {
         applicationAction.AdministrationRoleId = null;
     }
     applicationAction.ApplicationId = webApplicationAction.ApplicationId;
     applicationAction.UpdateInformation.CreatedBy   = webApplicationAction.CreatedBy;
     applicationAction.UpdateInformation.CreatedDate = webApplicationAction.CreatedDate;
     applicationAction.DataContext = GetDataContext(userContext);
     applicationAction.Description = webApplicationAction.Description;
     applicationAction.GUID        = webApplicationAction.GUID;
     applicationAction.Id          = webApplicationAction.Id;
     applicationAction.Name        = webApplicationAction.Name;
     applicationAction.UpdateInformation.ModifiedBy   = webApplicationAction.ModifiedBy;
     applicationAction.UpdateInformation.ModifiedDate = webApplicationAction.ModifiedDate;
     applicationAction.ValidFromDate = webApplicationAction.ValidFromDate;
     applicationAction.ValidToDate   = webApplicationAction.ValidToDate;
 }
        /// <summary>
        /// Get WebApplicationAction from ApplicationAction.
        /// </summary>
        /// <param name="userContext">User context.</param>
        /// <param name="applicationAction">ApplicationAction.</param>
        /// <returns>WebApplicationAction.</returns>
        public WebApplicationAction GetApplicationAction(IUserContext userContext,
                                                         IApplicationAction applicationAction)
        {
            WebApplicationAction webApplicationAction;

            webApplicationAction = new WebApplicationAction();

            webApplicationAction.ApplicationId = applicationAction.ApplicationId;
            webApplicationAction.Identifier    = applicationAction.Identifier;
            if (applicationAction.AdministrationRoleId.HasValue)
            {
                webApplicationAction.AdministrationRoleId = applicationAction.AdministrationRoleId.Value;
            }
            webApplicationAction.CreatedBy   = applicationAction.UpdateInformation.CreatedBy;
            webApplicationAction.CreatedDate = applicationAction.UpdateInformation.CreatedDate;
            webApplicationAction.Description = applicationAction.Description;
            webApplicationAction.GUID        = applicationAction.GUID;
            webApplicationAction.Id          = applicationAction.Id;
            webApplicationAction.IsAdministrationRoleIdSpecified = applicationAction.AdministrationRoleId.HasValue;
            webApplicationAction.ModifiedBy    = applicationAction.UpdateInformation.ModifiedBy;
            webApplicationAction.ModifiedDate  = applicationAction.UpdateInformation.ModifiedDate;
            webApplicationAction.Name          = applicationAction.Name;
            webApplicationAction.ValidFromDate = applicationAction.ValidFromDate;
            webApplicationAction.ValidToDate   = applicationAction.ValidToDate;

            return(webApplicationAction);
        }
        /// <summary>
        /// Update ApplicationAction.
        /// </summary>
        /// <param name="userContext">User context.</param>
        /// <param name="applicationAction">
        /// Information about the updated applicationAction.
        /// This object is updated with information
        /// about the updated applicationAction.
        /// </param>
        public void UpdateApplicationAction(IUserContext userContext, IApplicationAction applicationAction)
        {
            WebApplicationAction webApplicationAction;

            CheckTransaction(userContext);
            webApplicationAction = WebServiceProxy.UserService.UpdateApplicationAction(GetClientInformation(userContext),
                                                                                       GetApplicationAction(userContext, applicationAction));
            UpdateApplicationAction(userContext, applicationAction, webApplicationAction);
        }
 /// <summary>
 /// Create new application action.
 /// </summary>
 /// <param name="userContext">User context.</param>
 /// <param name="applicationAction">
 /// Information about the new application action.
 /// This object is updated with information
 /// about the created application action.
 /// </param>
 public virtual void CreateApplicationAction(IUserContext userContext,
                                             IApplicationAction applicationAction)
 {
     DataSource.CreateApplicationAction(userContext, applicationAction);
 }
Пример #5
0
        public override string ToString()
        {
            stamps = new List <SingleStamp>();
            IApplicationAction         appaction     = IOCFactory.GetInstance <IApplicationAction>();
            IApplication               application   = IOCFactory.GetInstance <IApplication>();
            ApplicationUI              app           = application.GetpplicationByID(this.applicationId);
            List <ApplicationActionUI> appcationList = appaction.GetApplicationActionByAppID(this.applicationId, action);

            if (appcationList != null && appcationList.Count > 0)
            {
                foreach (var item in appcationList)
                {
                    var actionuser = item.ActionUserName;
                    if (item.Action == (int)ApprovalAction.Create && !string.IsNullOrEmpty(item.AgentToUserName) && item.AgentToUserName != item.ActionUserName)
                    {
                        actionuser = item.AgentToUserName.Trim();
                    }
                    stamps.Add(new SingleStamp()
                    {
                        ImgPath = imgPathBase + GetAppActionPicture((ApprovalAction)item.Action), Line1 = actionuser, Line2 = item.ActionTime.ToString("yyyy-MM-dd"), ToolTips = EnumDataSource <ApprovalAction> .GetDisplayValue(item.Action, "zh-cn")
                    });
                }
                if (action != ApprovalAction.Approve)
                {
                    IAttendance              leave         = IOCFactory.GetInstance <IAttendance>();
                    IApplication             iapplication  = IOCFactory.GetInstance <IApplication>();
                    List <TaskUserExtendUI>  taskListuser  = iapplication.GetApplicationToDoTaskWithUser(this.applicationId);
                    List <TaskGroupExtendUI> taskListgroup = iapplication.GetApplicationToDoTaskWithGroup(this.applicationId);
                    if (app.Status == (int)ApplicationStatus.Pending)
                    {
                        string todouser = string.Empty;
                        if (taskListuser != null && taskListuser.Count > 0)
                        {
                            int length = taskListuser.Count;
                            for (int i = 0; i < length; i++)
                            {
                                todouser = todouser + taskListuser[i].vwEmpBasicInfo.ChineseName + ";";
                            }
                        }
                        if (taskListgroup != null && taskListgroup.Count > 0)
                        {
                            int length = taskListgroup.Count;
                            for (int i = 0; i < length; i++)
                            {
                                todouser = todouser + taskListgroup[i].AuthorizationGroup.NAME + ";";
                            }
                        }
                        todouser = todouser.Trim(';');
                        stamps.Add(new SingleStamp()
                        {
                            ImgPath = imgPathBase + imgPending, Line1 = todouser, Line2 = "", ToolTips = "待处理"
                        });
                    }
                }

                //string CNTitle = "<p>" + Resources.NameResource.Process + "&nbsp;(" + Resources.NameResource.Current + ":";
                //int count = appcationList.Count - 1;
                //string Status = appcationList[count].ActionUserName + " " + EnumDataSource<ApprovalAction>.GetDisplayValue(appcationList[count].Action, "zh-cn");
                //string TotalContent = CNTitle + Status + ")</p>";
                //return TotalContent + base.ToString();

                return(base.ToString());
            }
            else
            {
                return(string.Empty);
            }
        }