public JsonResult BatchDelete() { SystemMessages sysMsg = new SystemMessages(); string categoryName = Request["categoryName"]; FieldCategory category = new FieldCategory(categoryName); using (TScope ts = new TScope()) { try { CostingMasterDetailData cmdd = new CostingMasterDetailData(category); cmdd.BatchDelete(); } catch (Exception ex) { ts.Rollback(); sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } } var jsonResult = new { success = sysMsg.isPass, errMessage = sysMsg.MessageString }; return Json(jsonResult); }
/// <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 CancelQuote(string keyValues) { SystemMessages sysMsg = new SystemMessages(); if (!string.IsNullOrEmpty(keyValues)) { using (TScope ts = new TScope()) { try { string[] ids = keyValues.Split(','); if (ids != null && ids.Length > 0) { SCMPriceMasterDetail smd = new SCMPriceMasterDetail(); DateTime date = new DateTime(); foreach (string id in ids) { smd.DisableQuote(id, date); } } } catch (Exception ex) { ts.Rollback(); sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } } } var result = new { success = sysMsg.isPass, message = (sysMsg.isPass ? "" : sysMsg.Messages.ToString()) }; return Json(result); }
public static void CheckField(WFTemplate template, List<WFActivityField> listFields, SystemMessages sysMsg, WFActivity activity) { if (sysMsg == null) { sysMsg = CreateMessages(); } foreach (WFActivityField field in listFields) { if (field.IsRequired) { if (String.IsNullOrEmpty(field.SubDataType)) { bool isEmpty = true; if (template.MasterData.Table.Columns.Contains(field.FieldName)) { string fieldValue = Convert.ToString(template.MasterData[field.FieldName]).Trim(); isEmpty = FieldIsEmpty(field, fieldValue); } if (isEmpty) { sysMsg.isPass = false; sysMsg.Messages.Add(String.Format("{0} - Validation", template.MasterData[activity.Template.MessageField]) , String.Format("\"{0}\" is required.", field.DisplayName)); } } else { bool isEmpty = true; string tableName = field.SubDataType.ToUpper(); if (template.SubData.ContainsKey(tableName)) { DataTable subDt = template.SubData[tableName]; if (subDt.Rows.Count > 0) { isEmpty = false; for (int i = 0; i < subDt.Rows.Count; i++) { string fieldValue = Convert.ToString(subDt.Rows[i][field.FieldName]).Trim(); if (FieldIsEmpty(field, fieldValue)) { sysMsg.isPass = false; sysMsg.Messages.Add(String.Format("{0} - Validation", template.MasterData[activity.Template.MessageField]), String.Format("\"{0}(line:{1})\" is required.", field.DisplayName, i+1)); } } } } if (isEmpty) { sysMsg.isPass = false; sysMsg.Messages.Add(String.Format("{0} - Validation", template.MasterData[activity.Template.MessageField]), String.Format("\"{0}\" is required.", field.DisplayName)); } } } } }
public static bool CheckData(DataRow dr, ref SystemMessages message) { message = new SystemMessages(); FieldInfoCollecton allFields = FieldCategory.GetAllFields(FieldCategory.Category_TYPE_FPC); foreach (DataColumn dc in dr.Table.Columns) { CheckData(dc.ColumnName, dr[dc].ToString(), allFields, ref message); } return true; }
/// Check RFQDetail Data for Request /// </summary> /// <param name="Request"></param> /// <param name="message"></param> /// <returns></returns> public static bool CheckData(HttpRequestBase Request, ref SystemMessages message) { message = new SystemMessages(); FieldInfoCollecton allFields = FieldCategory.GetAllFields(FieldCategory.Category_TYPE_FPC); foreach (string key in Request.Form.Keys) { CheckData(key, Request.Form[key], allFields, ref message); } return true; }
public void Merge(SystemMessages sysMsg) { if (sysMsg != null) { if (!sysMsg.isPass) { this.isPass = false; } this.Messages.Add(sysMsg.Messages); } }
public ActionResult Clone() { SystemMessages sysMsg = new SystemMessages(); int id = 0; string postData = Request["postData"]; id = Clone(postData, sysMsg); var jsonResult = new { DataId = id, SysMsg = sysMsg }; return Json(jsonResult); }
/// <summary> /// check customer name only /// </summary> public static void CheckNameOnly(string id, object value, SystemMessages sysMsg) { List<SqlParameter> ps = new List<SqlParameter>() { new SqlParameter("@CustomerId", id), new SqlParameter("@CustomerName", Convert.ToString(value)) }; string strSql = "SELECT COUNT(ID) FROM SGP_CustomerProfile_Data WHERE DeleteState = 0 AND Customer=@CustomerName AND ID<>@CustomerId "; if (DbHelperSQL.GetSingle<int>(strSql, ps.ToArray())>0) { sysMsg.isPass = false; sysMsg.Messages.Add("Customer", String.Format("[{0}] already exists,please try again", value)); } }
/// <summary> /// Check RFQDetail Data, and bind to systemmessages /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <param name="allFields"></param> /// <param name="message"></param> public static void CheckData(string key, string value, FieldInfoCollecton allFields, ref SystemMessages message) { if (allFields[key] != null) { SGP.BLL.DataModels.FieldInfo fi = allFields[key]; switch (allFields[key].DataType) { case "int": if (!CheckVBalueIfInt(value)) { message.isPass = false; message.Messages.Add(key, value + " is not numeric type"); } break; case "date": if (!CheckVBalueIfDate(value)) { message.isPass = false; message.Messages.Add(key, value + " is not date time type"); } break; case "float": case "double": if (!CheckVBalueIffloat(value)) { message.isPass = false; message.Messages.Add(key, value + " is not float Type"); } break; case "list": if (!CheckVBalueIfList(key, value)) { message.isPass = false; message.Messages.Add(key, value + " not exist in data list"); } break; case "listsql": if (!CheckVBalueIfListSQL(key, value, fi.KeyValueSource)) { message.isPass = false; message.Messages.Add(key, value + " not exist in data list"); } break; } } }
/// <summary> /// 报价审批通过 /// </summary> /// <param name="keyValues"></param> /// <returns></returns> public ActionResult ApproveQuote(string keyValues) { SystemMessages sysMsg = new SystemMessages(); if (!string.IsNullOrEmpty(keyValues)) { using (TScope ts = new TScope()) { try { SCMPriceMasterDetail smd = new SCMPriceMasterDetail(); string[] ids = keyValues.Split(','); if (ids != null && ids.Length > 0) { DateTime approveDate = DateTime.Now; foreach (string id in ids) { smd.ChangeQuoteStatus(id, SCMPriceMasterDetail.QuoteStatus_Approved, approveDate); UpdateMainDataStatus(id); } } } catch (Exception ex) { ts.Rollback(); sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } } } var result = new { success = sysMsg.isPass, message = (sysMsg.isPass ? "" : sysMsg.Messages.ToString()) }; return Json(result); }
public JsonResult DelData() { SystemMessages sysMsg = new SystemMessages(); int id = 0; string dataId = Request["dataId"]; string categoryName = Request["categoryName"]; Int32.TryParse(dataId, out id); FieldCategory category = new FieldCategory(categoryName); using (TScope ts = new TScope()) { try { CostingPeriodDetail cpd = new CostingPeriodDetail(category); if (id > 0) { cpd.Delete(id); } } catch (Exception ex) { ts.Rollback(); sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } } var jsonResult = new { success = sysMsg.isPass, errMessage = sysMsg.MessageString }; return Json(jsonResult); }
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; }
public ActionResult SaveData() { SystemMessages sysMsg = new SystemMessages(); string html = ""; string wfStatus = ""; int id = 0; string postData = Request["postData"]; id = Save(postData, sysMsg); if (id > 0 && sysMsg.isPass) { WFTemplate wfTemplate = new WFTemplate(2, id); 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); }
private int Save(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_B2F); 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 { BI.SGP.BLL.Models.B2FComputedField aftercomputeddata = new B2FComputedField(); aftercomputeddata.Data = data; B2FQuotationDetail dm = new B2FQuotationDetail(lfc, aftercomputeddata.SetComputedValue()); if (operation == B2FQuotationDetail.OPERATION_REQUOTE) { id = dm.ReQuote(); } else if (operation == B2FQuotationDetail.OPERATION_CLONE) { id = dm.Clone(); } else { if (id > 0) { dm.Update(id); } else { id = dm.Add(); } } } catch (Exception ex) { ts.Rollback(); sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } } } } return id; }
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 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 SUPPLIERRFQSaveData() { 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>; string number = Convert.ToString(jsonData["number"]); bool isOutOfCapability; id = SupplierRfqSave(postData, sysMsg, out isOutOfCapability); WFTemplate wfTemplate = new WFTemplate("SUPPLIERWF", id, number); string wfStatus = wfTemplate.Status == WorkflowStatus.Finished ? "Finished" : ""; var jsonResult = new { DataId = id, SysMsg = sysMsg, wfStatus = wfStatus }; return Json(jsonResult); }
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); }
/// <summary> /// Update RFQ VVI Value & Submit RFQ VVI to next stage /// </summary> /// <returns></returns> public ActionResult RFQVVISaveAndSubmit() { VVIRFQManager vvirfdetail = new VVIRFQManager(); SystemMessages sysmgs = new SystemMessages(); VVIRFQManager.SavaAndCheckData(ref vvirfdetail, ref sysmgs, Request); WFTemplate wfTemplate = new WFTemplate("VVIWF", vvirfdetail.ID.Value); if (sysmgs.isPass) { try { sysmgs.Merge(wfTemplate.Run()); } catch (Exception ex) { sysmgs.isPass = false; sysmgs.Messages.Add("System Exception", ex.Message); } } string[] WFIDS = { "104" }; string PDFDIV = ""; if (WFIDS.Contains(wfTemplate.CurrentActivity.ID.ToString())) { if (wfTemplate.CurrentActivity.ID == 104) { VVIRFQManager.UpdateOperationForPostBack(vvirfdetail.ID.Value.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> /// Update RFQ VVI Value /// </summary> /// <returns></returns> public ActionResult SaveVVIDetailData() { VVIRFQManager vvirfqdetail = new VVIRFQManager(); SystemMessages sysmgs = new SystemMessages(); VVIRFQManager.SavaAndCheckData(ref vvirfqdetail, ref sysmgs, Request); //WFTemplate wf = new WFTemplate("VVIWF",vvirfqdetail.ID.Value); //if(wf.CurrentActivity.ID==104) //{ // VVIRFQManager.UpdateOperationForPostBack(vvirfqdetail.ID.Value.ToString()); //} string html = ""; if (sysmgs.isPass == true) { html = SGP.BLL.UIManager.VVIUIManager.GenrateVVIRFQDetail(vvirfqdetail, vvirfqdetail.ID.ToString(), "Edit"); } // string aa = Request.Form["Number"]; var returnData = new { HTML = html, ID = vvirfqdetail.ID, SysMsg = sysmgs }; return Json(returnData, JsonRequestBehavior.AllowGet); }
private void SubmitChildActivity(SystemMessages sysMsg, WFActivity fromActivity, WFActivity nextActivity) { string strUserSql = String.Format("DELETE FROM SGP_CurrentUserTask WHERE TemplateID={0} AND EntityId={1} AND ActivityID = {2}", this.ID, EntityID, fromActivity.ID); DbHelperSQL.ExecuteSql(strUserSql); AddProcessLog(fromActivity.ID, nextActivity.ID, 2); this.FromActivity = CurrentActivity; this.ToActivity = nextActivity; _masterData = null; fromActivity.DoAction(); if (this.CurrentActivity.CurrentUserChildActivities.Contains(fromActivity)) { this.CurrentActivity.CurrentUserChildActivities.Remove(fromActivity); } }
/// <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> /// From SGP RFQ Post to RFQ VVI /// </summary> /// <returns></returns> public ActionResult PostRFQToVVI() { string RFQID = "0"; if (Request.Form["RFQID"] != null) { RFQID = Request.Form["RFQID"]; } SystemMessages sysmgs = new SystemMessages(); if (RFQID == "0") { sysmgs.isPass = false; sysmgs.MessageType = "Post Error"; sysmgs.Messages.Add("Post Error", "RFQ don't allow null "); } else { if (VVIRFQManager.IsPost(RFQID) <= 0) { StringBuilder sb = new StringBuilder(); string sql = @"Insert into [SGP_RFQForVVI](RFQID,Number,VVINumber,[OEM],GAMBDM,CustomerPartNumber,Revision,MarketSegment,[Application],MassProductionEAU,MassProductionDate,StatusID,ActivityID,TemplateID) Select RFQID,Number,Number,[OEM],GAMBDM,CustomerPartNumber,Revision,MarketSegment,[Application],VolumePerMonth,MassProductionDate,1,101,1 from V_SGP where RFQID=" + RFQID + ""; DbHelperSQL.ExecuteSql(sql); } else { sysmgs.isPass = false; sysmgs.MessageType = "Post Error"; sysmgs.Messages.Add("Post Error", "already exists "); } } var returnData = new { SysMsg = sysmgs }; return Json(returnData, JsonRequestBehavior.AllowGet); }
private void SubmitToNextActivity(SystemMessages sysMsg, WFActivity nextActivity, params int[] toChildActivityId) { string strSql = String.Format("DELETE FROM SGP_CurrentUserTask WHERE TemplateID={0} AND EntityId={1}", this.ID, EntityID); DbHelperSQL.ExecuteSql(strSql); string extSql = ""; if (nextActivity.ID == LastActivity.ID) { extSql = ",StatusID = 9"; } else { if (nextActivity.ChildActivities.Count > 0) { if (toChildActivityId != null && toChildActivityId.Length > 0) { for (int i = 0; i < toChildActivityId.Length; i++) { WFActivity ncta = nextActivity.MatchChildActivities.Get(toChildActivityId[i]); if (ncta != null) { AddCurrentUserTask(ncta); } } } else { foreach (WFActivity nca in nextActivity.MatchChildActivities) { AddCurrentUserTask(nca); } } } else { AddCurrentUserTask(nextActivity); } } if (nextActivity.ChildActivities.Count > 0) { if (toChildActivityId != null && toChildActivityId.Length > 0) { for (int i = 0; i < toChildActivityId.Length; i++) { WFActivity ncta = nextActivity.MatchChildActivities.Get(toChildActivityId[i]); if (ncta != null) { AddProcessLog(nextActivity.ID, ncta.ID, 4); } } } else { foreach (WFActivity nca in nextActivity.MatchChildActivities) { AddProcessLog(nextActivity.ID, nca.ID, 4); } } AddProcessLog(CurrentActivity == null ? 0 : CurrentActivity.ID, nextActivity.ID, 3); } else { AddProcessLog(CurrentActivity == null ? 0 : CurrentActivity.ID, nextActivity.ID, (CurrentActivity != null && CurrentActivity.ChildActivities.Count > 0) ? 1 : 0); } strSql = String.Format("UPDATE {0} SET ActivityID = @ActivityID, TemplateID = @TemplateID {2} WHERE {1} = @{1}", this.TableName, this.TableKey, extSql); DbHelperSQL.ExecuteSql(strSql, new SqlParameter[]{ new SqlParameter("@ActivityID", nextActivity.ID), new SqlParameter("@TemplateID", this.ID), new SqlParameter("@" + this.TableKey, this.EntityID) }); this.FromActivity = CurrentActivity; this.ToActivity = nextActivity; _masterData = null; nextActivity.DoAction(); foreach (WFActivity nca in nextActivity.MatchChildActivities) { nca.DoAction(); } }
public JsonResult SaveData() { SystemMessages sysMsg = new SystemMessages(); int id = 0; string postData = Request["postData"]; 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"]); Int32.TryParse(dataId, out id); FieldCategory category = new FieldCategory(Convert.ToString(jsonData["categoryName"])); Dictionary<string, object> data = jsonData["data"] as Dictionary<string, object>; if (id == 0) { data["CreatorName"] = AccessControl.CurrentLogonUser.Name; data["CreationTime"] = DateTime.Now; } using (TScope ts = new TScope()) { try { CostingPeriodDetail cpd = new CostingPeriodDetail(category, data); category.CheckDataType(data, sysMsg); cpd.CheckData(sysMsg); if (sysMsg.isPass) { if (id > 0) { cpd.Update(id); } else { id = cpd.Add(); } if (Convert.ToString(data["Status"]) == "Active") { SetActiveToClose(id); } } } catch (Exception ex) { ts.Rollback(); sysMsg.isPass = false; sysMsg.Messages.Add("Error", ex.Message); } } } var jsonResult = new { DataId = id, success = sysMsg.isPass, errMessage = sysMsg.MessageString }; return Json(jsonResult); }
/// <summary> /// Save data for supplier RFQ /// </summary> /// <param name="postData"></param> /// <param name="sysMsg"></param> /// <returns></returns> /// Lance Chen 20150126 private int SupplierRfqSave(string postData, SystemMessages sysMsg, out bool isOutOfCapability) { isOutOfCapability = false; int id = 0; if (!string.IsNullOrEmpty(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 number = Convert.ToString(jsonData["number"]); 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_SGPFORSUPPLIER); 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 { SupplierRFQDetail dm = new SupplierRFQDetail(lfc, data); if (id > 0) { dm.UpdateSubDataForSupplierRfq(id, number, out isOutOfCapability); if (operation == "Submit") { dm.UpdateSupplierRfqStatus(id, number); dm.AddSupplierRFQHistory(id, number, "Submit", sysMsg); } else { dm.AddSupplierRFQHistory(id, number, "Save", 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); } } } } return id; }
/// <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 static void SavaAndCheckData(ref VVIRFQManager vvirfdetail, ref SystemMessages sysmgs,HttpRequestBase request) { Dictionary<string, object> data = new Dictionary<string, object>(); foreach(string key in request.Form.Keys) { if (!data.ContainsKey(key)) { data.Add(key,request.Form[key]); } } VVIRFQManager checkdata = new VVIRFQManager(); VVIRFQManager.CheckData(request, ref sysmgs); //检查数据通过则执行保存到数据库 if (sysmgs.isPass) { NameValueCollection Result = BI.SGP.BLL.Models.VVIRFQManager.Save(request); string ID = Result["ID"]; int vvirfqid = 0; Int32.TryParse(ID, out vvirfqid); //有MSG返回,表示保存失败 if (string.IsNullOrEmpty(Result["Mgs"]) == false) { sysmgs.isPass = false; sysmgs.MessageType = "Save Error"; sysmgs.Messages.Add("Save Error", Result["Mgs"]); } else { sysmgs.isPass = true; sysmgs.MessageType = "Save Success"; //sysmgs.Messages.Add("Save Success", Result["Mgs"]); } if (vvirfqid > 0) { vvirfdetail = VVIRFQManager.GetDetailById(vvirfqid); } } else // 检查数据不通过 { sysmgs.MessageType = "Error"; } }
//public ActionResult AssignSupplier() //{ // SystemMessages sysmgs = new SystemMessages(); // string vvirfqid = string.Empty; // sysmgs.isPass = true; // try // { // //curd.Save(); // string number = Request.Form["Number"]; // string suppiler = Request.Form["SupplierCode"]; // string VVINumber = number + "-" + suppiler; // if (VVIRFQManager.CheckVVINumberExists(VVINumber)) // { // sysmgs.isPass = false; // sysmgs.MessageType = "Aleady Assgined"; // sysmgs.Messages.Add("Aleady Assgined", "Aleady Assgined"); // } // else // { // NameValueCollection Result = VVIRFQManager.AssignSuppliers(Request); // if (string.IsNullOrEmpty(Result["Mgs"]) == false) // { // sysmgs.isPass = false; // sysmgs.MessageType = "Assgin Error"; // sysmgs.Messages.Add("Assgin Error", Result["Mgs"]); // } // else // { // sysmgs.isPass = true; // sysmgs.MessageType = "Assgin Success"; // //sysmgs.Messages.Add("Save Success", Result["Mgs"]); // } // } // } // catch (Exception ex) // { // sysmgs.isPass = false; // sysmgs.MessageType = "Assgin Error"; // sysmgs.Messages.Add("Assgin Error", ex.ToString()); // } // var returnData = new // { // SysMsg = sysmgs // }; // return Json(returnData, JsonRequestBehavior.AllowGet); //} public ActionResult PostBacKToGP() { VVIRFQManager vvirfqdetail = new VVIRFQManager(); SystemMessages sysmgs = new SystemMessages(); VVIRFQManager.SavaAndCheckData(ref vvirfqdetail, ref sysmgs, Request); string html = ""; if (sysmgs.isPass == true) { html = SGP.BLL.UIManager.VVIUIManager.GenrateVVIRFQDetail(vvirfqdetail, vvirfqdetail.ID.ToString(), "Edit"); } // string aa = Request.Form["Number"]; var returnData = new { HTML = html, ID = vvirfqdetail.ID, SysMsg = sysmgs }; return Json(returnData, JsonRequestBehavior.AllowGet); }