<%@ Page Title="" Language="C#" MasterPageFile="~/SA_MASTER_reports.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.style1
{
height: 25px;
}
</style>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
style="border: medium groove #000000">
style="color: #0000FF; font-weight: bold" >
<asp:Label ID="Lblerr" runat="server" Text="Label">
<asp:Label ID="Labelerr1" runat="server" Text="Label">
|
style="color: #0000FF; font-weight: bold" >
<asp:Label ID="Label8" runat="server" Text="State Code">
| style="color: #0000FF; font-weight: bold" >
<asp:Label ID="St" runat="server" Text="Label">
|
style="color: #0000FF; font-weight: bold" >
<asp:Label ID="Label10" runat="server" Text="District">
| style="color: #0000FF; font-weight: bold" >
<asp:Label ID="Di" runat="server" Text="Label">
|
style="color: #0000FF; font-weight: bold" >
<asp:Label ID="Label12" runat="server" Text="Panchayat Name">
| style="color: #0000FF; font-weight: bold" >
<asp:Label ID="Pan" runat="server" Text="Label">
|
style="color: #0000FF; font-weight: bold" class="style1" >
<asp:Label ID="Label14" runat="server" Text="Panchayat Code">
| style="color: #0000FF; font-weight: bold" class="style1" >
<asp:Label ID="Pac" runat="server" Text="Label">
|
style="color: #0000FF; font-weight: bold" >
<asp:Label ID="Label16" runat="server" Text="From">
| style="color: #0000FF; font-weight: bold" >
<asp:Label ID="Fr" runat="server" Text="Label">
|
style="color: #0000FF; font-weight: bold" >
<asp:Label ID="Label18" runat="server" Text="To">
| style="color: #0000FF; font-weight: bold" >
<asp:Label ID="To" runat="server" Text="Label">
|
style="border: medium groove #000000">
style="color: #0000FF; font-weight: bold" >
<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#999999"
BorderStyle="None" BorderWidth="1px" CellPadding="3" AutoGenerateColumns="False"
ShowFooter="True" OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnRowEditing="GridView1_RowEditing"
Width="83%" AllowPaging="True"
onpageindexchanging="GridView1_PageIndexChanging" PageSize="5"
GridLines="Vertical" onrowupdating="GridView1_RowUpdating"
>
<alternatingrowstyle backcolor="#DCDCDC">
<columns> <asp:TemplateField HeaderText="S NO" HeaderStyle-BackColor=>
<itemtemplate>
<asp:Label ID="sno" runat="server" Text='<%#Eval("s_no") %>'>
<asp:TemplateField HeaderText="NAME OF HEAD OF HOUSEHOLD">
<itemtemplate>
<asp:Label ID="Nme" runat="server" Text='<%#Eval("Nme_of_head_hh ") %>'>
<asp:TemplateField HeaderText="NO OF DAYS OF WORK PROVIDED">
<itemtemplate>
<asp:Label ID="No" runat="server" Text='<%#Eval(" No_of_days_provided") %>'>
<asp:TemplateField HeaderText="NO OF DAYS WORK DEMANDED BUT NOT PROVIDED">
<itemtemplate>
<asp:Label ID="Not" runat="server" Text='<%#Eval(" No_of_days_nt_provided") %>'>
<asp:TemplateField HeaderText="NAME OF INDIVIDUAL WORK SANCTIONED">
<itemtemplate>
<asp:Label ID="Noi" runat="server" Text='<%#Eval("Name_of_indi_sanc") %>'>
<asp:TemplateField HeaderText="JOB CARDNUMBER" HeaderStyle-BackColor ="Green">
<edititemtemplate>
<asp:TextBox ID="Jc1" runat="server" Text='<%#Eval("Job_card") %>'>
<itemtemplate>
<asp:Label ID="Jc" runat="server" Text='<%#Eval("Job_card") %>'>
<HeaderStyle BackColor="Green"></HeaderStyle>
<asp:TemplateField HeaderText="UNREGISTER DEMAND TO BE FILLED BY SOCIAL AUDIT" HeaderStyle-BackColor ="Green">
<edititemtemplate>
<asp:TextBox ID="UD" runat="server" Text='<%#Eval("Unregister_demand_to_be") %>'>
<itemtemplate>
<asp:Label ID="udt" runat="server" Text='<%#Eval("Unregister_demand_to_be") %>'>
<HeaderStyle BackColor="Green"></HeaderStyle>
<asp:TemplateField HeaderText="INDIVIDUAL WORK DESIRED BUT NOT SANCTIONED" HeaderStyle-BackColor ="Green">
<edititemtemplate>
<asp:TextBox ID="iwt" runat="server" Text='<%#Eval("Individual_work_req") %>'>
<itemtemplate>
<asp:Label ID="IW" runat="server" Text='<%#Eval("Individual_work_req") %>'>
<HeaderStyle BackColor="Green"></HeaderStyle>
<asp:TemplateField HeaderText="SC ST OTHER WHO IS NOT TAGGED AS SC ST OTHER VULNERABLE GROUP AS SO ON THE MIS" HeaderStyle-BackColor ="Green">
<edititemtemplate>
<asp:TextBox ID="sct" runat="server" Text='<%#Eval(" Sc_st_other") %>'>
<itemtemplate>
<asp:Label ID="SC" runat="server" Text='<%#Eval(" Sc_st_other") %>'>
<HeaderStyle BackColor="Green"></HeaderStyle>
<asp:CommandField ShowEditButton="True" />
<footerstyle backcolor="#CCCCCC" forecolor="Black">
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<pagerstyle backcolor="#999999" forecolor="Black" horizontalalign="Center">
<rowstyle backcolor="#EEEEEE" forecolor="Black">
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<sortedascendingcellstyle backcolor="#F1F1F1">
<sortedascendingheaderstyle backcolor="#0000A9">
<sorteddescendingcellstyle backcolor="#CAC9C9">
<sorteddescendingheaderstyle backcolor="#000065">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:hhConnectionString %>"
SelectCommand="SELECT * FROM [nrega111]">
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
String district_name = "";
String state_name = "";
String panchayat_name = "";
String panchayat_code = "";
String from_dt = "";
String To_dt = "";
public String state_code = "";
DataTable dtt;
SqlConnection con = new SqlConnection();
protected void Page_Load(object sender, EventArgs e)
{
Labelerr1.Text = "";
Lblerr.Text = "";
district_name = Convert.ToString(Session["district_name2"]);
state_code = Convert.ToString(Session["state_code_d2"]);
panchayat_name = Convert.ToString(Session["panchayat_name2"]);
from_dt = Convert.ToString(Session["from_dt2"]);
To_dt = Convert.ToString(Session["to_dt2"]);
panchayat_code = Convert.ToString(Session["panchayat_code2"]); ;
if (!Page.IsPostBack)
{
St.Text = state_name;
Di.Text = district_name;
Pan.Text = panchayat_name;
Pac.Text = panchayat_code;
Fr.Text = from_dt;
To.Text = To_dt;
DataTable ff = new DataTable();
ff = binddatasc();
GridView1.DataSource = ff;
GridView1.DataBind();
}
}
public DataTable binddatasc()
{
con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["hhConnectionString"].ConnectionString;
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "select * from nrega111";
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
adp.Fill(dt);
return dt;
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
try
{
GridView1.EditIndex = -1;
dtt = binddatasc();
if (dtt.Rows.Count == 0)
{
GridView1.Visible = false;
}
else
{
GridView1.Visible = true;
}
GridView1.DataSource = dtt;
GridView1.DataBind();
}
catch (Exception ex)
{
Labelerr1.Text = "Error :" + ex.Message;
}
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
try
{
foreach (GridViewRow row in GridView1.Rows)
{
GridView1.EditIndex = e.NewEditIndex;
}
dtt = binddatasc();
GridView1.DataSource = dtt;
GridView1.DataBind();
}
catch (Exception ex)
{
Labelerr1.Text = "Error : " + ex.Message;
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
dtt = binddatasc();
GridView1.DataSource = dtt;
GridView1.DataBind();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
if (Page.IsValid)
{
socialAudit_BL vv = new socialAudit_BL();
SocialAudit_BE tt = new SocialAudit_BE();
Label Jc = (Label)GridView1.Rows[e.RowIndex].FindControl("Jc");
Label udt = (Label)GridView1.Rows[e.RowIndex].FindControl("UD");
Label IW = (Label)GridView1.Rows[e.RowIndex].FindControl("IW");
Label SC = (Label)GridView1.Rows[e.RowIndex].FindControl("SC");
TextBox Jc1 = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Jc1");
TextBox UD = (TextBox)GridView1.Rows[e.RowIndex].FindControl("udt");
TextBox iwt = (TextBox)GridView1.Rows[e.RowIndex].FindControl("iwt");
TextBox sct = (TextBox)GridView1.Rows[e.RowIndex].FindControl("sct");
tt.jobc_no = Jc1.Text;
tt.Unregs_deman_to_be_fill = udt.Text;
tt.Indi_work_desire_nt_sanstioned = sct.Text;
tt.Sc_st_other_whois_nt_tagg = sct.Text;
tt.state_code = St.Text;
tt.district_name = Di.Text;
tt.panchayat = Pan.Text;
tt.panchayat_code = Pac.Text;
tt.dt_from = Convert.ToDateTime(Fr.Text);
tt.dt_To = Convert.ToDateTime(To.Text);
socialAudit_BL audit11 = new socialAudit_BL();
audit11.updategrid1(tt, GridView1.DataKeys[e.RowIndex].Values[0].ToString());
Labelerr1.ForeColor = System.Drawing.Color.Green;
Labelerr1.Text = "Record submitted";
}
}
catch (Exception ex)
{
Labelerr1.Text = "error:" + ex.Message;
}
finally
{
con.Close();
}
}
}