public virtual JObject ReActive(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; List <int> toStepIDs = jPost["toStepIDs"].ToObject <List <int> >(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMStepCollection newSteps = BPMTask.ReActive(cn, taskid, toStepIDs.ToArray(), comments); List <string> to = new List <string>(); foreach (BPMProcStep step in newSteps) { to.Add(String.Format("{0}[{1}]", step.NodeName, YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName))); } JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["tosteps"] = String.Join(";", to.ToArray()); return(rv); } }
public virtual JObject DirectSend(HttpContext context) { YZRequest request = new YZRequest(context); int stepid = request.GetInt32("StepID"); bool saveFormData = request.GetBool("SaveFormData"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (saveFormData) { BPMProcess.Post(cn, context.Request.InputStream); } BPMStepCollection newsteps = BPMProcStep.DirectSend(cn, stepid); List <string> to = new List <string>(); foreach (BPMProcStep step in newsteps) { to.Add(String.Format("{0}[{1}]", step.NodeName, YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName))); } JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["tosteps"] = String.Join(";", to.ToArray()); return(rv); } }
public virtual JObject Jump(HttpContext context) { YZRequest request = new YZRequest(context); this.ApproveCheck(context); int stepid = request.GetInt32("StepID", -1); int taskid = request.GetInt32("TaskID"); string toStepName = request.GetString("ToStepName"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; string formdata = (string)jPost["formdata"]; List <int> fromStepIDs = jPost["fromStepIDs"].ToObject <List <int> >(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); //移动审批不保存表单数据 if (!String.IsNullOrEmpty(formdata)) { BPMProcess.Post(cn, formdata); } BPMProcStep step = BPMTask.Jump(cn, taskid, stepid, fromStepIDs.ToArray(), toStepName, comments); JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["StepName"] = step.NodeName; rv["UserFriendlyName"] = YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName); return(rv); } }
public static string GetUserNameListString(UserCollection users) { BPMObjectNameCollection names = new BPMObjectNameCollection(); foreach (User user in users) { names.Add(YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName)); } return(names.ToStringList(';')); }
protected override void OnPreRender(EventArgs e) { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User user = BPM.Client.User.TryGetUser(cn, YZAuthHelper.LoginUserAccount); this._labUser.Text = HttpUtility.HtmlEncode(YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName)); } base.OnPreRender(e); }
public static string GetRecpientDisplayName(StepRecipient recp) { if (recp.Agent == null) { return(YZStringHelper.GetUserFriendlyName(recp.Owner.Account, recp.Owner.DisplayName)); } else { return(String.Format(Resources.YZStrings.Aspx_RecpDspFmt, YZStringHelper.GetUserFriendlyName(recp.Agent.Account, recp.Agent.DisplayName), YZStringHelper.GetUserShortName(recp.Owner.Account, recp.Owner.DisplayName))); } }
protected override void OnPreRender(EventArgs e) { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); UserCommonInfo userCommonInfo = UserCommonInfo.FromAccount(cn, YZAuthHelper.LoginUserAccount); if (userCommonInfo.OutOfOfficeState != OutOfOfficeState.InOffice) { this.Response.Redirect("Back.aspx"); } User user = BPM.Client.User.TryGetUser(cn, YZAuthHelper.LoginUserAccount); this._labUser.Text = HttpUtility.HtmlEncode(YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName)); } base.OnPreRender(e); }
public virtual JObject Pickback(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); int stepid = request.GetInt32("StepID"); string comments = request.GetString("Comments", null); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMProcStep step = BPMTask.PickBack(cn, taskid, stepid, comments); JObject rv = new JObject(); rv["StepName"] = step.NodeName; rv["UserFriendlyName"] = YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName); return(rv); } }
public virtual JObject RecedeBack(HttpContext context) { YZRequest request = new YZRequest(context); this.ApproveCheck(context); int stepid = request.GetInt32("StepID"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; string formdata = (string)jPost["formdata"]; List <int> toStepIDs = jPost["toStepIDs"].ToObject <List <int> >(); BPMTask task; BPMProcStep srcStep; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); //移动审批不保存表单数据 if (!String.IsNullOrEmpty(formdata)) { BPMProcess.Post(cn, formdata); } srcStep = BPMProcStep.Load(cn, stepid); task = BPMTask.Load(cn, srcStep.TaskID); BPMStepCollection newSteps = BPMProcStep.RecedeBack(cn, stepid, toStepIDs.ToArray(), comments); List <string> to = new List <string>(); foreach (BPMProcStep step in newSteps) { to.Add(String.Format("{0}[{1}]", step.NodeName, YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName))); } JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["sn"] = task.SerialNum; rv["tosteps"] = String.Join(";", to.ToArray()); return(rv); } }
private JObject GenLoginResult(string account, bool trial) { string andriodPushService = WebConfigurationManager.AppSettings["AndroidPushService"]; DateTime today = DateTime.Today; JObject rv = new JObject(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User user = User.FromAccount(cn, account); UserCommonInfo userCommonInfo = UserCommonInfo.FromAccount(cn, account); JObject juser = new JObject(); rv["user"] = juser; juser["Account"] = user.Account; juser["AndroidPushService"] = String.IsNullOrEmpty(andriodPushService) ? "JPush" : andriodPushService; juser["HRID"] = user.HRID; juser["DisplayName"] = user.DisplayName; juser["ShortName"] = YZStringHelper.GetUserShortName(user.Account, user.DisplayName); juser["LongName"] = YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName); juser["LoginDate"] = DateTime.Now; juser["ScreenLock"] = userCommonInfo.ScreenLock; juser["TouchUnlock"] = userCommonInfo.TouchUnlock; juser["Trial"] = trial; rv["BPMSiteUrl"] = WebConfigurationManager.AppSettings["BPMSiteUrl"]; rv["LocalLibrary"] = String.Compare(System.Web.Configuration.WebConfigurationManager.AppSettings["LocalLibrary"], "false", true) == 0 ? false : true; rv["JSCache"] = YZSetting.JSCache; rv["JSVersion"] = YZSetting.JSVersion; rv["ver"] = 2; } rv["xclass"] = "EMIP.view.Main"; rv["success"] = true; return(rv); }
protected override void OnPreRender(EventArgs e) { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User user = BPM.Client.User.TryGetUser(cn, YZAuthHelper.LoginUserAccount); this._labUser.Text = HttpUtility.HtmlEncode(YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName)); NotifyProviderInfoCollection provInfos = NotifyManager.GetProviders(cn); UserCommonInfo cInfo = UserCommonInfo.FromAccount(cn, YZAuthHelper.LoginUserAccount); this._chksProvider.Items.Clear(); foreach (NotifyProviderInfo provInfo in provInfos) { ListItem lstItem = new ListItem(provInfo.Name, provInfo.Name); lstItem.Selected = !cInfo.RejectedNotifys.Contains(provInfo.Name); this._chksProvider.Items.Add(lstItem); } } base.OnPreRender(e); }
public void ProcessRequest(HttpContext context) { JsonItem rv = new JsonItem(); string userid = context.Request.Params["uid"]; string password = context.Request.Params["pwd"]; string isWeixIn = context.Request.Params["isWeixIn"]; LoginUser loginUers = new LoginUser(); String NetWork = String.IsNullOrEmpty(context.Request.Params["NetWork"]) ? "" : context.Request.Params["NetWork"], Phone = String.IsNullOrEmpty(context.Request.Params["DevicePlatform"]) ? "" : context.Request.Params["DevicePlatform"], DeviceName = String.IsNullOrEmpty(context.Request.Params["DeviceName"]) ? "" : context.Request.Params["DeviceName"], UUID = String.IsNullOrEmpty(context.Request.Params["UUID"]) ? "" : context.Request.Params["UUID"], Versions = String.IsNullOrEmpty(context.Request.Params["Version"]) ? "Web客户端" : context.Request.Params["Version"], strErrorMsg = String.Empty; try { if (String.IsNullOrEmpty(userid) /*|| String.IsNullOrEmpty(password)*/) { if (String.IsNullOrWhiteSpace(isWeixIn)) { throw new Exception(JosonStrings.Aspx_Login_EnterAccountTip); } else { throw new Exception("请关注微信服务号【创维数字移动办公】后,绑定你的域账号!"); } } string realAccount = null; if (!String.IsNullOrEmpty(isWeixIn)) { var isDegug = Convert.ToString(context.Request.Params["isDebug"]).ToLower().Equals("true"); if (context.Request.UserAgent.ToLower().Contains("micromessenger")) { realAccount = userid; Versions = "微信客户端"; } else { if (!isDegug) { rv.Attributes["success"] = false; rv.Attributes["errorMessage"] = "试图非法登录!本次已经记录该操作!客户端仅提供微信绑定域用户使用" + DeviceName + Phone + NetWork; context.Response.Write(rv.ToString()); } else { realAccount = userid; Versions = "微信客户端"; } } } else { if (!BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, userid, password, out realAccount)) { throw new Exception(JosonStrings.Aspx_Login_Fail); } } if (realAccount != null) { YZAuthHelper.SetAuthCookie(realAccount); YZAuthHelper.ClearLogoutFlag(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User user = User.FromAccount(cn, realAccount); loginUers = cn.getLoginUser(userid, password, "LogIn", "logInOK", NetWork, Phone, UUID, DeviceName, Versions); JsonItem juser = new JsonItem(); rv.Attributes["user"] = juser; juser.Attributes["Account"] = user.Account; string andriodPushService = WebConfigurationManager.AppSettings["AndroidPushService"]; juser.Attributes["AndroidPushService"] = String.IsNullOrEmpty(andriodPushService) ? "JPush" : andriodPushService; juser.Attributes["HRID"] = user.HRID; juser.Attributes["DisplayName"] = user.DisplayName; juser.Attributes["ShortName"] = YZStringHelper.GetUserShortName(user.Account, user.DisplayName); juser.Attributes["LongName"] = YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName); DateTime today = DateTime.Today; juser.Attributes["LoginDate"] = String.Format("{0}年{1}月{2}日", today.Year, today.Month, today.Day); juser.Attributes["NetWork"] = NetWork; juser.Attributes["Phone"] = Phone; juser.Attributes["UUID"] = UUID; juser.Attributes["DeviceName"] = DeviceName; } new SqlServerProvider(context).InsertLogInInfo(loginUers); //System.Threading.Thread.Sleep(500); rv.Attributes["success"] = true; context.Response.Write(rv.ToString()); } } catch (Exception exp) { YZEventLog log = new YZEventLog(); log.WriteEntry(exp); loginUers.ErrorMsg = exp.Message; rv.Attributes["success"] = false; rv.Attributes["errorMessage"] = exp.Message; context.Response.Write(rv.ToString()); } }
private JObject GetFormInfo(BPMConnection cn, string UserAccount, int TaskID, int StepID) { FlowDataSet formData = null; BPMTask task = null; string FormXml = ""; //获取表单名称 JObject rv = new JObject(); //最终组合的 JArray TaskCommList = new JArray(); rv["TaskCommList"] = TaskCommList; JArray FormInfo = new JArray(); rv["FormInfo"] = FormInfo; JArray ButtonList = new JArray(); rv["ButtonList"] = ButtonList; if (StepID < 0) { BPMStepCollection Steps = BPM.Client.BPMTask.GetAllSteps(cn, TaskID); foreach (BPM.Client.BPMProcStep item in Steps) { if (item.NodeName.Equals("开始")) { StepID = item.StepID; break; } } } //按钮开始 BPM.Client.ProcessInfo processInfo = BPM.Client.BPMProcess.GetProcessInfo(cn, StepID); BPMTask bt = BPMTask.Load(cn, TaskID); JObject TaskComm = new JObject(); TaskCommList.Add(TaskComm); TaskComm["TaskID"] = bt.TaskID; TaskComm["ParentStepID"] = bt.ParentStepID; TaskComm["SerialNum"] = bt.SerialNum; TaskComm["ProcessName"] = bt.ProcessName; TaskComm["ApplicantAccount"] = bt.ApplicantAccount; TaskComm["AgentAccount"] = bt.AgentAccount; TaskComm["AgentDisplayName"] = bt.AgentDisplayName; TaskComm["AgentDisplayName"] = bt.AgentDisplayName; TaskComm["OwnerAccount"] = bt.OwnerAccount; TaskComm["OwnerDisplayName"] = bt.OwnerDisplayName; TaskComm["OwnerFullName"] = bt.OwnerFullName; TaskComm["CreateAt"] = bt.CreateAt; TaskComm["FinishAt"] = bt.FinishAt; TaskComm["OptAt"] = bt.OptAt; TaskComm["OptUser"] = bt.OptUser; TaskComm["OptMemo"] = bt.OptMemo; //TaskComm["Description"] = bt.Description; // TaskComm["ReturnToParent"] = bt.ReturnToParent; TaskComm["TaskState"] = bt.TaskState.ToString(); TaskComm["State"] = bt.State.ToString(); if (IsCurrentStep(cn, UserAccount, StepID, TaskID) && bt.TaskState.ToString().Equals("Running", StringComparison.OrdinalIgnoreCase)) { BPM.Client.LinkCollection links = processInfo.Links;//提交按钮 foreach (Link link in links) { JObject button = new JObject(); ButtonList.Add(button); string s = link.DisplayString; button["Text"] = s; button["Action"] = s; button["Type"] = "Post"; } bool canReject = (processInfo.NodePermision & NodePermision.Reject) == NodePermision.Reject;//拒绝按钮 if (canReject) { JObject button = new JObject(); ButtonList.Add(button); button["Text"] = "拒绝"; button["Action"] = "Reject"; button["Type"] = "Reject"; } bool canTransfer = (processInfo.NodePermision & NodePermision.Transfer) == NodePermision.Transfer;//委托按钮 if (canTransfer) { JObject button = new JObject(); ButtonList.Add(button); button["Text"] = "委托"; button["Action"] = "Transfer"; button["Type"] = "Transfer"; } bool canConsign = (processInfo.NodePermision & NodePermision.Consign) == NodePermision.Consign;//加签按钮 if (canConsign) { string s = links[0].DisplayString; JObject button = new JObject(); ButtonList.Add(button); button["Text"] = "加签"; button["Action"] = s; button["Type"] = "Consign"; } bool canRecedeBack = (processInfo.NodePermision & NodePermision.RecedeBack) == NodePermision.RecedeBack;//退回重填按钮 if (canRecedeBack) { JObject button = new JObject(); ButtonList.Add(button); button["Text"] = "退回某步"; button["Action"] = "RecedeBack"; button["Type"] = "RecedeBack"; } bool recedeRestart = (processInfo.NodePermision & NodePermision.RecedeRestart) == NodePermision.RecedeRestart;//退回重填 BPMProcStep stepLoad = BPMProcStep.Load(cn, StepID); int idx = processInfo.SystemLinks.Find(SystemLinkType.DirectSend); if (stepLoad.RecedeFromStep != -1 && idx != -1 && processInfo.SystemLinks[idx].Enabled) { BPMStepCollection directSendToSteps = BPMProcStep.LoadPrevSteps(cn, StepID); BPMObjectNameCollection stepNames = new BPMObjectNameCollection(); foreach (BPMProcStep step in directSendToSteps) { if (step.IsHumanStep) { stepNames.Add(step.NodeName + ":" + YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName)); string buttonText = "直送->" + stepNames.ToStringList(';'); JObject button = new JObject(); ButtonList.Add(button); button["Text"] = buttonText; button["Action"] = "DirectSend"; button["Type"] = "DirectSend"; } } } } //按钮结束 FormXml = processInfo.FormFile; //获取表单数据 formData = BPMProcess.GetFormData(cn, StepID); if (formData.Tables.Count == 0) { throw new Exception("获取表单数据失败"); } //初始化布局文件 task = BPMTask.Load(cn, TaskID); if (task == null) { throw new Exception("通过TaskID获取任务失败"); } //int startIndex=FormXml.LastIndexOf(@"\"); //int endIndex=FormXml.LastIndexOf(".aspx"); // FormXml = FormXml.Substring(startIndex+1, endIndex - startIndex-1); FormXml = FormXml.Replace(".aspx", ""); FormXml = FormXml.Replace("\\", "("); //throw new Exception(FormXml); XmlDocument layoutDoc = new XmlDocument(); string layoutFilePath = HttpContext.Current.Server.MapPath(String.Format("~/FormLayout/{0}.xml", FormXml)); string debugger = ""; if (System.IO.File.Exists(layoutFilePath)) { layoutDoc.Load(layoutFilePath); XmlNodeList layoutTables = layoutDoc.SelectNodes("Layout/Table"); foreach (XmlNode layoutTable in layoutTables) { string TableID = TryGetNodeAttribute(layoutTable, "ID"); //测试报文中Table是否与流程中的Table匹配 debugger += "[TableID]" + TableID; foreach (FlowDataTable item in formData.Tables) { debugger += "[TableName]" + item.TableName; } // FlowDataTable formDataTable = formData.Tables[TableID]; try { if (formDataTable != null) { JObject bwTable = new JObject(); FormInfo.Add(bwTable); bwTable["TableName"] = TableID; bwTable["DisplayName"] = TryGetNodeAttribute(layoutTable, "Name"); bwTable["IsRepeatable"] = formDataTable.IsRepeatableTable; JArray bwRows = new JArray(); bwTable["Rows"] = bwRows; foreach (FlowDataRow formDataRow in formDataTable.Rows) { JObject bwRow = new JObject(); bwRows.Add(bwRow); XmlNodeList layoutColumns = layoutTable.ChildNodes; int i = 0; foreach (XmlNode layoutColumn in layoutColumns) { //debugger += "**" + TryGetNodeAttribute(layoutColumn, "Type") + "**"; if (!string.IsNullOrEmpty(TryGetNodeAttribute(layoutColumn, "Type")) && TryGetNodeAttribute(layoutColumn, "Type").Equals("Attachment", StringComparison.OrdinalIgnoreCase)) { JObject bwColumn = new JObject(); bwRow["Attachments_" + layoutColumn.Name] = bwColumn; bwColumn["Name"] = TryGetNodeAttribute(layoutColumn, "Name"); string FileID = Convert.ToString(formDataRow[layoutColumn.Name]); //调用方法获取附件名称,附件路径 JObject Attachments = GetAttachments(FileID); JArray bwAttachments = new JArray(); bwColumn["Items"] = bwAttachments; foreach (JObject item in JTokenToJArray(Attachments["files"])) { JObject attachment1 = new JObject(); bwAttachments.Add(attachment1); attachment1["FileName"] = item["name"]; attachment1["DownloadUrl"] = item["DownloadUrl"]; } i++; } else { JObject bwColumn = new JObject(); bwRow[layoutColumn.Name] = bwColumn; bwColumn["DataType"] = TryGetNodeAttribute(layoutColumn, "DataType"); bwColumn["DataFormat"] = TryGetNodeAttribute(layoutColumn, "DataFormat"); bwColumn["Order"] = TryGetNodeAttribute(layoutColumn, "Order"); bwColumn["Name"] = TryGetNodeAttribute(layoutColumn, "Name"); bwColumn["Value"] = Convert.ToString(formDataRow[layoutColumn.Name]); } } } } } catch (Exception e) { throw new Exception(debugger + "---------" + e.Message); } } } else { //throw new Exception(String.Format("流程[{0}]没有布局文件[{1}]", task.ProcessName, layoutFilePath)); } return(rv); }
public virtual object Post(HttpContext context) { StringBuilder sb = new StringBuilder(); //if (String.Compare(YZAuthHelper.LoginUserAccount, "usera06", true) == 0) //{ //using (FileStream fs = new FileStream(@"d:\aaa.xml", FileMode.Create, FileAccess.Write)) //{ // byte[] bytes = new byte[context.Request.InputStream.Length]; // context.Request.InputStream.Read(bytes, 0, (int)context.Request.InputStream.Length); // fs.Write(bytes, 0, bytes.Length); //} //context.Request.InputStream.Seek(0, SeekOrigin.Begin); //} //qqw888 //XmlDocument doc = new XmlDocument(); //doc.Load(context.Request.InputStream); //doc.Save("e:\\aaa.xml");//需要打开网站的写权限,和C盘EveryOne的写权限 System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; if (cultureInfo.LCID != 1033 && //en-us cultureInfo.LCID != 2052 && //中文 - 中华人民共和国 cultureInfo.LCID != 3076 && //中文 - 中华人民共和国香港特别行政区 cultureInfo.LCID != 4100 && //中文 - 新加坡 cultureInfo.LCID != 1028 && //中文 - 台湾地区 cultureInfo.LCID != 1041) //日语 { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(1033); } PostResult postResult = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); postResult = BPMProcess.Post(cn, context.Request.InputStream); } List <object> recipients = new List <object>(); foreach (StepRecipient recp in postResult.Recipients) { recipients.Add( new { Account = recp.Owner.Account, DisplayName = YZStringHelper.GetRecpientDisplayName(recp) } ); } List <object> indicators = new List <object>(); foreach (User indicateUser in postResult.InviteIndicateUsers) { indicators.Add( new { Account = YZStringHelper.GetUserFriendlyName(indicateUser.Account, indicateUser.DisplayName) } ); } List <object> informs = new List <object>(); foreach (User informUser in postResult.InformUsers) { indicators.Add( new { Account = YZStringHelper.GetUserFriendlyName(informUser.Account, informUser.DisplayName) } ); } return(new { success = true, PostResult = postResult.PostResultType.ToString(), SN = postResult.SN, Key = postResult.Key, TaskID = postResult.TaskID, CustomMessage = postResult.CustomMessage, Accounts = recipients, Indicators = indicators, Informs = informs, message = YZStringHelper.GetPostResultDisplayStringShort(postResult) }); }
public void ProcessRequest(HttpContext context) { YZAuthHelper.OAuth(); //YZAuthHelper.AshxAuthCheck(); GridPageInfo gridPageInfo = new GridPageInfo(context); IDBProvider dbProvider = YZDBProviderManager.CurrentProvider; int year; if (context.Request.Params["byYear"] == "0") { year = -1; } else { string strYear = context.Request.Params["Year"]; year = String.IsNullOrEmpty(strYear) ? DateTime.Today.Year : Convert.ToInt32(strYear); } //获得数据 BPMTaskCollection tasks = new BPMTaskCollection(); int rowcount; JsonItem rootItem = new JsonItem(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); //tasks = cn.GetHistoryTasks(HistoryTaskType.AllAccessable, null, null, null, gridPageInfo.Start, gridPageInfo.Limit, out rowcount); tasks = cn.GetHistoryTasks(year, HistoryTaskType.AllAccessable, dbProvider.FilterStringHistoryTaskTaskTableFilter, dbProvider.FilterStringHistoryTaskStepTableFilter, null, gridPageInfo.Start, gridPageInfo.Limit, out rowcount); //将数据转化为Json集合 rootItem.Attributes.Add(JsonItem.TotalRows, rowcount); JsonItemCollection children = new JsonItemCollection(); rootItem.Attributes.Add("children", children); rootItem.Attributes.Add("total", rowcount); foreach (BPMTask task in tasks) { JsonItem item = new JsonItem(); children.Add(item); item.Attributes.Add("tid", task.TaskID); item.Attributes.Add("pid", task.ParentStepID); item.Attributes.Add("sn", task.SerialNum); item.Attributes.Add("pn", task.ProcessName); item.Attributes.Add("user", YZStringHelper.GetUserFriendlyName(task.OwnerAccount, task.OwnerDisplayName)); item.Attributes.Add("state", task.TaskState.ToString()); item.Attributes.Add("stateText", YZStringHelper.GetTaskStateDisplayString(cn, task.TaskState, task.TaskID)); item.Attributes.Add("date", YZStringHelper.DateToStringL(task.CreateAt)); task.Description = task.ShowDescByProcessName(true); item.Attributes.Add("desc", String.IsNullOrEmpty(task.Description) ? "无内容摘要" : task.Description); //item.Attributes.Add("desc", String.IsNullOrEmpty(task.Description) ? "无内容摘要" : task.Description); } } //System.Threading.Thread.Sleep(500); context.Response.AppendHeader("Access-Control-Allow-Origin", "*"); // 响应类型 context.Response.AppendHeader("Access-Control-Allow-Methods", "POST"); // 响应头设置 context.Response.AppendHeader("Access-Control-Allow-Headers", "x-requested-with,content-type"); context.Response.Charset = "gb2312"; //设置字符集类型 context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312"); context.Response.ContentType = "application/json;charset=gb2312"; //输出数据 context.Response.Write(rootItem.ToString()); }
protected override void OnPreRender(EventArgs e) { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPM.Client.User user = BPM.Client.User.FromAccount(cn, YZAuthHelper.LoginUserAccount); UserInfoSelfMantSetting setting = new UserInfoSelfMantSetting(); setting.Load(cn); this._labUser.Text = HttpUtility.HtmlEncode(YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName)); this._txtFullName.Text = user.DisplayName; this._txtDesc.Text = user.Description; if (user.Sex != Sex.Unknown) { this._rdoSex.SelectedValue = user.Sex.ToString(); } this._txtBirthday.Text = YZStringHelper.DateToString(user.Birthday); this._txtHRID.Text = user.HRID; this._txtDateHired.Text = YZStringHelper.DateToString(user.DateHired); this._txtOffice.Text = user.Office; this._txtCostCenter.Text = user.CostCenter; this._txtPhone.Text = user.OfficePhone; this._txtHomePhone.Text = user.HomePhone; this._txtMobile.Text = user.Mobile; this._txtEMail.Text = user.EMail; this._txtWebSite.Text = user.WWWHomePage; List <WebControl> diasbleControls = new List <WebControl>(); if (!setting.CanWrite(UserProperty.DisplayName)) { diasbleControls.Add(this._txtFullName); } if (!setting.CanWrite(UserProperty.Description)) { diasbleControls.Add(this._txtDesc); } if (!setting.CanWrite(UserProperty.Sex)) { diasbleControls.Add(this._rdoSex); } if (!setting.CanWrite(UserProperty.Birthday)) { diasbleControls.Add(this._txtBirthday); } if (!setting.CanWrite(UserProperty.HRID)) { diasbleControls.Add(this._txtHRID); } if (!setting.CanWrite(UserProperty.DateHierd)) { diasbleControls.Add(this._txtDateHired); } if (!setting.CanWrite(UserProperty.Office)) { diasbleControls.Add(this._txtOffice); } if (!setting.CanWrite(UserProperty.CostCenter)) { diasbleControls.Add(this._txtCostCenter); } if (!setting.CanWrite(UserProperty.OfficePhone)) { diasbleControls.Add(this._txtPhone); } if (!setting.CanWrite(UserProperty.HomePhone)) { diasbleControls.Add(this._txtHomePhone); } if (!setting.CanWrite(UserProperty.Mobile)) { diasbleControls.Add(this._txtMobile); } if (!setting.CanWrite(UserProperty.EMail)) { diasbleControls.Add(this._txtEMail); } if (!setting.CanWrite(UserProperty.WWWHomePage)) { diasbleControls.Add(this._txtWebSite); } foreach (WebControl control in diasbleControls) { control.Attributes["disabled"] = "disabled"; control.CssClass = "form-input form-input-disabled"; } } base.OnPreRender(e); }