protected void Page_Load(object sender, EventArgs e)
        {
            id = RequestData.Get <string>("id");
            if (!string.IsNullOrEmpty(id))
            {
                ent = AbsenceApply.Find(id);
            }
            switch (RequestActionString)
            {
            case "delete":
                ent.DoDelete();
                break;

            case "submit":
                StartFlow();
                break;

            case "AutoExecuteFlow":
                AutoExecuteFlow();
                break;

            case "CancelFlow":
                ent.WorkFlowState = "End";
                ent.ApproveResult = "已撤销";
                ent.DoUpdate();
                IList <WorkflowInstance> wfiEnts = WorkflowInstance.FindAllByProperties("Status", "Processing", "RelateId", ent.Id);
                if (wfiEnts.Count > 0)
                {
                    wfiEnts[0].Status  = "Completed";
                    wfiEnts[0].EndTime = System.DateTime.Now;
                    wfiEnts[0].DoUpdate();
                    sql = "update Task set Status=4 ,Result='已撤销',Description='已撤销',FinishTime='" + System.DateTime.Now + "' where WorkFlowInstanceId='" + wfiEnts[0].ID + "' and Status=0";
                    DataHelper.ExecSql(sql);
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
        /// <summary>
        /// 修改状态
        /// </summary>
        private void ChanageState()
        {
            string Id = this.RequestData.Get <string>("Id");

            if (!string.IsNullOrEmpty(Id))
            {
                AbsenceApply ent = AbsenceApply.Find(Id);
                if (ent == null)
                {
                    return;
                }
                // ent.State = "1";
                ent.DoUpdate();
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            op = RequestData.Get <string>("op");
            id = RequestData.Get <string>("id");
            if (!string.IsNullOrEmpty(id))
            {
                ent = AbsenceApply.Find(id);
            }
            JsonString = RequestData.Get <string>("JsonString");
            switch (RequestActionString)
            {
            case "update":
                if (!string.IsNullOrEmpty(JsonString))
                {
                    AbsenceApply   tempEnt = JsonHelper.GetObject <AbsenceApply>(JsonString);
                    EasyDictionary dic     = JsonHelper.GetObject <EasyDictionary>(JsonString);
                    DataHelper.MergeData <AbsenceApply>(ent, tempEnt, dic.Keys);
                    ent.DoUpdate();
                }
                else
                {
                    ent = this.GetMergedData <AbsenceApply>();
                    ent.DoUpdate();
                }
                PageState.Add("Id", ent.Id);
                break;

            case "create":
                ent = this.GetPostedData <AbsenceApply>();
                ent.DoCreate();
                PageState.Add("Id", ent.Id);
                break;

            case "delete":
                ent = this.GetTargetData <AbsenceApply>();
                ent.DoDelete();
                return;

            case "submit":
                StartFlow();
                break;

            case "AutoExecuteFlow":
                AutoExecuteFlow();
                break;

            case "GetNextUsers":
                PageState.Add("NextUsers", new string[] { ent.ExamineUserId, ent.ExamineUserName });
                break;

            case "submitfinish":
                ent.WorkFlowState = RequestData.Get <string>("state");
                ent.ApproveResult = RequestData.Get <string>("ApproveResult");
                ent.DoUpdate();
                break;

            default:
                DoSelect();
                break;
            }
        }