protected string GetImgURL(bool IsGoodRepair) { return (IsGoodRepair == true) ? "../../App_Themes/MainTheme/Icon/tick.gif" :""; }
protected void btnROfIEvaluation_Click(object sender, EventArgs e) { try { string actionPerformed = string.Empty; this.lblAutoSave.Visible = false; this.lblAutoSave.Text = string.Empty; int currentYear = Convert.ToInt32(Session["CurrentYear"]) - 1; Services objServices = new Services(Convert.ToInt32(Session["CurrentYear"])); List<facilityinspectionsdo> objFacilityInspectionsDOList = new List<facilityinspectionsdo>(); bool ReasonCheck = false; string reasons = "Provide comments for "; int InspectionID; foreach (GridViewRow objGridViewRow in this.GVInspection.Rows) { InspectionID = Convert.ToInt32(GVInspection.DataKeys[objGridViewRow.RowIndex].Values[0]); if (objGridViewRow.RowType == DataControlRowType.DataRow) { CheckBox chkExemplary = ((CheckBox)objGridViewRow.FindControl("chkExemplary")); CheckBox chkIsGood = ((CheckBox)objGridViewRow.FindControl("ChkIsGoodRepair")); CheckBox chkIsFair = ((CheckBox)objGridViewRow.FindControl("ChkIsFairRepair")); CheckBox chkIsPoor = ((CheckBox)objGridViewRow.FindControl("ChkIsPoorRepair")); TextBox txtAction = ((TextBox)objGridViewRow.FindControl("txtAction")); //if (InspectionID != 9) //{ // if ((!chkIsGood.Checked && !chkIsFair.Checked && !chkIsPoor.Checked) && txtAction.Text.Trim().Length == 0) // { // ReasonCheck = true; // reasons += " \\n " + ((Label)objGridViewRow.FindControl("LblInspectionDesc")).Text; // } //} //else if (InspectionID == 9) //{ // if (!chkExemplary.Checked && !chkIsGood.Checked && !chkIsFair.Checked && !chkIsPoor.Checked) // { // ReasonCheck = true; // reasons = "Please select Repair Status for \\n " + ((Label)objGridViewRow.FindControl("LblInspectionDesc")).Text; // } //} FacilityInspectionsDO objFacilityInspectionsDO = new FacilityInspectionsDO(); objFacilityInspectionsDO.Year = currentYear; objFacilityInspectionsDO.CDS = Session["SelectedCDS"].ToString(); objFacilityInspectionsDO.InspectionID = Convert.ToInt32(GVInspection.DataKeys[objGridViewRow.DataItemIndex].Value); objFacilityInspectionsDO.LANGUAGE = this.ddlLanguage.SelectedValue.ToString(); if (chkIsGood.Checked) objFacilityInspectionsDO.IsGoodRepair = 2; else if (chkIsFair.Checked) objFacilityInspectionsDO.IsGoodRepair = 3; else if (chkIsPoor.Checked) objFacilityInspectionsDO.IsGoodRepair = 4; if (InspectionID == 9) { if (chkExemplary.Checked) objFacilityInspectionsDO.IsGoodRepair = 1; objFacilityInspectionsDO.Action = string.Empty; } else objFacilityInspectionsDO.Action = txtAction.Text; objFacilityInspectionsDOList.Add(objFacilityInspectionsDO); ((Label)objGridViewRow.FindControl("lblAction")).Text = txtAction.Text; Image imgIsGoodRepair = (Image)objGridViewRow.FindControl("imgIsGoodRepair"); imgIsGoodRepair.ImageUrl = GetImgURL(chkIsGood.Checked); } } if (ReasonCheck == false) { actionPerformed = objServices.SaveFacilityInspections(objFacilityInspectionsDOList); ((SchoolPlan.NavigationPages.SARCInput)this.Page).InsertApplicationLog(actionPerformed, "Section3_SchoolFacilities_Ver2.ascx/btnROfIEvaluation_Click"); rebindInspectionGrid(); } //else //{ // reasons = reasons.Trim(); // ScriptManager.RegisterStartupScript(this, this.GetType(), "ReasonMsg", "<script language='javascript'> alert('" + reasons + "'); </script>", false); //} SaveInspectionDate(); SetStatus(); } catch (Exception ex) { LogException(ex); } //catch (Exception ex) //{ // // ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "<script language='javascript'> alert('Error Occured'); </script>", false); // RadAjaxManager rad = (RadAjaxManager)this.Page.Master.FindControl("RadAjaxManager1"); // rad.ResponseScripts.Add(string.Format("alert('Error: {0}');", ex.Message.ToString())); //} }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)