public ActionResult WFSkip() { SystemMessages sysMsg = WFHelper.CreateMessages(); string html = ""; string wfStatus = ""; string postData = Request["postData"]; int id = Save(postData, sysMsg); if (sysMsg.isPass && id > 0) { List<int> lstToChildIds = new List<int>(); string templateName = Request["templateName"]; string toChildIds = Request["toChildIds"]; int entityId = id; int fromId = ParseHelper.Parse<int>(Request["fromId"]); int toId = ParseHelper.Parse<int>(Request["toId"]); bool checkData = !(Request["checkData"] == "false"); bool waitAllChildComplated = !(Request["waitAllChildComplated"] == "false"); if (!String.IsNullOrWhiteSpace(toChildIds)) { foreach (string stcid in toChildIds.Split(',')) { int tcid = ParseHelper.Parse<int>(stcid); if (tcid > 0) { lstToChildIds.Add(Convert.ToInt32(tcid)); } } } WFTemplate wfTemplate = new WFTemplate(templateName, entityId); using (TScope ts = new TScope()) { if (toId == 0) { sysMsg.Merge(wfTemplate.Run(fromId, checkData)); } else { sysMsg.Merge(wfTemplate.Skip(toId, fromId, checkData, waitAllChildComplated, lstToChildIds.ToArray())); } if (!sysMsg.isPass) { ts.Rollback(); } } B2FQuotationDetail b2Detail = new B2FQuotationDetail(); List<FieldCategory> lfc = FieldCategory.GetMasterCategorys(FieldCategory.Category_TYPE_B2F); b2Detail.FillCategoryData(lfc, id); html = DetailUIHelper.GenrateCategories(lfc, wfTemplate); wfStatus = wfTemplate.Status == WorkflowStatus.Finished ? "Finished" : ""; } var jsonResult = new { DataId = id, SysMsg = sysMsg, Html = html, wfStatus = wfStatus }; return Json(jsonResult); }
public ActionResult VVIWFSkip() { SystemMessages sysMsg = WFHelper.CreateMessages(); string html = ""; string wfStatus = ""; string PDFDIV = ""; string postData = Request["postData"]; int id = VVISave(postData, sysMsg); System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); Dictionary<string, object> jsonData = jss.Deserialize<Dictionary<string, object>>(postData) as Dictionary<string, object>; Dictionary<string, object> data = jsonData["data"] as Dictionary<string, object>; Dictionary<string, object> productiondata = data["24"] as Dictionary<string, object>; if (sysMsg.isPass && id > 0) { List<int> lstToChildIds = new List<int>(); string templateName = Request["templateName"]; string toChildIds = Request["toChildIds"]; int entityId = id; int fromId = ParseHelper.Parse<int>(Request["fromId"]); int toId = ParseHelper.Parse<int>(Request["toId"]); bool checkData = !(Request["checkData"] == "false"); bool waitAllChildComplated = !(Request["waitAllChildComplated"] == "false"); if (!String.IsNullOrWhiteSpace(toChildIds)) { foreach (string stcid in toChildIds.Split(',')) { int tcid = ParseHelper.Parse<int>(stcid); if (tcid > 0) { lstToChildIds.Add(Convert.ToInt32(tcid)); } } } WFTemplate wfTemplate = new WFTemplate(templateName, entityId); using (TScope ts = new TScope()) { if (toId == 0) { sysMsg.Merge(wfTemplate.Run(fromId, checkData)); } else { sysMsg.Merge(wfTemplate.Skip(toId, fromId, checkData, waitAllChildComplated, lstToChildIds.ToArray())); } if (productiondata.ContainsKey("vendorrfqid") && (toId == 104 || wfTemplate.NextActivity.ID == 104)) { if (string.IsNullOrEmpty(productiondata["vendorrfqid"].ToString()) == false) { try { VVIQuotationDetail dm = new VVIQuotationDetail(); if (dm.CheckMainRFQStatusByID(id)) { DbHelperSQL.ExecuteSql("exec SP_VVIPostBackSGP @EntityID,@VendorRFQNumber ", new SqlParameter("@EntityID", entityId), new SqlParameter("@VendorRFQNumber", productiondata["vendorrfqid"].ToString())); sysMsg.isPass = true; } else { sysMsg.isPass = false; sysMsg.Messages.Add("Error", "Main RFQ status is not TechnicalCosting stage."); } } catch (Exception ex) { sysMsg.isPass = false; sysMsg.Messages.Add("error", ex.Message); } } } if (!sysMsg.isPass) { ts.Rollback(); } } VVIQuotationDetail b2Detail = new VVIQuotationDetail(); List<FieldCategory> lfc = FieldCategory.GetMasterCategorys(FieldCategory.Category_TYPE_VVI); b2Detail.FillCategoryData(lfc, id); html = DetailUIHelper.GenrateCategories(lfc, wfTemplate); wfStatus = wfTemplate.Status == WorkflowStatus.Finished ? "Finished" : ""; } var jsonResult = new { DataId = id, SysMsg = sysMsg, Html = html, PDF = PDFDIV, wfStatus = wfStatus }; return Json(jsonResult); }
/// <summary> /// RFQ VVI skip stage /// </summary> /// <returns></returns> public ActionResult RFQVVISaveAndSkip() { VVIRFQManager vvirfdetail = new VVIRFQManager(); SystemMessages sysmgs = new SystemMessages(); VVIRFQManager.SavaAndCheckData(ref vvirfdetail, ref sysmgs, Request); WFTemplate wfTemplate = new WFTemplate("VVIWF", vvirfdetail.ID); if (sysmgs.isPass) { string toActivityId = Request.Form["toActivityId"]; int toActId = 0; int.TryParse(toActivityId, out toActId); if (toActId > 0) { try { sysmgs.Merge(wfTemplate.Skip(toActId)); } catch (Exception ex) { sysmgs.isPass = false; sysmgs.Messages.Add("System Exception", ex.Message); } } } string[] WFIDS = { "3", "4", "5", "6", "7" }; string PDFDIV = ""; if (WFIDS.Contains(wfTemplate.CurrentActivity.ID.ToString())) { PDFDIV = @"<button id=""btnDownlPDF"" class=""btn btn-purple"" onclick=""return downloadpdf();"" > Download PDF <i class=""icon-file small-30""></i> </button>"; } var returnData = new { HTML = SGP.BLL.UIManager.UIManager.GenrateModelforRFQVVIDetail(vvirfdetail, wfTemplate.CurrentActivity.ID.ToString()), RFQNumber = vvirfdetail.Number, RFQID = vvirfdetail.RFQID, ID = vvirfdetail.ID, SysMsg = sysmgs, PDF = PDFDIV }; return Json(returnData, JsonRequestBehavior.AllowGet); }
/// <summary> /// Skip the workflow of RFQ for VVI to next activity /// </summary> /// <param name="id"></param> /// <param name="sysMsg"></param> /// Lance Chen 20150128 private void SkipRFQWFToNextForVVI(int id, SystemMessages sysMsg) { WFTemplate vviTemplate = new WFTemplate(3, id); if (vviTemplate.CurrentActivity.ID == 102) { sysMsg.Merge(vviTemplate.Skip(vviTemplate.NextActivity.ID, 0, false, false)); } }
public ActionResult WFRunSkips(string KeyValues, string ToID) { SystemMessages sysMsg = WFHelper.CreateMessages(); string toActivityId = ToID; int toActId = 0; int.TryParse(toActivityId, out toActId); if (!String.IsNullOrEmpty(KeyValues)) { string[] ids = KeyValues.Split(','); if (ids != null && ids.Length > 0) { using (TScope ts = new TScope()) { foreach (string id in ids) { if (!String.IsNullOrEmpty(id)) { int entityId = 0; if (int.TryParse(id, out entityId)) { try { WFTemplate wfTemplate = new WFTemplate("DefaultWF", entityId); if (RFQManager.IsPendingStatus(entityId, toActId) == false) { sysMsg.isPass = false; sysMsg.Messages.Add("System Exception", "the HitRate Status is Pending, do not allow go to the Closure Status"); } else { sysMsg.Merge(wfTemplate.Skip(toActId)); } RFQManager.PostRFQToVVI(entityId); } catch (Exception ex) { sysMsg.isPass = false; sysMsg.Messages.Add("System Exception", ex.Message); } } else { sysMsg.isPass = false; sysMsg.Messages.Add("ID Error", String.Format("[{0}] is not a valid ID", id)); } } } if (!sysMsg.isPass) { ts.Rollback(); } } } } return Json(sysMsg); }
public ActionResult SaveAndSkip() { RFQDetail rfdetail = new RFQDetail(); SystemMessages sysmgs = new SystemMessages(); Save(ref rfdetail, ref sysmgs); WFTemplate wfTemplate = new WFTemplate("DefaultWF", rfdetail.RFQID); if (sysmgs.isPass) { string toActivityId = Request.Form["toActivityId"]; int toActId = 0; int.TryParse(toActivityId, out toActId); if (toActId > 0) { try { if (RFQManager.IsPendingStatus(rfdetail.RFQID, toActId) == false) { sysmgs.isPass = false; sysmgs.Messages.Add("System Exception", "the HitRate Status is Pending, do not allow go to the Closure Status"); } else { sysmgs.Merge(wfTemplate.Skip(toActId)); } RFQManager.PostRFQToVVI(rfdetail.RFQID); } catch (Exception ex) { sysmgs.isPass = false; sysmgs.Messages.Add("System Exception", ex.Message); } } } string[] WFIDS = { "5", "6", "7" }; string PDFDIV = ""; if (WFIDS.Contains(wfTemplate.CurrentActivity.ID.ToString())) { PDFDIV = @"<button id=""btnDownlPDF"" class=""btn btn-purple"" onclick=""return downloadpdf();"" > Download PDF <i class=""icon-file small-30""></i> </button>"; } var returnData = new { HTML = SGP.BLL.UIManager.UIManager.GenrateModelforRFQDetail(rfdetail, wfTemplate.CurrentActivity.ID.ToString()), RFQNumber = rfdetail.Number, RFQID = rfdetail.RFQID, SysMsg = sysmgs, PDF = PDFDIV }; return Json(returnData, JsonRequestBehavior.AllowGet); }