public virtual JObject RecedeBack(HttpContext context) { YZRequest request = new YZRequest(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> >(); BPMProcStep srcStep; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (!String.IsNullOrEmpty(formdata)) { BPMProcess.Post(cn, formdata); } srcStep = BPMProcStep.Load(cn, stepid); 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.GetUserShortName(step.RecipientAccount, step.RecipientFullName))); } JObject rv = new JObject(); 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 virtual JObject Transfer(HttpContext context) { YZRequest request = new YZRequest(context); this.ApproveCheck(context); int stepid = request.GetInt32("StepID"); string memberFullName = request.GetString("MemberFullName"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; string formdata = (string)jPost["formdata"]; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); //移动审批不保存表单数据 if (!String.IsNullOrEmpty(formdata)) { BPMProcess.Post(cn, formdata); } User user = BPMProcStep.Transfer(cn, stepid, memberFullName, comments); JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["UserFriendlyName"] = user.FriendlyName; return(rv); } }
public virtual JObject ReturnToInitiator(HttpContext context) { YZRequest request = new YZRequest(context); this.ApproveCheck(context); int taskid = request.GetInt32("TaskID"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; string formdata = (string)jPost["formdata"]; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); //移动审批不保存表单数据 if (!String.IsNullOrEmpty(formdata)) { BPMProcess.Post(cn, formdata); } User user = BPMTask.RecedeRestart(cn, taskid, comments); JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["UserFriendlyName"] = user.FriendlyName; return(rv); } }
public virtual object Process(HttpContext context) { YZRequest request = new YZRequest(context); int stepid = request.GetInt32("StepID"); string uid = request.GetString("uid", YZAuthHelper.LoginUserAccount); //共享任务uid为空,会导致重定向到登录页面,产生异常 using (BPMConnection cn = new BPMConnection()) { string orguid = YZAuthHelper.LoginUserAccount; YZAuthHelper.SetAuthCookie(uid); try { cn.WebOpen(); } finally { YZAuthHelper.SetAuthCookie(orguid); } ProcessInfo processInfo = BPMProcess.GetProcessInfo(cn, stepid); if (processInfo.Links.Count == 0) { throw new BPMException(BPMExceptionType.MissOutLink, processInfo.NodeName); } string postXml = @"{0} <XForm> <Header> <Method>Process</Method> <PID>{1}</PID> <Action>{2}</Action> <Comment></Comment> </Header> <FormData> </FormData> </XForm>"; postXml = String.Format(postXml, "<?xml version=\"1.0\"?>", stepid, YZUtility.EncodeXMLInnerText(processInfo.Links[0].DisplayString)); using (MemoryStream postStream = new MemoryStream(Encoding.UTF8.GetBytes(postXml))) { PostResult postResult = BPMProcess.Post(cn, postStream); return(new { success = true, result = (postResult.PostResultType == PostResultType.TaskFinishedApproved || postResult.PostResultType == PostResultType.TaskFinishedRejected) ? "finished" : "running" }); } } }
public virtual void Reject(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; string formdata = (string)jPost["formdata"]; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (!String.IsNullOrEmpty(formdata)) { BPMProcess.Post(cn, formdata); } BPMTask.Reject(cn, taskid, comments); } }
/// <summary> /// 加签 /// </summary> /// <param name="StepID">步骤</param> /// <param name="Action">节点</param> /// <param name="Comment">意见</param> /// <param name="Consign_ConsignUsers">加签人</param> private void Consign(int StepID, string Action, string Comment, string Consign_ConsignUsers) { try { StringBuilder sb = null; sb = new StringBuilder(); sb.Append(String.Format("<?xml version=\"1.0\"?>")); sb.Append(String.Format("<XForm>")); sb.Append(String.Format(@" <Header> <Method>Process</Method> <PID>{0}</PID> <Action>{1}</Action> <Comment>{2}</Comment> <ConsignEnabled>True</ConsignEnabled> <ConsignUsers>{3}</ConsignUsers> <ConsignRoutingType>Parallel</ConsignRoutingType> <ConsignReturnType>Return</ConsignReturnType> <InviteIndicateUsers></InviteIndicateUsers> </Header> <FormData> </FormData>", StepID, Action, Comment, Consign_ConsignUsers)); sb.Append(String.Format("</XForm>")); MemoryStream xmlStream = new MemoryStream(UTF8Encoding.UTF8.GetBytes(sb.ToString())); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); PostResult postResult = BPMProcess.Post(cn, xmlStream); if (postResult == null) { throw new Exception("审批失败"); } } } catch (Exception e) { throw new Exception(e.Message); } }
public virtual object ReturnToInitiator(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; string formdata = (string)jPost["formdata"]; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (!String.IsNullOrEmpty(formdata)) { BPMProcess.Post(cn, formdata); } User user = BPMTask.RecedeRestart(cn, taskid, comments); return(new{ UserFriendlyName = user.FriendlyName }); } }
public void ProcessRequest(HttpContext context) { try { YZAuthHelper.OAuth(); //YZAuthHelper.AshxAuthCheck(); string method = context.Request.Params["Method"]; JsonItem JosonRv = new JsonItem(); if (YZStringHelper.EquName(method, "GET")) { string uid = YZAuthHelper.LoginUserAccount; using (BPMConnection cn = new BPMConnection()) { JsonItem data = new JsonItem(); JosonRv.Attributes.Add("data", data); cn.WebOpen(); UserAccount currentUser = cn.getCurrentUser(uid); User user = User.FromAccount(cn, uid); #region 用户信息 data.Attributes["Account"] = user.Account; data.Attributes["HRID"] = user.HRID; data.Attributes["DisplayName"] = user.ShortName; data.Attributes["Mobile"] = user.Mobile; data.Attributes["OfficePhone"] = user.OfficePhone; data.Attributes["HomePhone"] = user.HomePhone; data.Attributes["EMail"] = user.EMail; data.Attributes["Office"] = user.Office; data.Attributes["Birthday"] = YZStringHelper.DateToString(user.Birthday); data.Attributes["DateHired"] = YZStringHelper.DateToString(user.DateHired); data.Attributes["Desc"] = user.Description; #endregion #region 获得OU //获得OU String OULevel = String.Empty; String OUName = String.Empty; String Dept = String.Empty; BPMObjectNameCollection depts = new BPMObjectNameCollection(); MemberCollection members = OrgSvr.GetUserPositions(cn, uid); foreach (Member member in members) { OU ou = member.GetParentOU(cn); OULevel = ou.OULevel; Dept = ou.Name; String FullName = member.GetParentOU(cn).FullName; String mFullName = member.FullName; String mDepartment = member.Department; if (!ou.IsRootOU) { OUName = mFullName.Split(new char[2] { '/', '/' })[2]; depts.Add(OUName); } else { OUName = ou.Name; } if (String.IsNullOrEmpty(member.LeaderTitle)) { depts.Add(ou.Name); } else { depts.Add(String.Format("{0}({1})", ou.Name, member.LeaderTitle)); } } data.Attributes["Dept"] = String.Join(" > ", depts.ToArray()); #endregion UserCommonInfo userCommonInfo = UserCommonInfo.FromAccount(cn, uid); data.Attributes["AppSN"] = Net.Common.JosonRandom.GetRandomByDateTime(1, 999).Replace("/", ""); data.Attributes["AppCompany"] = OUName.GetShortName(); data.Attributes["AppDept"] = Dept; data.Attributes["AppDate"] = DateTime.Now; data.Attributes["AppHRName"] = user.ShortName; data.Attributes["AppHRID"] = YZAuthHelper.LoginUserAccount; data.Attributes["isSkyWorth"] = currentUser.AppFristDept != "制造中心" ? 0 : 1; data.Attributes["AppComDept"] = currentUser.AppCompany.ToConnects("\\") + currentUser.AppDept; JosonRv.Attributes.Add("success", true); JosonRv.Attributes.Add("successMessage", "ok"); context.Response.Write(JosonRv.ToString()); } } else if (YZStringHelper.EquName(method, "Submit")) { //遍历File表单元素 //HttpFileCollection files = HttpContext.Current.Request.Files; //try //{ // for (int iFile = 0; iFile < files.Count; iFile++) // { // ///检查文件扩展名字 // HttpPostedFile postedFile = files[iFile]; // string fileName, fileExtension; // fileName = System.IO.Path.GetFileName(postedFile.FileName); // if (fileName != "") // { // ///注意:可能要修改你的文件夹的匿名写入权限。 // postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("YZSoft/attachment/") + fileName); // } // } // HttpContext.Current.Response.Write("{success:true,msg:'File was successfully uploaded.'}"); //} //catch (System.Exception Ex) //{ // HttpContext.Current.Response.Write("{success:true,msg:'File was successfully uploaded.'}"); //} #region 接收数据 string uid = YZAuthHelper.LoginUserAccount; string EmpID = Convert.ToString(context.Request.Params["AppHRID"]); string EmpName = Convert.ToString(context.Request.Params["AppHRName"]); string LeaveID = Convert.ToString(context.Request.Params["LeaveID"]); string LeaveName = Convert.ToString(context.Request.Params["LeaveName"]); string LeaveTypeID = Convert.ToString(context.Request.Params["LeaveTypeID"]); String AppSN = Convert.ToString(context.Request.Params["AppSN"]); String AppCompany = Convert.ToString(context.Request.Params["AppCompany"]); String AppDept = Convert.ToString(context.Request.Params["AppDept"]); DateTime AppDate = Convert.ToDateTime(context.Request.Params["AppDate"]); String AppHRName = Convert.ToString(context.Request.Params["AppHRName"]); String AppHRID = Convert.ToString(context.Request.Params["AppHRID"]); String Address = Convert.ToString(context.Request.Params["Address"]); DateTime FromDate = YZStringHelper.StringToDate(context.Request.Params["startTime"]); DateTime ToDate = YZStringHelper.StringToDate(context.Request.Params["endTime"]); String allHours = Convert.ToString(context.Request.Params["allHours"]); int DayInt = Convert.ToInt32(allHours.Split('天')[0]); int HourInt = Convert.ToInt32(allHours.Split('天')[1].Split('小')[0]); String reasonWhyNote = Convert.ToString(context.Request.Params["reasonWhy"]); String suggestionMsg = Convert.ToString(context.Request.Params["suggestionMsg"]); String strAttachment = Convert.ToString(context.Request.Params["strAttachment"]); int isSkyWorth = Convert.ToInt32(context.Request.Params["isSkyWorth"]); #region iPHone 早期版本 客户端Bug修改 String strFromClient = submitFrom.UserAgent(context); //if (suggestionMsg.IndexOf("iphone") > -1 || suggestionMsg.IndexOf("iPhone") > -1) //{ // if (LeaveTypeID == "20") // { // LeaveTypeID = "30"; // } // else // { // LeaveTypeID = LeaveTypeID == "30" ? "20" : LeaveTypeID; // } //} #endregion #endregion using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); // Net.Common.GetRequestForm.Post<T> // http://extjs.org.cn/node/712 #region 提交数据 MemoryStream xmlStream = GeneratePostXML(Guid.NewGuid(), cn , AppSN , AppHRID , AppHRName , AppDate , AppDept , AppCompany , EmpID , EmpName , LeaveID , LeaveName , LeaveTypeID , FromDate , ToDate , DayInt , HourInt , reasonWhyNote + suggestionMsg + "\n\r" + strFromClient , strAttachment , isSkyWorth ); #endregion PostResult result = BPMProcess.Post(cn, xmlStream); String DisplayName = result.Recipients[0].Owner.DisplayName; //JsonItem JosonRv = new JsonItem(); JosonRv.Attributes.Add("success", true); JosonRv.Attributes.Add("successMessage", "\n\r <BR> 流程【" + result.SN + "】\n\r <BR> 成功提交给 " + DisplayName); context.Response.Write(JosonRv.ToString()); } } else { String strMsg = String.Format(JosonStrings.Aspx_UnknowCommand, method); //JsonItem JosonRv = new JsonItem(); JosonRv.Attributes.Add("success", false); JosonRv.Attributes.Add("errorMessage", strMsg); context.Response.Write(JosonRv.ToString()); throw new Exception(strMsg); } //System.Threading.Thread.Sleep(500); } catch (Exception e) { JsonItem JosonRv = new JsonItem(); JosonRv.Attributes.Add("success", false); JosonRv.Attributes.Add("errorMessage", e.Message); context.Response.Write(JosonRv.ToString()); } }
public virtual object Start(HttpContext context) { YZRequest request = new YZRequest(context); Guid draftid = request.GetGuid("draftid", false); string memberfullname = request.GetString("memberfullname"); string uid = request.GetString("uid"); using (BPMConnection cn = new BPMConnection()) { string orguid = YZAuthHelper.LoginUserAccount; YZAuthHelper.SetAuthCookie(uid); try { cn.WebOpen(); } finally { YZAuthHelper.SetAuthCookie(orguid); } BPMDraft draft = new BPMDraft(); draft.Open(cn, draftid); JObject jDraftHeader = null; if (!String.IsNullOrEmpty(draft.Header)) { jDraftHeader = JObject.Parse(draft.Header); } PostInfo postInfo = BPMProcess.GetPostInfo(cn, draft.ProcessName, null, memberfullname, -1); if (postInfo.Links.Count == 0) { throw new BPMException(BPMExceptionType.MissOutLink, postInfo.NodeName); } string postXml = @"{0} <XForm> <Header> <Method>Post</Method> <ProcessName>{1}</ProcessName> <OwnerMemberFullName>{2}</OwnerMemberFullName> <Action>{3}</Action> <Comment>{4}</Comment> {5} </Header> {6} </XForm>"; StringBuilder sb = new StringBuilder(); if (jDraftHeader != null) { foreach (KeyValuePair <string, JToken> jProp in jDraftHeader) { string line = String.Format("<{0}>{1}</{0}>", jProp.Key, YZUtility.EncodeXMLInnerText(jProp.Value.ToString())); sb.AppendLine(line); } } postXml = String.Format(postXml, "<?xml version=\"1.0\"?>", YZUtility.EncodeXMLInnerText(draft.ProcessName), YZUtility.EncodeXMLInnerText(memberfullname), YZUtility.EncodeXMLInnerText(postInfo.Links[0].DisplayString), YZUtility.EncodeXMLInnerText(draft.Comments), sb.ToString(), draft.xml); using (MemoryStream postStream = new MemoryStream(Encoding.UTF8.GetBytes(postXml))) { PostResult postResult = BPMProcess.Post(cn, postStream); return(new { success = true, TaskID = postResult.TaskID, SN = postResult.SN }); } } }
//FormData格式如下 //<FormData> // <Purchase> // <SN></SN> // <Amount>26000.00</Amount> // <Reason>dddd</Reason> // <Attachments></Attachments> // </Purchase> // <PurchaseDetail> // <RelationRowGuid>1</RelationRowGuid> // <RowPrimaryKeys></RowPrimaryKeys> // <ItemCode>001</ItemCode> // <Price>10000.00</Price> // <Qty>1</Qty> // <SubTotal>10000.00</SubTotal> // </PurchaseDetail> // <PurchaseDetail> // <RelationRowGuid>2</RelationRowGuid> // <RowPrimaryKeys></RowPrimaryKeys> // <ItemCode>002</ItemCode> // <Price>8000.00</Price> // <Qty>2</Qty> // <SubTotal>16000.00</SubTotal> // </PurchaseDetail> //</FormData> //RelationRowGuid是在这个文件里自增的字段,不管几个子表不管几行数据,永远自增1。 private JObject PostTask(BPMConnection cn, string ProcessName, string UserAccount, string Action, string Comment, bool Draft, int ExistTaskID, string FormData) { JObject result = new JObject(); //处理ExistTask参数 StringBuilder sb = new StringBuilder(); if (ExistTaskID != -1) { BPMProcStep startStep = null; try { startStep = BPMTask.PickBackRestart(cn, ExistTaskID, ""); } catch (BPMException e) { if (e.ExceptionType == BPMExceptionType.TaskPickBackErrNeedNot) { BPMStepCollection temp = BPMTask.GetAllSteps(cn, ExistTaskID); startStep = temp.Find(delegate(BPMProcStep item) { return(item.IsHumanStep == true && item.Finished == false); }); if (startStep == null) { throw new Exception("当前任务没有待审批步骤"); } } else { throw e; } } if (startStep == null) { throw new Exception("获取当前审批步骤失败"); } sb.Append(String.Format("<?xml version=\"1.0\"?>")); sb.Append(String.Format("<XForm>")); sb.Append(String.Format(@" <Header> <Method>Process</Method> <PID>{0}</PID> <Action>{1}</Action> <Comment>{2}</Comment> </Header>", startStep.StepID, Action, Comment)); sb.Append(FormData); sb.Append(String.Format("</XForm>")); } else { sb.Append(String.Format("<?xml version=\"1.0\"?>")); sb.Append(String.Format("<XForm>")); sb.Append(String.Format(@" <Header> <Method>{0}</Method> <ProcessName>{1}</ProcessName> <OwnerMemberFullName>{2}</OwnerMemberFullName> <Action>{3}</Action> <Comment>{4}</Comment> </Header>", Draft ? "SaveAsDraft" : "Post", ProcessName, GetMember(cn, UserAccount).FullName, Action, Comment)); sb.Append(FormData); sb.Append(String.Format("</XForm>")); } MemoryStream xmlStream = new MemoryStream(Encoding.UTF8.GetBytes(sb.ToString())); PostResult postResult = BPMProcess.Post(cn, xmlStream); string requestUrl = HttpContext.Current.Request.Url.ToString(); string RedirectURLBase = requestUrl.Substring(0, requestUrl.IndexOf("YZSoft", StringComparison.OrdinalIgnoreCase)) + "YZSoft/Forms/"; string openUrl = String.Empty; if (Draft) { openUrl = String.Format(RedirectURLBase + "Post.aspx?pn={0}&did={1}", ProcessName, postResult.SN); } else { openUrl = String.Format(RedirectURLBase + "Read.aspx?tid={0}", postResult.TaskID); } result["success"] = true; result["TaskID"] = postResult.TaskID; result["SN"] = postResult.SN; result["OpenUrl"] = openUrl; return(result); }
public void ProcessRequest(HttpContext context) { try { YZAuthHelper.OAuth(); //YZAuthHelper.AshxAuthCheck(); string method = context.Request.Params["Method"]; JsonItem JosonRv = new JsonItem(); if (YZStringHelper.EquName(method, "GET")) { string uid = YZAuthHelper.LoginUserAccount; using (BPMConnection cn = new BPMConnection()) { JsonItem data = new JsonItem(); JosonRv.Attributes.Add("data", data); cn.WebOpen(); UserAccount currentUser = cn.getCurrentUser(uid); //User user = User.FromAccount(cn, uid); //UserCommonInfo userCommonInfo = UserCommonInfo.FromAccount(cn, uid); data.Attributes["AppSN"] = currentUser.AppSN; data.Attributes["AppCompany"] = currentUser.AppCompany; data.Attributes["AppDept"] = currentUser.AppDept; data.Attributes["AppDate"] = currentUser.SubmitDateTime; data.Attributes["AppHRName"] = currentUser.ShortName; data.Attributes["AppHRID"] = currentUser.AppHRID; data.Attributes["isSkyWorth"] = currentUser.AppFristDept != "制造中心" ? 0 : 1; data.Attributes["AppComDept"] = currentUser.AppCompany.ToConnects("\\") + currentUser.AppDept; JosonRv.Attributes.Add("success", true); JosonRv.Attributes.Add("successMessage", "ok"); context.Response.Write(JosonRv.ToString()); } } else if (YZStringHelper.EquName(method, "Submit")) { #region 接收数据 String AppSN = Convert.ToString(context.Request.Params["AppSN"]); String AppCompany = Convert.ToString(context.Request.Params["AppCompany"]); String AppDept = Convert.ToString(context.Request.Params["AppDept"]); DateTime AppDate = Convert.ToDateTime(context.Request.Params["AppDate"]); String AppHRName = Convert.ToString(context.Request.Params["AppHRName"]); String AppHRID = Convert.ToString(context.Request.Params["AppHRID"]); string EmpID = Convert.ToString(context.Request.Params["AppHRID"]); string EmpName = Convert.ToString(context.Request.Params["AppHRName"]); String Address = Convert.ToString(context.Request.Params["Address"]); DateTime FromDate = YZStringHelper.StringToDate(context.Request.Params["startTime"]); DateTime ToDate = YZStringHelper.StringToDate(context.Request.Params["endTime"]); String allHours = Convert.ToString(context.Request.Params["allHours"]); int DayInt = Convert.ToInt32(allHours.Split('天')[0]); int HourInt = Convert.ToInt32(allHours.Split('天')[1].Split('小')[0]); String strVehicle = Convert.ToString(context.Request.Params["Vehicle"]); String OtherVehicle = Convert.ToString(context.Request.Params["OtherVehicle"]); String reasonWhyNote = Convert.ToString(context.Request.Params["reasonWhy"]); String suggestionMsg = Convert.ToString(context.Request.Params["suggestionMsg"]); String strAttachment = Convert.ToString(context.Request.Params["strAttachment"]); int isSkyWorth = Convert.ToInt32(context.Request.Params["isSkyWorth"]); #endregion using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); // Net.Common.GetRequestForm.Post<T> // http://extjs.org.cn/node/712 #region 提交数据 MemoryStream xmlStream = GeneratePostXML(Guid.NewGuid(), cn , AppSN , AppHRID , AppHRName , AppDate , AppDept , AppCompany , EmpID , EmpName , Address , FromDate , ToDate , DayInt , HourInt , reasonWhyNote + suggestionMsg , strAttachment , isSkyWorth ); #endregion PostResult result = BPMProcess.Post(cn, xmlStream); String DisplayName = result.Recipients[0].Owner.DisplayName; //JsonItem JosonRv = new JsonItem(); JosonRv.Attributes.Add("success", true); JosonRv.Attributes.Add("successMessage", "\n\r <BR> 流程【" + result.SN + "】\n\r <BR> 成功提交给 " + DisplayName); context.Response.Write(JosonRv.ToString()); } } else { String strMsg = String.Format(JosonStrings.Aspx_UnknowCommand, method); //JsonItem JosonRv = new JsonItem(); JosonRv.Attributes.Add("success", false); JosonRv.Attributes.Add("errorMessage", strMsg); context.Response.Write(JosonRv.ToString()); throw new Exception(strMsg); } //System.Threading.Thread.Sleep(500); } catch (Exception e) { JsonItem JosonRv = new JsonItem(); JosonRv.Attributes.Add("success", false); JosonRv.Attributes.Add("errorMessage", e.Message); context.Response.Write(JosonRv.ToString()); } }
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) }); }