/// <summary> /// To Update PAP Welfare /// </summary> /// <param name="WelfareList"></param> public void UpdatePAPWelfare(GeneralWelfareList WelfareList) { cnn = new OracleConnection(con); proc = "USP_TRN_UPD_GENERALWELFARE"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); cmd.Parameters.Add("HOUSEHOLDID_", ""); cmd.Parameters.Add("WLF_INDICATORID_", ""); cmd.Parameters.Add("WLF_INDICATORVALUE_", ""); cmd.Parameters.Add("UPDATEDBY_", ""); foreach (GeneralWelfareBO objWelfare in WelfareList) { cmd.Parameters["HOUSEHOLDID_"].Value = objWelfare.HouseholdID; cmd.Parameters["WLF_INDICATORID_"].Value = objWelfare.WelfareIndicatorID; cmd.Parameters["WLF_INDICATORVALUE_"].Value = objWelfare.FieldValue; cmd.Parameters["UPDATEDBY_"].Value = objWelfare.UpdatedBy; cmd.ExecuteNonQuery(); } cmd.Connection.Close(); }
/// <summary> /// Get PAP Welfare details /// </summary> protected void GetPAPWelfares() { GeneralWelfareList Welfares = (new SocioEconomyBLL()).GetGeneralWelfares(Convert.ToInt32(Session["HH_ID"])); CheckBox chkWelfareType = null; TextBox txtWelfareType = null; Label lblWelfareName = null; int welfareMasterID = 0; string[] arr = new string[lstWelfares.Items.Count + 1]; int i = 0; foreach (DataListItem lstItem in lstWelfares.Items) { if (lstItem.ItemType == ListItemType.Item || lstItem.ItemType == ListItemType.AlternatingItem) { welfareMasterID = Convert.ToInt32(((Literal)lstItem.FindControl("litWelfareID")).Text); chkWelfareType = (CheckBox)lstItem.FindControl("chkWelfareType"); txtWelfareType = (TextBox)lstItem.FindControl("txtWelfareType"); lblWelfareName = (Label)lstItem.FindControl("lblWelfareName"); foreach (GeneralWelfareBO objWelfare in Welfares) { if (objWelfare.WelfareIndicatorID == welfareMasterID) { if (txtWelfareType.Visible) { txtWelfareType.Text = objWelfare.FieldValue; txtWelfareType.Enabled = false; if (arr.Length > 0 && i > 0) { string param = string.Format("EnableOtherTransEquipment('{0}','{1}');", arr[i - 1].ToString(), txtWelfareType.ClientID); ScriptManager.RegisterStartupScript(this, this.GetType(), "enable", param, true); } } else if (chkWelfareType.Visible && objWelfare.FieldValue == "TRUE") { chkWelfareType.Checked = true; if (chkWelfareType.Checked) { arr[i] = chkWelfareType.ClientID; i++; } } break; } } } } }
/// <summary> /// To Get General Welfares /// </summary> /// <param name="householdID"></param> /// <returns></returns> public GeneralWelfareList GetGeneralWelfares(int householdID) { proc = "USP_MST_GET_PAPWELFARES"; cnn = new OracleConnection(con); GeneralWelfareBO objWelfare = null; GeneralWelfareList WelfareList = new GeneralWelfareList(); cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("HHID_", householdID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; //try //{ cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (dr.Read()) { objWelfare = new GeneralWelfareBO(); if (!dr.IsDBNull(dr.GetOrdinal("WLF_INDICATORID"))) { objWelfare.WelfareIndicatorID = dr.GetInt32(dr.GetOrdinal("WLF_INDICATORID")); } if (!dr.IsDBNull(dr.GetOrdinal("WLF_INDICATORVALUE"))) { objWelfare.FieldValue = dr.GetString(dr.GetOrdinal("WLF_INDICATORVALUE")); } WelfareList.Add(objWelfare); } dr.Close(); //} //catch (Exception ex) //{ // throw ex; //} return(WelfareList); }
/// <summary> /// To sava and updata data into data base /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { GeneralWelfareList GeneralWelfares = new GeneralWelfareList(); GeneralWelfareBO objWelfare = null; CheckBox chkWelfareType = null; TextBox txtWelfareType = null; string[] arr = new string[lstWelfares.Items.Count + 1]; int i = 0; foreach (DataListItem lstItem in lstWelfares.Items) { if (lstItem.ItemType == ListItemType.Item || lstItem.ItemType == ListItemType.AlternatingItem) { chkWelfareType = (CheckBox)lstItem.FindControl("chkWelfareType"); txtWelfareType = (TextBox)lstItem.FindControl("txtWelfareType"); objWelfare = new GeneralWelfareBO(); objWelfare.HouseholdID = Convert.ToInt32(Session["HH_ID"]); objWelfare.WelfareIndicatorID = Convert.ToInt32(((Literal)lstItem.FindControl("litWelfareID")).Text); if (txtWelfareType.Visible) { objWelfare.FieldValue = txtWelfareType.Text; txtWelfareType.Enabled = false; if (arr.Length > 0 && i > 0) { string param = string.Format("EnableOtherTransEquipment('{0}','{1}');", arr[i - 1].ToString(), txtWelfareType.ClientID); ScriptManager.RegisterStartupScript(this, this.GetType(), "enable", param, true); } } else if (chkWelfareType.Visible) { if (chkWelfareType.Checked) { objWelfare.FieldValue = "TRUE"; } else { objWelfare.FieldValue = "FALSE"; } if (chkWelfareType.Checked) { arr[i] = chkWelfareType.ClientID; i++; } } else { objWelfare.FieldValue = ""; } objWelfare.UpdatedBy = Convert.ToInt32(Session["USER_ID"]); GeneralWelfares.Add(objWelfare); } } (new SocioEconomyBLL()).UpdatePAPWelfare(GeneralWelfares); GeneralWelfares = null; WelfareVoluntaryBO objVoluntary = new WelfareVoluntaryBO(); objVoluntary.HouseholdID = Convert.ToInt32(Session["HH_ID"]); objVoluntary.WhereGetDrinkingWater = txtWhereGetDrinkingWater.Text.Trim(); objVoluntary.WaterSourceDistance = txtWaterSourceDistance.Text.Trim(); if (chkDoYouFish.Checked) { objVoluntary.DoYouFish = "YES"; } else { objVoluntary.DoYouFish = "NO"; } if (chkDoYouFish.Checked) { txtWhereDoYouFish.Enabled = true; txtHowOftenFish.Enabled = true; } objVoluntary.WhereDoYouFish = txtWhereDoYouFish.Text.Trim(); objVoluntary.HowOftenFish = txtHowOftenFish.Text.Trim(); if (chkDoYouHunt.Checked) { objVoluntary.DoYouHunt = "YES"; } else { objVoluntary.DoYouHunt = "NO"; } if (chkDoYouHunt.Checked) { txtWhereHunt.Enabled = true; } objVoluntary.WhereHunt = txtWhereHunt.Text.Trim(); if (chkFirewood.Checked) { objVoluntary.Firewood = "YES"; } else { objVoluntary.Firewood = "NO"; } if (chkCharcoal.Checked) { objVoluntary.Charcoal = "YES"; } else { objVoluntary.Charcoal = "NO"; } if (chkParaffin.Checked) { objVoluntary.Paraffin = "YES"; } else { objVoluntary.Paraffin = "NO"; } if (chkElectricity.Checked) { objVoluntary.Electricity = "YES"; } else { objVoluntary.Electricity = "NO"; } if (chkGas.Checked) { objVoluntary.Gas = "YES"; } else { objVoluntary.Gas = "NO"; } if (chkSolar.Checked) { objVoluntary.Solar = "YES"; } else { objVoluntary.Solar = "NO"; } if (chkBiogas.Checked) { objVoluntary.Biogas = "YES"; } else { objVoluntary.Biogas = "NO"; } if (chkOtherFuel.Checked) { objVoluntary.OtherFuel = "YES"; } else { objVoluntary.OtherFuel = "NO"; } objVoluntary.Comments = txtComments.Text.Trim(); if (objVoluntary.Comments.Length > 1000) { objVoluntary.Comments = objVoluntary.Comments.Substring(0, 999); } objVoluntary.UpdatedBy = Convert.ToInt32(Session["USER_ID"]); (new SocioEconomyBLL()).UpdatePAPWelfareVoluntary(objVoluntary); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Data saved successfully');", true); ChangeRequestStatusWelfare(); ProjectFrozen(); }
/// <summary> /// To Update PAP Welfare /// </summary> /// <param name="WelfareList"></param> public void UpdatePAPWelfare(GeneralWelfareList WelfareList) { (new SocioEconomyDAL()).UpdatePAPWelfare(WelfareList); }