コード例 #1
0
        private string BuilderSeals(int sealRequestId)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<table border='0' ><tbody>");

            List <SealsEntity>             list          = app.GetList().FindAll(r => r.Status == Status.Active);
            List <SealUnionRequestsEntity> listUnioSeals = app.GetSealUnionRequestsList(sealRequestId);

            foreach (SealsEntity entity in list)
            {
                SealUnionRequestsEntity unionEntity = listUnioSeals.Find(r => r.SealID == entity.ID);
                if (unionEntity != null)
                {
                    sb.AppendFormat("<tr><td><span disabled=\"disabled\"><input type=\"checkbox\" disabled=\"disabled\" {0}> <label>{1}</label></span>",
                                    unionEntity == null ? "" : "checked=\"checked\"", entity.SealName);

                    if (unionEntity != null && unionEntity.SealedDate > MinDate)
                    {
                        sb.AppendFormat("<span style='margin-left:20px'><span class=\"sealinfo\">Sealed By:</span> {0} <span class=\"sealinfo\">Sealed Date:</span> {1} </span>",
                                        new App.UserApplication().GetUser(unionEntity.SealedBy).FirstName, unionEntity.SealedDate.ToString("MM/dd/yyyy"));
                    }
                    sb.Append("</td></tr>");
                }
            }
            sb.Append("</tbody></table>");
            return(sb.ToString());
        }
コード例 #2
0
        private void BindDropDownData()
        {
            List <SealsEntity> list = app.GetList().FindAll(r => r.Status == Status.Active);

            rptSeals.DataSource = list;
            rptSeals.DataBind();

            //SearchUsersRequest requestUser = new SearchUsersRequest(SearchUsersType.All, false, " FirstName ", " ASC ");
            //requestUser.IsSunnet = true;
            //SearchUserResponse responseuser = userApp.SearchUsers(requestUser);
            //ddlNextApprover.DataSource = responseuser.ResultList.FindAll(r => r.UserID != UserInfo.UserID);
            //ddlNextApprover.DataBind();
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SealsApplication app = new SealsApplication();

            rptSeals.DataSource = app.GetList();
            rptSeals.DataBind();
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ddlSeal.DataSource = app.GetList().FindAll(r => r.Status == Status.Active);
                ddlSeal.DataBind();
                ddlSeal.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "ALL"
                });

                BindRepeater();
            }
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ddlType.SelectedValue = QS("type");
                ddlSeal.DataSource    = app.GetList().FindAll(r => r.Status == Status.Active);
                ddlSeal.DataBind();
                ddlSeal.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "ALL"
                });
                ddlSeal.SelectedValue = ddlType.SelectedValue == "0" ? QS("seal") : "-1";

                ddlStatus.SelectedValue = QS("status");
                txtKeyword.Text         = QS("keyword");
                BindRepeater();
            }
        }
コード例 #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();
        }
コード例 #7
0
        protected string Save(int sealRequestID, List <string> sealKeys, string title, string description, HttpFileCollection files)
        {
            SealRequestsEntity sealRequestsEntity = new SealRequestsEntity();

            if (sealRequestID == 0) //add
            {
                List <SealsEntity> list = app.GetList().FindAll(r => r.Status == Status.Active);
                sealRequestsEntity.Title         = title;
                sealRequestsEntity.Description   = description.Replace("\r\n", "<br>");
                sealRequestsEntity.RequestedBy   = UserID;
                sealRequestsEntity.RequestedDate = DateTime.Now;
                sealRequestsEntity.Status        = RequestStatus.Open;

                sealRequestsEntity.SealList = new List <SealsEntity>();
                foreach (string sealKey in sealKeys)
                {
                    SealsEntity sealsEntity = list.Find(r => r.ID == int.Parse(sealKey));
                    if (sealsEntity != null)
                    {
                        sealRequestsEntity.SealList.Add(sealsEntity);
                    }
                }
                if (sealRequestsEntity.SealList.Count == 0)
                {
                    //ShowFailMessageToClient("Please select seal.");
                    return("4");
                }

                if ((sealRequestsEntity.ID = app.SealRequestsInsert(sealRequestsEntity)) > 0)
                {
                    for (int i = 0; i < files.Count; i++)
                    {
                        if (files[i].ContentLength > 0)
                        {
                            InsertFile(files[i], sealRequestsEntity.ID, 1, i);
                        }
                    }
                    return("1");
                }
                else
                {
                    return("2");
                }
            }
            else //edit
            {
                if ((sealRequestsEntity = CheckData(sealRequestID)) != null)
                {
                    if (sealRequestsEntity.Status < RequestStatus.Approved && sealRequestsEntity.RequestedBy == UserID)
                    {
                        if (title != null)
                        {
                            sealRequestsEntity.Title = title;
                        }
                        if (description != null)
                        {
                            sealRequestsEntity.Description = description.Replace("\r\n", "<br>");
                        }

                        List <SealsEntity> list = app.GetList().FindAll(r => r.Status == Status.Active);

                        if (sealKeys.Count != 0)
                        {
                            if (sealRequestsEntity.SealList == null)
                            {
                                sealRequestsEntity.SealList = new List <SealsEntity>();
                            }
                            foreach (string sealKey in sealKeys)
                            {
                                SealsEntity sealsEntity = list.Find(r => r.ID == int.Parse(sealKey));

                                if (sealsEntity != null)
                                {
                                    sealRequestsEntity.SealList.Add(sealsEntity);
                                }
                            }
                            if (!app.SealRequestsUpdate(sealRequestsEntity))
                            {
                                //ShowFailMessageToClient(app.BrokenRuleMessages);
                                return("2");
                            }
                        }
                        for (int i = 0; i < files.Count; i++)
                        {
                            if (files[i].ContentLength > 0)
                            {
                                InsertFile(files[i], sealRequestsEntity.ID, 1, i);
                            }
                        }
                        return("1");
                    }
                    else
                    {
                        // ShowFailMessageToClient("It is not editable.");
                        return("2");
                    }
                }
                return("2");
            }
        }