Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            op         = RequestData.Get <string>("op");
            id         = RequestData.Get <string>("id");
            typeid     = RequestData.Get <string>("TypeId");
            JsonString = RequestData.Get <string>("JsonString");
            if (!string.IsNullOrEmpty(id))
            {
                ent = VideoNews.Find(id);
            }
            switch (RequestActionString)
            {
            case "update":
                if (!string.IsNullOrEmpty(JsonString))
                {
                    VideoNews      tempEnt = JsonHelper.GetObject <VideoNews>(JsonString);
                    EasyDictionary dic     = JsonHelper.GetObject <EasyDictionary>(JsonString);
                    DataHelper.MergeData <VideoNews>(ent, tempEnt, dic.Keys);
                    ent.SaveAndFlush();
                }
                else
                {
                    ent = this.GetMergedData <VideoNews>();
                    ent.HomePagePopup = RequestData.Get <string>("HomePagePopup");
                    ent.SaveAndFlush();
                    if (RequestData["param"] + "" == "tj")
                    {
                        PageState.Add("rtnId", ent.Id);
                    }
                }
                SaveDetail(ent.Id, ent.ShowImg);
                InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName);
                break;

            case "create":
                ent = this.GetPostedData <VideoNews>();
                ent.HomePagePopup = RequestData.Get <string>("HomePagePopup");
                ent.CreateId      = UserInfo.UserID;
                ent.CreateName    = UserInfo.Name;
                ent.CreateTime    = DateTime.Now;
                ent.State         = "0";
                ent.CreateAndFlush();
                if (RequestData["param"] + "" == "tj")
                {
                    PageState.Add("rtnId", ent.Id);
                }
                SaveDetail(ent.Id, ent.ShowImg);
                InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName);
                break;

            case "submit":
                StartFlow(id);
                break;

            case "autoexecute":
                Task[] tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId"));
                if (tasks.Length == 0)
                {
                    System.Threading.Thread.Sleep(1000);
                    tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId"));
                }
                if (tasks.Length > 0)
                {
                    this.PageState.Add("TaskId", tasks[0].ID);
                    string AuditUserId   = RequestData.Get <string>("AuditUserId");
                    string AuditUserName = RequestData.Get <string>("AuditUserName");
                    if (!string.IsNullOrEmpty(AuditUserId))
                    {
                        Aim.WorkFlow.WorkFlow.AutoExecute(tasks[0], new string[] { AuditUserId, AuditUserName });
                    }
                    else
                    {
                        PageState.Add("error", "自动提交申请人失败,请手动提交");
                    }
                }
                else
                {
                    PageState.Add("error", "自动提交申请人失败,请手动提交");
                }
                break;

            case "submitfinish":
                string ApproveResult = RequestData.Get <string>("ApproveResult");
                ent              = VideoNews.Find(id);
                ent.WFState      = "End";
                ent.WFResult     = ApproveResult;
                ent.PostUserId   = UserInfo.UserID;
                ent.PostUserName = UserInfo.Name;
                if (ApproveResult == "同意")
                {
                    ent.State = "2";
                }
                ent.PostTime = DateTime.Now;
                ent.Update();
                break;

            case "ImportFile":
                string fileIds = RequestData.Get <string>("fileIds");
                if (!string.IsNullOrEmpty(fileIds))
                {
                    string sql = @"select * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0";
                    sql = string.Format(sql, fileIds);
                    PageState.Add("Result", DataHelper.QueryDictList(sql));
                }
                break;

            default:
                DoSelect();
                break;
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            op     = RequestData.Get <string>("op");
            id     = RequestData.Get <string>("id");
            typeid = RequestData.Get <string>("TypeId");

            VideoNews ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <VideoNews>();
                ent.HomePagePopup = RequestData.Get <string>("HomePagePopup");
                ent.State         = "1";
                if (RequestData["param"] + "" == "tj")
                {
                    ent.PostUserId   = UserInfo.UserID;
                    ent.PostUserName = UserInfo.Name;
                    ent.PostTime     = DateTime.Now;
                    ent.State        = "2";
                }
                ent.SaveAndFlush();

                SaveDetail(ent.Id, ent.ShowImg);
                InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName);
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <VideoNews>();
                ent.HomePagePopup = RequestData.Get <string>("HomePagePopup");
                ent.CreateId      = UserInfo.UserID;
                ent.CreateName    = UserInfo.Name;
                ent.CreateTime    = DateTime.Now;
                ent.State         = "1";
                if (RequestData["param"] + "" == "tj")
                {
                    ent.PostUserId   = UserInfo.UserID;
                    ent.PostUserName = UserInfo.Name;
                    ent.PostTime     = DateTime.Now;
                    ent.State        = "2";
                }
                ent.CreateAndFlush();

                SaveDetail(ent.Id, ent.ShowImg);
                InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName);
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <VideoNews>();
                ent.DeleteAndFlush();
                this.SetMessage("删除成功!");
                break;
            }

            if (RequestActionString == "ImportFile")
            {
                string fileIds = RequestData.Get <string>("fileIds");
                if (!string.IsNullOrEmpty(fileIds))
                {
                    string sql = @"select * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0";
                    sql = string.Format(sql, fileIds);
                    PageState.Add("Result", DataHelper.QueryDictList(sql));
                }
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent    = VideoNews.Find(id);
                    typeid = ent.TypeId;
                    //详细列表数据
                    PageState.Add("DetailList", VideoNewDetail.FindAllByProperty(VideoNewDetail.Prop_PId, ent.Id));
                }

                this.SetFormData(ent);
            }
            else
            {
                string    sql = "select DeptId,ChildDeptName,ParentId,ParentDeptName,len(Path) LenPath from  dbo.View_SysUserGroup where UserId='" + UserInfo.UserID + "' and Type=2";
                DataTable dtt = DataHelper.QueryDataTable(sql);
                if (dtt.Rows.Count > 0)
                {
                    var DeptInfo = new { groupId = dtt.Rows[0]["DeptId"] + "", groupName = dtt.Rows[0]["ChildDeptName"] + "", deptId = dtt.Rows[0]["ParentId"] + "", deptName = dtt.Rows[0]["ParentDeptName"] + "" };
                    PageState.Add("DeptInfo", DeptInfo);
                }
            }

            if (!String.IsNullOrEmpty(typeid))
            {
                NewsType newsType = NewsType.TryFind(typeid);
                PageState.Add("NewsType", newsType);
            }
            EasyDictionary es = new EasyDictionary();
            DataTable      dt = DataHelper.QueryDataTable("select Id,TypeName from NewsType where IsEfficient='1'");

            foreach (DataRow row in dt.Rows)
            {
                es.Add(row["Id"].ToString(), row["TypeName"].ToString());
            }
            PageState.Add("NewsTypeEnum", es);
        }