Example #1
0
        /// <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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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();
        }
Example #5
0
 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);
 }