예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (QS("id", 0) > 0) //edit
                {
                    SealRequestsEntity sealRequestEntity = app.GetSealRequests(QS("Id", 0));
                    List <int>         userList          = app.GetUsersId(QS("ID", 0));
                    if (sealRequestEntity == null || !userList.Contains(UserInfo.UserID))
                    {
                        ShowFailMessageToClient("unauthorized access.");
                        return;
                    }
                    else
                    {
                        BindSealRequestData(sealRequestEntity);
                    }
                    hdID.Value = QS("ID", 0).ToString();
                }
                else //add
                {
                    if (UserInfo.Office == "CN" && UserInfo.Role != RolesEnum.PM)
                    {
                        return;
                    }

                    BindDropDownData();

                    trUploadFiles.Visible = true;
                    trStatus.Visible      = false;
                    btnSave.Visible       = true;
                }
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (QS("id", 0) > 0) //edit
                {
                    sealRequestEntity = app.GetSealRequests(QS("Id", 0));
                    BindRequestData(sealRequestEntity);
                    hdID.Value = sealRequestEntity.ID.ToString();

                    // Check authorization
                    if (app.CheckUserHasRecords(UserInfo.ID, sealRequestEntity.ID, (int)WorkflowAction.Pending) ||
                        (sealRequestEntity.Status == RequestStatus.Draft && sealRequestEntity.RequestedBy == UserInfo.ID))    // Still a draft
                    {
                        divAction.Style["display"] = "inline";
                        BindDdlAction();
                    }
                }
            }
        }
예제 #3
0
        public string GetFielsJson(int SealRequestsID)
        {
            SealsApplication            app = new SealsApplication();
            SealRequestsEntity          sealRequestsEntity = app.GetSealRequests(SealRequestsID);
            string                      tmpFiles           = string.Empty;
            List <SealFileEntity>       list   = app.GetSealFilesList(SealRequestsID);
            Dictionary <string, object> result = new Dictionary <string, object>();

            result.Add("files", list.FindAll(r => r.Type == 2));
            result.Add("currentUserID", UserID);
            result.Add("NotShowDelete", sealRequestsEntity.Status >= RequestStatus.Approved);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
예제 #4
0
        private void SecondSave(int id)
        {
            int nextUserID = HiddenFieldUsers.Value.Length > 0 ? int.Parse(HiddenFieldUsers.Value) : -1;

            sealRequestEntity = app.GetSealRequests(id);
            WorkflowAction selectedAction = (WorkflowAction)Enum.Parse(typeof(WorkflowAction), ddlAction.SelectedValue);

            // Update status in SealRequest table
            if (sealRequestEntity.Type == 0)
            {
                switch (selectedAction)
                {
                case WorkflowAction.Submit:
                    if (sealRequestEntity.Status == RequestStatus.Denied && sealRequestEntity.RequestedBy == UserInfo.UserID)
                    {
                        SendSubmitEmail(sealRequestEntity);
                    }
                    else
                    {
                        ChangeRequestStatus_Submitted();
                    }
                    break;

                case WorkflowAction.Save:
                    ChangeRequestStatus_Saved();
                    break;
                }
            }
            else
            {
                switch (selectedAction)
                {
                case WorkflowAction.Submit:
                    ChangeRequestStatus(RequestStatus.Submitted);
                    UpdateRequestDetails();
                    SendEmailToRespUser(nextUserID);
                    break;

                case WorkflowAction.Save:
                    UpdateRequestDetails();
                    break;
                }
            }
            if (nextUserID != -1)
            {
                InsertWorkflowHistory(nextUserID);
            }
        }
예제 #5
0
 private SealRequestsEntity CheckData(int sealRequestID)
 {
     if (sealRequestID > 0)
     {
         SealRequestsEntity sealRequestsEntity = app.GetSealRequests(sealRequestID);
         if (sealRequestsEntity == null)
         {
             return(null);
         }
         return(sealRequestsEntity);
     }
     else
     {
         return(null);
     }
 }
예제 #6
0
        public void ProcessRequest(HttpContext context)
        {
            string         type      = context.Request.QueryString["RequestType"];
            int            requestID = int.Parse(context.Request.QueryString["RequestID"]);
            WorkflowAction action    = (WorkflowAction)Enum.Parse(typeof(WorkflowAction), context.Request.QueryString["Action"]);

            List <UsersEntity> lstUser = new List <UsersEntity>();

            // Get some entity
            SealsApplication   sealApp           = new SealsApplication();
            SealRequestsEntity sealRequestEntity = sealApp.GetSealRequests(requestID);

            UserApplication userApp = new UserApplication();

            if (action == WorkflowAction.Deny || action == WorkflowAction.FinishProcess)
            {
                lstUser.Add(userApp.GetUser(sealRequestEntity.RequestedBy));
            }

            else if (action == WorkflowAction.Cancel || action == WorkflowAction.Complete || action == WorkflowAction.Pending || action == WorkflowAction.Save)
            {
            }

            else if (type == "Seal")
            {
                // Get Seal entity list
                List <SealUnionRequestsEntity> listSealUnionReq = sealApp.GetSealUnionRequestsList(requestID);
                List <SealsEntity>             listSeal         = new List <SealsEntity>();
                foreach (SealUnionRequestsEntity ent in listSealUnionReq)
                {
                    SealsEntity sealEntity = sealApp.GetList().Find(r => r.ID == ent.SealID);
                    listSeal.Add(sealEntity);
                }

                if (action == WorkflowAction.Submit)
                {
                    foreach (SealsEntity ent in listSeal)
                    {
                        lstUser.Add(userApp.GetUser(ent.Approver));
                    }
                }
                else if (action == WorkflowAction.Approve)
                {
                    foreach (SealsEntity ent in listSeal)
                    {
                        lstUser.Add(userApp.GetUser(ent.Owner));
                    }
                }
                else
                {
                    SearchUsersRequest requestUser = new SearchUsersRequest(SearchUsersType.All, false, " FirstName ", " ASC ");
                    requestUser.IsSunnet = true;
                    SearchUserResponse responseuser = userApp.SearchUsers(requestUser);
                    lstUser = responseuser.ResultList.FindAll(r => r.ID != UserInfo.ID && r.Status == "ACTIVE");
                }
            }

            else
            {
                SearchUsersRequest requestUser = new SearchUsersRequest(SearchUsersType.All, false, " FirstName ", " ASC ");
                requestUser.IsSunnet = true;
                SearchUserResponse responseuser = userApp.SearchUsers(requestUser);
                lstUser = responseuser.ResultList.FindAll(r => r.ID != UserInfo.ID && r.Status == "ACTIVE");//(r.Role == RolesEnum.PM || r.Role== RolesEnum.Sales) &&
            }

            lstUser = lstUser.Distinct().ToList();

            Dictionary <string, object> result = new Dictionary <string, object>();

            result.Add("list", lstUser);
            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
            context.Response.End();
        }