コード例 #1
0
ファイル: VVIController.cs プロジェクト: rivernli/SGP
        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);
        }
コード例 #2
0
ファイル: VVIController.cs プロジェクト: rivernli/SGP
        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);
        }