コード例 #1
0
    protected void chkactive_chachedChanged(object sender, EventArgs e)
    {
        GridViewRow row = ((CheckBox)sender).Parent.Parent as GridViewRow;

        int rinrow = row.RowIndex;

        ViewState["id"] = Convert.ToString(grd.DataKeys[rinrow].Value);
        Label lblWhid = (Label)grd.Rows[rinrow].FindControl("lblWhid");
        Label lblEndd = (Label)grd.Rows[rinrow].FindControl("lbledate");

        ViewState["Whid"] = lblWhid.Text;

        string         openingdate = "select StartDate,EndDate,Report_Period_Id from ReportPeriod where Compid='" + Session["Comid"].ToString() + "' and Whid='" + ViewState["Whid"] + "' and Active='1'";
        SqlCommand     cmd22221    = new SqlCommand(openingdate, con);
        SqlDataAdapter adp22221    = new SqlDataAdapter(cmd22221);
        DataTable      ds112221    = new DataTable();

        adp22221.Fill(ds112221);
        if (ds112221.Rows.Count > 0)
        {
            ViewState["CurrentActiveStartDate"] = ds112221.Rows[0]["StartDate"].ToString();
            ViewState["CurrentActiveEndDate"]   = ds112221.Rows[0]["EndDate"].ToString();
            ViewState["RPACT"] = ds112221.Rows[0]["EndDate"].ToString();
        }


        string     str1 = "select Name,Report_Period_Id,StartDate,EndDate from ReportPeriod where EndDate='" + lblEndd.Text + "' and Whid='" + ViewState["Whid"] + "'";
        SqlCommand cmd1 = new SqlCommand(str1);

        cmd1.Connection = con;
        SqlDataAdapter da1 = new SqlDataAdapter();

        da1.SelectCommand = cmd1;
        DataTable ds1 = new DataTable();

        da1.Fill(ds1);

        if (ds1.Rows.Count > 0)
        {
            ViewState["SelectedYearStartDate"] = ds1.Rows[0]["StartDate"].ToString();
            ViewState["SelectedYearEndDate"]   = ds1.Rows[0]["EndDate"].ToString();
            ViewState["id"] = ds1.Rows[0]["Report_Period_Id"].ToString();
        }

        DateTime dt  = Convert.ToDateTime(ViewState["CurrentActiveEndDate"]);
        DateTime dt2 = dt.AddYears(1);
        DateTime dt3 = dt.AddYears(-1);

        DateTime dtnewdate = Convert.ToDateTime(ViewState["SelectedYearEndDate"]);

        if (dtnewdate == dt2 || dtnewdate == dt3)
        {
            ModalPopupExtender122.Show();
        }
        else
        {
            ModalPopupExtender1.Show();
        }
    }
コード例 #2
0
 protected void btnconf_Click(object sender, EventArgs e)
 {
     ModalPopupExtender122.Show();
 }