/// <summary> /// Assign RFQ VVI to Supplier /// </summary> /// <returns></returns> /// public ActionResult AssignSupplier() { SystemMessages sysMsg = new SystemMessages(); int id = 0; string postData = Request["postData"]; 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>; string dataId = Convert.ToString(jsonData["dataId"]); string operation = Convert.ToString(jsonData["operation"]); string suppliercode = Convert.ToString(jsonData["SupplierCode"]); List<FieldCategory> lfc = FieldCategory.GetCategorys(FieldCategory.Category_TYPE_VVI); Int32.TryParse(dataId, out id); using (TScope ts = new TScope()) { try { VVIQuotationDetail dm = new VVIQuotationDetail(lfc, data); if (id > 0) { dm.AssignVVIData(id, suppliercode, sysMsg); } else { sysMsg.isPass = false; sysMsg.Messages.Add("Error", "Please select a RFQ "); } } catch (Exception ex) { ts.Rollback(); sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } } string html = ""; string wfStatus = ""; VVIQuotationDetail b2Detail = new VVIQuotationDetail(); // List<FieldCategory> lfc = FieldCategory.GetMasterCategorys(FieldCategory.Category_TYPE_VVI); b2Detail.FillCategoryData(lfc, id); WFTemplate wfTemplate = new WFTemplate("VVIWF", id); html = DetailUIHelper.GenrateCategories(lfc, wfTemplate); wfStatus = wfTemplate.Status == WorkflowStatus.Finished ? "Finished" : ""; var returnData = new { DataId = id, SysMsg = sysMsg, Html = html, wfStatus = wfStatus }; return Json(returnData, JsonRequestBehavior.AllowGet); }
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); }
public ActionResult VVISaveData() { SystemMessages sysMsg = new SystemMessages(); string html = ""; string wfStatus = ""; int id = 0; string postData = Request["postData"]; id = VVISave(postData, sysMsg); if (id > 0 && sysMsg.isPass) { WFTemplate wfTemplate = new WFTemplate(3, id); VVIQuotationDetail vvidetail = new VVIQuotationDetail(); List<FieldCategory> lfc = FieldCategory.GetMasterCategorys(FieldCategory.Category_TYPE_VVI); vvidetail.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 VVIReturn() { string postData = Request["postData"]; SystemMessages sysMsg = new SystemMessages(); if (!String.IsNullOrWhiteSpace(postData)) { 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>; string dataId = Convert.ToString(jsonData["dataId"]); string VendorRFQNumber = Convert.ToString(jsonData["returnid"]); try { VVIQuotationDetail dm = new VVIQuotationDetail(); if (dm.CheckVendorRFQStatus(VendorRFQNumber, Int32.Parse(dataId)) == true) { dm.ReturnRFQ(VendorRFQNumber, Int32.Parse(dataId)); // WFTemplate wf = new WFTemplate(4, Int32.Parse(dataId), VendorRFQNumber); // wf.Run(); } else { sysMsg.isPass = false; sysMsg.Messages.Add("Error", "don't need change the status."); } } catch (Exception ex) { sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } } var jsonResult = new { SysMsg = sysMsg, }; return Json(jsonResult); }
public ActionResult VVIPricingDetail(string RFQID) { int dataId = ParseHelper.Parse<int>(RFQID); WFTemplate template = new WFTemplate(3, dataId); List<FieldCategory> lfc = FieldCategory.GetMasterCategorys(FieldCategory.Category_TYPE_VVI); if (dataId > 0) { VVIQuotationDetail vviDetail = new VVIQuotationDetail(); vviDetail.FillCategoryData(lfc, dataId); } ViewBag.WFTemplate = template; ViewBag.Categories = lfc; ViewBag.DataId = dataId; return View(); }
public ActionResult VVIMainRFQStatus() { SystemMessages sysMsg = new SystemMessages(); int id = 0; string postData = Request["postData"]; 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>; string dataId = Convert.ToString(jsonData["dataId"]); string operation = Convert.ToString(jsonData["operation"]); Int32.TryParse(dataId, out id); try { VVIQuotationDetail dm = new VVIQuotationDetail(); sysMsg.isPass = dm.CheckMainRFQStatusByID(id); } catch (Exception ex) { sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } var returnData = new { SysMsg = sysMsg }; return Json(returnData, JsonRequestBehavior.AllowGet); }
public ActionResult VendorRFQStatus() { SystemMessages sysMsg = new SystemMessages(); int id = 0; string postData = Request["postData"]; 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>; string dataId = Convert.ToString(jsonData["dataId"]); string operation = Convert.ToString(jsonData["operation"]); Int32.TryParse(dataId, out id); string VendorRFQNumber = ""; VVIQuotationDetail dm = new VVIQuotationDetail(); try { if (jsonData.ContainsKey("returnid")) { VendorRFQNumber = Convert.ToString(jsonData["returnid"]); sysMsg.isPass = dm.CheckVendorRFQStatus(VendorRFQNumber, id); } else if (jsonData.ContainsKey("redoid")) { VendorRFQNumber = Convert.ToString(jsonData["redoid"]); sysMsg.isPass = !dm.CheckVendorRFQStatus(VendorRFQNumber, id); } } catch (Exception ex) { sysMsg.isPass = false; } var returnData = new { SysMsg = sysMsg }; return Json(returnData, JsonRequestBehavior.AllowGet); }
public ActionResult RefreshVVIProductInformation() { int id = 0; string postData = Request["postData"]; 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>; string dataId = Convert.ToString(jsonData["dataId"]); List<FieldCategory> lfc = FieldCategory.GetCategorys(FieldCategory.Category_TYPE_VVI); Int32.TryParse(dataId, out id); string content = ""; WFTemplate template = new WFTemplate(3, id); if (id > 0) { VVIQuotationDetail vviDetail = new VVIQuotationDetail(); vviDetail.FillCategoryData(lfc, id); } foreach (FieldCategory fc in lfc) { if (fc.CategoryName == "VVI-Product Information") { content = BI.SGP.BLL.UIManager.DetailUIHelper.GenrateCategorySubFieldsForVVI(fc); } } var jsonObject = new { content = content }; return Json(jsonObject, JsonRequestBehavior.AllowGet); }
private int VVISave(string postData, SystemMessages sysMsg) { int id = 0; if (!String.IsNullOrWhiteSpace(postData)) { 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>; string dataId = Convert.ToString(jsonData["dataId"]); string operation = Convert.ToString(jsonData["operation"]); Int32.TryParse(dataId, out id); Dictionary<string, object> data = jsonData["data"] as Dictionary<string, object>; List<FieldCategory> lfc = FieldCategory.GetCategorys(FieldCategory.Category_TYPE_VVI); foreach (FieldCategory fc in lfc) { if (data.ContainsKey(fc.ID)) { fc.CheckDataType(data[fc.ID] as Dictionary<string, object>, sysMsg); } } if (sysMsg.isPass) { using (TScope ts = new TScope()) { try { VVIQuotationDetail dm = new VVIQuotationDetail(lfc, data); if (id > 0) { dm.UpdateForVVI(id); } else { sysMsg.isPass = false; sysMsg.Messages.Add("Error", "Please select a RFQ "); } } catch (Exception ex) { ts.Rollback(); sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } } } } return id; }