public virtual JObject GetFormStateInfo(HttpContext context) { YZRequest request = new YZRequest(context); string app = request.GetString("app"); string key = request.GetString("key", null); string formstate = request.GetString("formstate", null); FormApplication formApplication; FormState formState; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); formApplication = FormApplication.Open(cn, app); formState = FormService.GetFormStateBasicInfo(cn, app, formstate); } JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["appShortName"] = formApplication.Name; rv["formstate"] = formState.Name; rv["token"] = YZSecurityHelper.GenFormApplicationToken(app, key, formState.Name); rv["showSaveButton"] = formState.ShowSaveButton; rv["validationGroup"] = formState.ValidationGroup; rv["url"] = YZUtility.GetFormRedirectUrl(formApplication.Form).ToString(); return(rv); }
public virtual JObject GetTaskReadInfo(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("tid"); string permisions = request.GetString("Permisions", null); BPMTask task; string formFile; JObject perm; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); task = BPMTask.Load(cn, taskid); formFile = BPMProcess.GetTaskReadForm(cn, taskid); perm = this.CheckPermision(cn, taskid, -1, permisions); } JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["sn"] = task.SerialNum; rv["url"] = YZUtility.GetFormRedirectUrl(formFile).ToString(); rv["urlParams"] = task.UrlParams; rv["perm"] = perm; return(rv); }
protected void Page_Load(object sender, EventArgs e) { if (!YZAuthHelper.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); return; } int tid = Int32.Parse(this.Request["tid"]); string formFile; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); formFile = BPMProcess.GetDefaultReadForm(cn, tid); } if (String.IsNullOrEmpty(formFile)) { throw new Exception(Resources.YZStrings.Aspx_Read_MissForm); } else { YZUrlBuilder urlBuilder = YZUtility.GetFormRedirectUrl(this.Page, formFile); this.Response.Redirect(urlBuilder.ToString(), true); } }
protected void Page_Load(object sender, EventArgs e) { if (!YZAuthHelper.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } string appName = this.Request.QueryString["app"]; FormApplication formApplication = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); formApplication = FormApplication.Load(cn, appName); } string formFile = formApplication.Form; YZUrlBuilder urlBuilder = YZUtility.GetFormRedirectUrl(this.Page, formFile); urlBuilder.QueryString["md"] = "App"; this.Response.Redirect(urlBuilder.ToString(), true); }
public virtual JObject GetProcessInfo(HttpContext context) { YZRequest request = new YZRequest(context); int stepid = request.GetInt32("pid"); string permisions = request.GetString("Permisions", null); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMProcStep step = BPMProcStep.Load(cn, stepid); BPMTask task = BPMTask.Load(cn, step.TaskID); ProcessInfo processInfo = BPMProcess.GetProcessInfo(cn, stepid); //检查处理权 if (!step.Share || !String.IsNullOrEmpty(step.OwnerAccount)) //常规任务及已获取的共享任务 { if (!NameCompare.EquName(step.OwnerAccount, cn.UID) && !NameCompare.EquName(step.AgentAccount, cn.UID)) { throw new BPMException(BPMExceptionType.ProcessErrPermDenied); } } //获得ProcessSubModel ProcessSubModel subModel; if (step.Share && String.IsNullOrEmpty(step.OwnerAccount)) { subModel = ProcessSubModel.Share; } else { if (processInfo.StepProcessPermision == StepProcessPermision.Inform) { subModel = ProcessSubModel.Inform; } else if (processInfo.StepProcessPermision == StepProcessPermision.Indicate) { subModel = ProcessSubModel.Indicate; } else { subModel = ProcessSubModel.Process; } } //ProcessSubModel.Process - 则获得任务操作权限 JObject perm = null; if (subModel == ProcessSubModel.Process || subModel == ProcessSubModel.Inform || subModel == ProcessSubModel.Indicate) { perm = this.CheckPermision(cn, step.TaskID, stepid, permisions); } else { perm = new JObject(); } if (String.IsNullOrEmpty(processInfo.FormFile)) { throw new Exception(String.Format(Resources.YZStrings.Aspx_Process_MissForm, step.NodeName)); } JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["uid"] = cn.UID; rv["subModel"] = subModel.ToString(); rv["sn"] = task.SerialNum; rv["taskid"] = task.TaskID; rv["urlParams"] = task.UrlParams; rv["url"] = YZUtility.GetFormRedirectUrl(processInfo.FormFile).ToString(); rv["NodePermisions"] = this.Serialize(processInfo.NodePermision); rv["Comments"] = step.Comments; rv["perm"] = perm; if (subModel == ProcessSubModel.Process) { rv["shareTask"] = step.Share; rv["IsConsign"] = step.IsConsignStep; JArray links = new JArray(); rv["links"] = links; foreach (Link link in processInfo.Links) { links.Add(this.Serialize(link, "normal")); } rv["directsend"] = this.GetDirectSendInfo(cn, step, processInfo.SystemLinks); //自由流 if (!step.IsConsignStep) //加签不显示自由流 { rv["ParticipantDeclares"] = JArray.FromObject(processInfo.ParticipantDeclares); rv["Routing"] = processInfo.Routing; } } return(rv); } }
public virtual JObject GetPostInfo(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("pn", null); int restartTaskID = request.GetInt32("restartTaskID", -1); string owner = request.GetString("owner", null); string permisions = request.GetString("Permisions", null); string did = request.GetString("did", null); Version processVersion = null; PostInfo postInfo; JObject perm; BPMDraft draft = null; JObject jDraftHeader = null; bool delagation; string selectPosition; MemberCollection positions; JObject rv = new JObject(); PostSubModel subModel; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (!String.IsNullOrEmpty(did)) { draft = new BPMDraft(); draft.Open(cn, new Guid(did)); processName = draft.ProcessName; if (!String.IsNullOrEmpty(draft.Header)) { jDraftHeader = JObject.Parse(draft.Header); } } if (draft != null) { subModel = (PostSubModel)Enum.Parse(typeof(PostSubModel), draft.Type.ToString()); } else { subModel = PostSubModel.Post; } if (restartTaskID == -1) { processVersion = cn.GetGlobalObjectLastVersion(StoreZoneType.Process, processName); } postInfo = BPMProcess.GetPostInfo(cn, processName, processVersion, owner, restartTaskID); perm = this.CheckPermision(postInfo, permisions); //获得delagation/selectPosition if (draft != null) { selectPosition = PositionManager.MemberFullNameFromID(cn, draft.OwnerPositionID); delagation = !YZStringHelper.EquName(draft.OwnerAccount, cn.UID); } else { if (postInfo.IsPostByAgent) { delagation = true; selectPosition = owner; } else { delagation = false; selectPosition = owner; } } //获得positions if (!delagation) { positions = OrgSvr.GetUserPositions(cn, cn.UID); if (String.IsNullOrEmpty(selectPosition) && positions.Count != 0) { selectPosition = positions[0].FullName; } } else { Member mb = new Member(); mb.Open(cn, selectPosition); positions = OrgSvr.GetUserPositions(cn, mb.UserAccount); selectPosition = mb.FullName; } if (String.IsNullOrEmpty(postInfo.FormFile)) { throw new Exception(Resources.YZStrings.Aspx_Post_MissForm); } //返回 rv[YZJsonProperty.success] = true; rv["subModel"] = subModel.ToString(); //基本信息 rv["pn"] = postInfo.ProcessName; rv["version"] = postInfo.ProcessVersion.ToString(2); rv["restartTaskID"] = restartTaskID; rv["url"] = YZUtility.GetFormRedirectUrl(postInfo.FormFile).ToString(); rv["perm"] = perm; rv["PersistParams"] = postInfo.PersistParams; rv["NodePermisions"] = this.Serialize(postInfo.NodePermision); rv["Comments"] = draft != null ? draft.Comments : null; rv["DraftHeader"] = jDraftHeader; //处理按钮 JArray links = new JArray(); rv["links"] = links; foreach (Link link in postInfo.Links) { links.Add(this.Serialize(link, "normal")); } //提交职位 rv["delagation"] = delagation; rv["selectPosition"] = selectPosition; JArray jPoss = new JArray(); rv["positions"] = jPoss; foreach (Member position in positions) { JObject jPos = new JObject(); jPoss.Add(jPos); string name = position.GetParentOU(cn).Name + "\\" + position.UserAccount; if (position.IsLeader) { name += "(" + position.LeaderTitle + ")"; } jPos["name"] = name; jPos["value"] = position.FullName; } //自由流 rv["ParticipantDeclares"] = JArray.FromObject(postInfo.ParticipantDeclares); } return(rv); }
protected void Page_Load(object sender, EventArgs e) { if (!YZAuthHelper.IsAuthenticated) { string token = this.Request.QueryString["Token"]; if (!String.IsNullOrEmpty(token)) { using (SqlConnection cn = new SqlConnection()) { cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["BPMDB"].ConnectionString; cn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = cn; cmd.CommandText = "SELECT StepID,Account,hash FROM BPMInstProcessToken WHERE Token=@Token"; cmd.Parameters.Add("@Token", SqlDbType.NVarChar).Value = token; using (DBReader reader = new DBReader(cmd.ExecuteReader())) { if (reader.Read()) { int stepid = Int32.Parse(this.Request.QueryString["pid"]); int stepidSaved = reader.ReadInt32(0); string account = reader.ReadString(1); string hash = reader.ReadString(2); if (stepid == stepidSaved) { List <string> values = new List <string>(); values.Add(token); values.Add(stepid.ToString()); values.Add(account); if (YZSecurityHelper.CheckHash(values, hash, YZSecurityHelper.SecurityKey)) { YZAuthHelper.SetAuthCookie(account); } } } } } } } } if (!YZAuthHelper.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); return; } int pid = Int32.Parse(this.Request["pid"]); BPM.Client.ProcessInfo processInfo; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); //如果是共享任务,表单打开时直接获取共享任务 //BPMProcStep step = BPMProcStep.Load(cn,pid); //if (step.Share) // BPMProcStep.PickupShareStep(cn, pid); processInfo = BPMProcess.GetProcessInfo(cn, pid); } if (String.IsNullOrEmpty(processInfo.FormFile)) { throw new Exception(Resources.YZStrings.Aspx_Process_MissForm); } else { YZUrlBuilder urlBuilder = YZUtility.GetFormRedirectUrl(this.Page, processInfo.FormFile); this.Response.Redirect(urlBuilder.ToString(), true); } }