Example #1
0
        public ActionResult NewFeatureMasterContract(string txtFeatureType, string txtMinMaterial, string txtContractNo, string txtItemNo)
        {
            string errorMessage = "Failed";
            bool   success      = true;

            WebView.WebService._base myWebService;
            myWebService = new WebService._base();
            //System.Diagnostics.Debug.WriteLine("DAY :" + txtDay);
            bool validateData = myWebService.ValidateNewFeatureMastContractMaintenance(txtMinMaterial, txtContractNo, txtItemNo);

            if (validateData)
            {
                WebService._base.FeatureMaintenance newFeatMain = new WebService._base.FeatureMaintenance();
                newFeatMain.FEATURE_TYPE = txtFeatureType;
                newFeatMain.MIN_MATERIAL = txtMinMaterial;
                newFeatMain.CONTRACT_NO  = txtContractNo;
                newFeatMain.ITEM_NO      = txtItemNo;
                success = myWebService.AddFeatureMastContractMaintenance(newFeatMain);
            }
            else
            {
                success      = false;
                errorMessage = "Contract No and Item No existed.";
            }
            return(Json(new
            {
                errorMessage = errorMessage,
                Success = success
            }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult UpdateFeatureMasterContract(string txtMinMaterial, string txtFeatMastNo, string txtContractNo, string txtItemNo)
        {
            bool   success      = true;
            string errorMessage = "Failed";

            WebView.WebService._base myWebService;
            myWebService = new WebService._base();
            string contractNo = "";
            string itemNo     = "";

            using (Entities ctxdata = new Entities())
            {
                int featNo = Convert.ToInt16(txtFeatMastNo);
                var query  = from a in ctxdata.WV_FEAT_MAST_CONTRACT
                             where a.FEAT_MAST_CONTRACT_NO == featNo
                             select new { a.CONTRACT_NO, a.ITEM_NO };
                foreach (var data in query)
                {
                    contractNo = data.CONTRACT_NO;
                    itemNo     = data.ITEM_NO;
                }
            }
            bool validateData = true;

            if ((contractNo != txtContractNo) && (itemNo != txtItemNo))
            {
                validateData = myWebService.ValidateNewFeatureMastContractMaintenance(txtMinMaterial, txtContractNo, txtItemNo);
            }
            if (validateData)
            {
                WebService._base.FeatureMaintenance newFeatMain = new WebService._base.FeatureMaintenance();
                newFeatMain.FEAT_MAST_CONTRACT_NO = txtFeatMastNo;
                newFeatMain.CONTRACT_NO           = txtContractNo;
                newFeatMain.ITEM_NO = txtItemNo;
                success             = myWebService.UpdateFeatMastContract(newFeatMain);
            }
            else
            {
                success      = false;
                errorMessage = "Contract No and Item No existed.";
            }
            return(Json(new
            {
                errorMessage = errorMessage,
                Success = success
            }, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public ActionResult UpdateFeatureMaster(string txtMinMaterial, string txtFeatMastNo, string txtFeatureState, string txtDay, string txtNight, string txtWeekend, string txtHoliday)
        {
            bool   success      = true;
            string errorMessage = "Failed";

            WebView.WebService._base myWebService;
            myWebService = new WebService._base();
            string day     = "";
            string night   = "";
            string weekend = "";
            string holiday = "";

            using (Entities ctxdata = new Entities())
            {
                int featNo = Convert.ToInt16(txtFeatMastNo);
                var query  = from a in ctxdata.WV_FEAT_MAST
                             where a.FEAT_MAST_NO == featNo
                             select new { a.DAY, a.NIGHT, a.WEEKEND, a.HOLIDAY };
                foreach (var data in query)
                {
                    day     = data.DAY.ToString();
                    night   = data.NIGHT.ToString();
                    weekend = data.WEEKEND.ToString();
                    holiday = data.HOLIDAY.ToString();
                }
            }
            bool validateDay = true;

            if (day != txtDay)
            {
                validateDay = myWebService.ValidateNewFeatureMastMaintenance(txtMinMaterial, txtDay, "DAY");
            }
            bool validateNight = true;

            if (night != txtNight)
            {
                validateNight = myWebService.ValidateNewFeatureMastMaintenance(txtMinMaterial, txtNight, "NIGHT");
            }
            bool validateWeekend = true;

            if (weekend != txtWeekend)
            {
                validateWeekend = myWebService.ValidateNewFeatureMastMaintenance(txtMinMaterial, txtWeekend, "WEEKEND");
            }
            bool validateHoliday = true;

            if (holiday != txtHoliday)
            {
                validateHoliday = myWebService.ValidateNewFeatureMastMaintenance(txtMinMaterial, txtHoliday, "HOLIDAY");
            }

            if (validateDay && validateNight && validateWeekend && validateHoliday)
            {
                WebService._base.FeatureMaintenance newFeatMain = new WebService._base.FeatureMaintenance();
                newFeatMain.FEAT_MAST_NO  = txtFeatMastNo;
                newFeatMain.DAY           = txtDay;
                newFeatMain.NIGHT         = txtNight;
                newFeatMain.WEEKEND       = txtWeekend;
                newFeatMain.HOLIDAY       = txtHoliday;
                newFeatMain.FEATURE_STATE = txtFeatureState;
                success = myWebService.UpdateFeatMast(newFeatMain);
            }
            else
            {
                success      = false;
                errorMessage = "PU Id ";
                if (!validateDay)
                {
                    if (errorMessage != "PU Id ")
                    {
                        errorMessage += ", ";
                    }
                    errorMessage += "Day";
                }
                if (!validateNight)
                {
                    if (errorMessage != "PU Id ")
                    {
                        errorMessage += ", ";
                    }
                    errorMessage += "Night";
                }
                if (!validateWeekend)
                {
                    if (errorMessage != "PU Id ")
                    {
                        errorMessage += ", ";
                    }
                    errorMessage += "Weekend";
                }
                if (!validateHoliday)
                {
                    if (errorMessage != "PU Id ")
                    {
                        errorMessage += ", ";
                    }
                    errorMessage += "Holiday";
                }

                errorMessage += " existed.";
            }
            return(Json(new
            {
                errorMessage = errorMessage,
                Success = success
            }, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        public ActionResult NewFeatureMaster(string txtFeatureType, string txtMinMaterial, string txtFeatureState, string txtDay, string txtNight, string txtWeekend, string txtHoliday)
        {
            string errorMessage = "Failed";
            bool   success      = true;

            WebView.WebService._base myWebService;
            myWebService = new WebService._base();
            System.Diagnostics.Debug.WriteLine("DAY :" + txtDay);
            bool validateDay     = myWebService.ValidateNewFeatureMastMaintenance(txtMinMaterial, txtDay, "DAY");
            bool validateNight   = myWebService.ValidateNewFeatureMastMaintenance(txtMinMaterial, txtNight, "NIGHT");
            bool validateWeekend = myWebService.ValidateNewFeatureMastMaintenance(txtMinMaterial, txtWeekend, "WEEKEND");
            bool validateHoliday = myWebService.ValidateNewFeatureMastMaintenance(txtMinMaterial, txtHoliday, "HOLIDAY");

            if (validateDay && validateNight && validateWeekend && validateHoliday)
            {
                WebService._base.FeatureMaintenance newFeatMain = new WebService._base.FeatureMaintenance();
                newFeatMain.FEATURE_TYPE  = txtFeatureType;
                newFeatMain.MIN_MATERIAL  = txtMinMaterial;
                newFeatMain.FEATURE_STATE = txtFeatureState;
                newFeatMain.DAY           = txtDay;
                newFeatMain.NIGHT         = txtNight;
                newFeatMain.WEEKEND       = txtWeekend;
                newFeatMain.HOLIDAY       = txtHoliday;
                success = myWebService.AddFeatureMastMaintenance(newFeatMain);
            }
            else
            {
                success      = false;
                errorMessage = "PU Id ";
                if (!validateDay)
                {
                    if (errorMessage != "PU Id ")
                    {
                        errorMessage += ", ";
                    }
                    errorMessage += "Day";
                }
                if (!validateNight)
                {
                    if (errorMessage != "PU Id ")
                    {
                        errorMessage += ", ";
                    }
                    errorMessage += "Night";
                }
                if (!validateWeekend)
                {
                    if (errorMessage != "PU Id ")
                    {
                        errorMessage += ", ";
                    }
                    errorMessage += "Weekend";
                }
                if (!validateHoliday)
                {
                    if (errorMessage != "PU Id ")
                    {
                        errorMessage += ", ";
                    }
                    errorMessage += "Holiday";
                }

                errorMessage += " existed.";
            }
            return(Json(new
            {
                errorMessage = errorMessage,
                Success = success
            }, JsonRequestBehavior.AllowGet));
        }