Exemple #1
0
        private int Save(string postData, SystemMessages sysMsg, bool checkRequired)
        {
            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 commonCategoryName = Convert.ToString(jsonData["commonCategoryName"]);
                string basicInfoCategoryName = Convert.ToString(jsonData["basicInfoCategoryName"]);
                string processFlowCategoryName = Convert.ToString(jsonData["processFlowCategoryName"]);
                string bomCategoryName = Convert.ToString(jsonData["bomCategoryName"]);
                string edmCategoryName = Convert.ToString(jsonData["edmCategoryName"]);
                string specialCategoryName = Convert.ToString(jsonData["specialCategoryName"]);

                Int32.TryParse(dataId, out id);
                Dictionary<string, object> data = jsonData["data"] as Dictionary<string, object>;
                Dictionary<string, object> yieldData = jsonData["yieldData"] as Dictionary<string, object>;

                CostingInputDetail ciDetail = new CostingInputDetail();

                ciDetail.CommonCategory = new FieldCategory(commonCategoryName);
                ciDetail.BasicInfoCategory = new FieldCategory(basicInfoCategoryName);
                ciDetail.ProcessFlowCategory = new FieldCategory(processFlowCategoryName);
                ciDetail.BOMCategory = new FieldCategory(bomCategoryName);
                ciDetail.EDMCategories = FieldCategory.GetCategoryByName(edmCategoryName);
                ciDetail.SpecialCategory = FieldCategory.GetCategoryByName(specialCategoryName);
                ciDetail.YieldData = yieldData;
                ciDetail.FillData(data);
                ciDetail.CheckDataType(sysMsg);

                if (checkRequired)
                {
                    ciDetail.CheckRequired(sysMsg);
                }

                if (sysMsg.isPass)
                {
                    using (TScope ts = new TScope())
                    {
                        try
                        {
                            if (id > 0)
                            {
                                ciDetail.Update(id);
                            }
                            else
                            {
                                id = ciDetail.Add();
                            }
                        }
                        catch (Exception ex)
                        {
                            ts.Rollback();
                            sysMsg.isPass = false;
                            sysMsg.Messages.Add("Error", ex.Message);
                        }
                    }
                }
            }

            return id;
        }
Exemple #2
0
        public JsonResult GenrateSubCategories()
        {
            string html = "";
            string errMessage = "";
            string dataId = Request["dataId"];
            string categoriesName = Request["categoryName"];
            string canEditCategory = Request["canEditCategory"];
            string headEditCategory = Request["headEditCategory"];

            int id = ParseHelper.Parse<int>(dataId);

            try
            {
                string[] cns = categoriesName.Split(',');
                foreach (string cn in cns)
                {
                    FieldCategory category = new FieldCategory(cn.Trim());
                    if (id > 0)
                    {
                        CostingInputDetail ciDetail = new CostingInputDetail();
                        ciDetail.FillSubCategoryData(category, id);
                    }
                    html += BI.SGP.BLL.UIManager.CostingMasterDataDetailHelper.GenrateSubCategory(category, cns.Length > 1, canEditCategory.IndexOf(cn) != -1, headEditCategory.IndexOf(cn) != -1);
                }
            }
            catch (Exception ex)
            {
                errMessage = ex.Message;
            }
            var result = new
            {
                success = (errMessage == "" ? true : false),
                html = html,
                errMessage = errMessage
            };
            return Json(result);
        }
Exemple #3
0
        public JsonResult GenrateYieldCategory()
        {
            string html = "";
            string errMessage = "";
            int id = ParseHelper.Parse<int>(Request["dataId"]);
            string pcbType = Request["pcbType"];
            string version = Request["version"];

            try
            {
                Dictionary<string, string> data = new Dictionary<string, string>();

                if (id > 0)
                {
                    CostingInputDetail ciDetail = new CostingInputDetail();
                    ciDetail.FillYieldData(data, id);
                }
                html = BI.SGP.BLL.UIManager.CostingMasterDataDetailHelper.GenrateYieldCategory(pcbType, version, data);
            }
            catch (Exception ex)
            {
                errMessage = ex.Message;
            }
            var result = new
            {
                success = (errMessage == "" ? true : false),
                html = html,
                errMessage = errMessage
            };
            return Json(result);
        }
Exemple #4
0
        public JsonResult GenrateCategory()
        {
            string html = "";
            string errMessage = "";
            int id = 0;
            string dataId = Request["dataId"];
            string categoryName = Request["categoryName"];
            Int32.TryParse(dataId, out id);

            try
            {
                FieldCategory category = new FieldCategory(categoryName);

                if (id > 0)
                {
                    CostingInputDetail ciDetail = new CostingInputDetail();
                    ciDetail.FillMainCategoryData(category, id);
                }

                html = BI.SGP.BLL.UIManager.CostingMasterDataDetailHelper.GenrateCategory(category);
            }
            catch (Exception ex)
            {
                errMessage = ex.Message;
            }
            var result = new
            {
                success = (errMessage == "" ? true : false),
                html = html,
                errMessage = errMessage
            };
            return Json(result);
        }