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)); }