示例#1
0
        private void DoSelect()
        {
            if (op == "c")
            {
                sql = @"select top 1 case [Type] when 3 then ParentDeptName when 2 then ChildDeptName end as DeptName,
                case [Type] when 3 then ParentId when 2 then DeptId end as DeptId
                from View_SysUserGroup where UserId='{0}'";
                sql = string.Format(sql, UserInfo.UserID);
                IList <EasyDictionary> deptDics = DataHelper.QueryDictList(sql);
                ent = new AbsenceApply();
                if (deptDics.Count > 0)
                {
                    ent.DeptId   = deptDics[0].Get <string>("DeptId");
                    ent.DeptName = deptDics[0].Get <string>("DeptName");
                }
                ent.ApplyUserId   = UserInfo.UserID;
                ent.ApplyUserName = UserInfo.Name;
            }
            sql = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4' order by FinishTime asc";
            sql = string.Format(sql, id);
            IList <EasyDictionary> taskDics = DataHelper.QueryDictList(sql);

            PageState.Add("Opinion", taskDics);
            string taskId = RequestData.Get <string>("TaskId");//取审批暂存时所填写的意见

            if (!string.IsNullOrEmpty(taskId))
            {
                Task tEnt = Task.Find(taskId);
                if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description))
                {
                    PageState.Add("UnSubmitOpinion", tEnt.Description);
                }
            }
            SetFormData(ent);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AbsenceApply ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <AbsenceApply>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                break;

            default:
                if (RequestActionString == "batchdelete")
                {
                    DoBatchDelete();
                }
                else if (RequestActionString == "Submit")
                {
                    ChanageState();
                }
                else
                {
                    DoSelect();
                }
                break;
            }
        }
        private void DoBatchDelete()
        {
            IList <object> idList = RequestData.GetList <object>("IdList");

            if (idList != null && idList.Count > 0)
            {
                AbsenceApply.DoBatchDelete(idList.ToArray());
            }
        }
        /// <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();
            }
        }
        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;
            }
        }
示例#6
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;
            }
        }