protected void Page_Load(object sender, EventArgs e)
        {
            if (TextBox121.Text.Length == 0)
            {
                TextBox121.Text = "0";
                TextBox142.Text = "0";
                TextBox133.Text = "0";
                TextBox144.Text = "0";
            }

            Page.MaintainScrollPositionOnPostBack = true;
            TextBox135.Text = (string)Session["ID_Pers_Check_Proj"];
            TextBox130.Text = DateTime.Today.Year.ToString();

            //       TextBox8.Text = DateTime.Today.ToString("dd/MM/yyyy");
            TextBox124.Text = DateTime.Today.ToString("dd/MM/yyyy");

            TextBox126.Text      = User.Identity.Name;
            TextBox128.Text      = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isotimia().ToString();
            TextBox121.BackColor = System.Drawing.ColorTranslator.FromHtml("#000066");
            TextBox125.BackColor = System.Drawing.ColorTranslator.FromHtml("#000066");
            TextBox133.BackColor = System.Drawing.ColorTranslator.FromHtml("#000066");
            TextBox134.BackColor = System.Drawing.ColorTranslator.FromHtml("#000066");
            TextBox144.BackColor = TextBox142.BackColor = System.Drawing.ColorTranslator.FromHtml("#000066");
            TextBox145.BackColor = TextBox143.BackColor = System.Drawing.ColorTranslator.FromHtml("#000066");

            if (!CheckBox1.Checked)
            {
                TextBox8.Text = DateTime.Today.ToString("dd/MM/yyyy");
            }



            if (TextBox128.Text == "0")
            {
                GridView4.Visible  = false;
                GridView8.Visible  = false;
                GridView12.Visible = false;
                TextBox133.Visible = false;
                TextBox134.Visible = false;
                TextBox144.Visible = false;
                TextBox145.Visible = false;
            }
            else
            {
                GridView4.Columns[0].HeaderText  = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Descr(Convert.ToDateTime(TextBox8.Text).ToString("yyyy-MM-dd")).ToString();
                GridView12.Columns[0].HeaderText = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Descr(Convert.ToDateTime(TextBox8.Text).ToString("yyyy-MM-dd")).ToString();

                GridView4.Visible  = true;
                GridView8.Visible  = true;
                GridView12.Visible = true;
                TextBox133.Visible = true;
                TextBox134.Visible = true;
                TextBox144.Visible = true;
                TextBox145.Visible = true;
            }

            Session["Status_Cur"] = "0";


            TextBox134.Text = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Descr(DateTime.Today.ToString("yyyy-MM-dd")).ToString();
            TextBox145.Text = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Descr(DateTime.Today.ToString("yyyy-MM-dd")).ToString();


            if (!IsPostBack)
            {
                ABE_KINISI_WAIT.DataBind();
                GridView9.DataBind();
                TextBox138.Text = GridView9.Rows[0].Cells[17].Text;
                TextBox139.Text = GridView9.Rows[0].Cells[6].Text + ", " + GridView9.Rows[0].Cells[8].Text;
            }


            Enab_Area();
            ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button1);
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(CS);

            con.Open();
            Label1.Text = "All info about the employee with ID 8";
            SqlCommand cmd1 = new SqlCommand("select * from employees where EmployeeID=8", con);

            GridView1.DataSource = cmd1.ExecuteReader();
            GridView1.DataBind();
            con.Close();

            con.Open();
            Label2.Text = "The list of first and last names of the employees from London";
            SqlCommand cmd2 = new SqlCommand("select FirstName,LastName from employees where City='London'", con);

            GridView2.DataSource = cmd2.ExecuteReader();
            GridView2.DataBind();
            con.Close();

            con.Open();
            Label3.Text = "The list of first and last names of the employees whose first name begins with letter A";
            SqlCommand cmd3 = new SqlCommand("select FirstName,LastName from employees where FirstName like 'A%' ", con);

            GridView3.DataSource = cmd3.ExecuteReader();
            GridView3.DataBind();
            con.Close();

            con.Open();
            Label4.Text = "The list of first, last names and ages of the employees whose age is greater than 55. The result should be sorted by last name";
            SqlCommand cmd4 = new SqlCommand("select FirstName,LastName ,(CURRENT_TIMESTAMP-BirthDate)as ages from employees where (CURRENT_TIMESTAMP-BirthDate) > 55 order by LastName", con);

            GridView4.DataSource = cmd4.ExecuteReader();
            GridView4.DataBind();
            con.Close();

            con.Open();
            Label5.Text = "The count of employees from London";
            SqlCommand cmd5 = new SqlCommand("select count(*) from employees where city='London'", con);

            GridView5.DataSource = cmd5.ExecuteReader();
            GridView5.DataBind();
            con.Close();

            con.Open();
            Label6.Text = "The greatest, the smallest and the average age among the employees from London";
            SqlCommand cmd6 = new SqlCommand(" SELECT city,CONVERT(datetime,avg(CONVERT(INT, BirthDate)))as AVG,CONVERT(datetime,max(CONVERT(INT, BirthDate)))as MAX,CONVERT(datetime,min(CONVERT(INT, BirthDate)))as MIN from employees where city='London' group by city", con);

            GridView6.DataSource = cmd6.ExecuteReader();
            GridView6.DataBind();
            con.Close();

            con.Open();
            Label7.Text = "The greatest, the smallest and the average age of the employees for each city";
            SqlCommand cmd7 = new SqlCommand(" SELECT CONVERT(datetime,avg(CONVERT(INT, BirthDate)))as AVG,CONVERT(datetime,max(CONVERT(INT, BirthDate)))as MAX,CONVERT(datetime,min(CONVERT(INT, BirthDate)))as MIN from employees", con);

            GridView7.DataSource = cmd7.ExecuteReader();
            GridView7.DataBind();
            con.Close();

            con.Open();
            Label8.Text = "The greatest, the smallest and the average age of the employees for each city";
            SqlCommand cmd8 = new SqlCommand(" SELECT CONVERT(datetime,avg(CONVERT(INT, BirthDate)))as AVG,CONVERT(datetime,max(CONVERT(INT, BirthDate)))as MAX,CONVERT(datetime,min(CONVERT(INT, BirthDate)))as MIN from employees", con);

            GridView8.DataSource = cmd8.ExecuteReader();
            GridView8.DataBind();
            con.Close();

            con.Open();
            Label9.Text = "First, last names and dates of birth of the employees who celebrate their birthdays this month";
            SqlCommand cmd9 = new SqlCommand("select FirstName,LastName,BirthDate from employees where MONTH(BirthDate)=MONTH(GETDATE())", con);

            GridView9.DataSource = cmd9.ExecuteReader();
            GridView9.DataBind();
            con.Close();

            con.Open();
            Label10.Text = "First and last names of the employees who used to serve orders shipped to Madrid";
            SqlCommand cmd10 = new SqlCommand("select distinct FirstName,LastName,shipcity from employees inner join orders on employees.EmployeeID=orders.EmployeeID where shipcity='Madrid'", con);

            GridView10.DataSource = cmd10.ExecuteReader();
            GridView10.DataBind();
            con.Close();

            con.Open();
            Label11.Text = "First and last names of the employees who used to serve orders shipped to Madrid";
            SqlCommand cmd11 = new SqlCommand("select distinct FirstName,LastName,shipcity from employees inner join orders on employees.EmployeeID=orders.EmployeeID where shipcity='Madrid'", con);

            GridView11.DataSource = cmd11.ExecuteReader();
            GridView11.DataBind();
            con.Close();

            con.Open();
            Label12.Text = "The count of orders made by each customer from France";
            SqlCommand cmd12 = new SqlCommand("select count(*) from orders inner join customers on orders.shipcountry = customers.country where customers.country='France'", con);

            GridView12.DataSource = cmd12.ExecuteReader();
            GridView12.DataBind();
            con.Close();

            con.Open();
            Label13.Text = "The list of french customers’ names who used to order non-french products";
            SqlCommand cmd13 = new SqlCommand("select distinct ContactName from Customers left join Orders on Customers.country <> Orders.ShipCountry where country='France'", con);

            GridView13.DataSource = cmd13.ExecuteReader();
            GridView13.DataBind();
            con.Close();

            con.Open();
            Label14.Text = "The total ordering sum calculated for each country of customer";
            SqlCommand cmd14 = new SqlCommand("select count(orders.shipcountry),customers.country from orders inner join customers on orders.shipcountry=customers.country group by customers.country", con);

            GridView14.DataSource = cmd14.ExecuteReader();
            GridView14.DataBind();
            con.Close();

            con.Open();
            Label15.Text = "The list of cities where employees and customers are from and where orders have been made to. Duplicates should be eliminated.";
            SqlCommand cmd15 = new SqlCommand("SELECT distinct Orders.shipcity FROM((Orders INNER JOIN Customers ON Orders.shipcity = Customers.city) INNER JOIN employees ON Orders.shipcity = employees.city)", con);

            GridView15.DataSource = cmd15.ExecuteReader();
            GridView15.DataBind();
            con.Close();
        }
        protected void Btn_AgergarCodigosP(object sender, EventArgs e)
        {
            tb.Columns.Add("ID");
            tb.Columns.Add("Codigo");
            tb.Columns.Add("ID_Marca");
            tb.Columns.Add("Marca_P");
            foreach (GridViewRow drow in GridView6.Rows)
            {
                DataRow dr = tb.NewRow();
                dr["ID"]       = drow.Cells[0].Text.ToString();
                dr["Codigo"]   = drow.Cells[1].Text.ToString();
                dr["ID_Marca"] = drow.Cells[2].Text.ToString();
                dr["Marca_P"]  = drow.Cells[3].Text.ToString();
                tb.Rows.Add(dr);
            }

            if (TextBox2.Text != "")
            {
                DataRow dr = null;
                if (ViewState["Detalles9"] != null)
                {
                    for (int i = 0; i < 1; i++)
                    {
                        tb = (DataTable)ViewState["Detalles9"];
                        if (tb.Rows.Count > 0)
                        {
                            dr = tb.NewRow();
                            //  dr["ID"] = Label1.Text;
                            dr["ID"]       = "-";
                            dr["Codigo"]   = TextBox2.Text;
                            dr["ID_Marca"] = DropDownList2.SelectedValue.ToString();
                            dr["Marca_P"]  = DropDownList2.SelectedItem.ToString();

                            tb.Rows.Add(dr);
                            GridView9.DataSource = tb;
                            GridView9.DataBind();
                        }
                    }
                }
                else
                {
                    dr = tb.NewRow();
                    // dr["ID"] = Label1.Text;
                    dr["ID"]       = "-";
                    dr["Codigo"]   = TextBox2.Text;
                    dr["ID_Marca"] = DropDownList2.SelectedValue.ToString();
                    dr["Marca_P"]  = DropDownList2.SelectedItem.ToString();

                    tb.Rows.Add(dr);
                    GridView9.DataSource = tb;
                    GridView9.DataBind();
                }
                ViewState["Detalles9"] = tb;


                TextBox2.Text     = "";
                GridView9.Visible = true;
                GridView6.Visible = false;
            }
            else
            {
                Response.Write("<script>alert('Ingrese un codigo')</script>");
            }
            DatosP.DeleteCodigoProd(Convert.ToInt32(Label8.Text));
            Button4_ModalPopupExtender.Show();
        }
Exemple #4
0
    protected void btnEmail_Click(object sender, EventArgs e)
    {
        strEmail = txtEmail.Text;

        DataSourceSelectArguments srUserID_IDStr = new DataSourceSelectArguments();
        DataView dvUserID_IDStr = (DataView)SqlDataSource5.Select(srUserID_IDStr);

        if (dvUserID_IDStr.Count != 0)
        {
            strUserID_ID = dvUserID_IDStr[0][0].ToString();
        }

        DataSourceSelectArguments srUserID_SSOStr = new DataSourceSelectArguments();
        DataView dvUserID_SSOStr = (DataView)SqlDataSource14.Select(srUserID_SSOStr);

        if (dvUserID_SSOStr.Count != 0)
        {
            strUserID_SSO = dvUserID_SSOStr[0][0].ToString();
        }

        DataSourceSelectArguments srTokenUser = new DataSourceSelectArguments();
        DataView dvTokenUser = (DataView)SqlDataSource4.Select(srTokenUser);

        if (dvTokenUser.Count != 0)
        {
            strTokenUser = dvTokenUser[0][0].ToString();
        }

        DataSourceSelectArguments srTokenPassStr = new DataSourceSelectArguments();
        DataView dvTokenPassStr = (DataView)SqlDataSource12.Select(srTokenPassStr);

        if (dvTokenPassStr.Count != 0)
        {
            strTokenPass = dvTokenPassStr[0][0].ToString();
        }

        DataSourceSelectArguments srOrgTempStr = new DataSourceSelectArguments();
        DataView dvOrgTempStr = (DataView)SqlDataSource110.Select(srOrgTempStr);

        if (dvOrgTempStr.Count != 0)
        {
            strOrgTemp = dvOrgTempStr[0][0].ToString();
        }

        DataSourceSelectArguments srOrgTempIDStr = new DataSourceSelectArguments();
        DataView dvOrgTempIDStr = (DataView)SqlDataSource118.Select(srOrgTempIDStr);

        if (dvOrgTempIDStr.Count != 0)
        {
            strOrgTempID = dvOrgTempIDStr[0][0].ToString();
        }

        DataSourceSelectArguments srOrgTempNameStr = new DataSourceSelectArguments();
        DataView dvOrgTempNameStr = (DataView)SqlDataSource124.Select(srOrgTempNameStr);

        if (dvOrgTempNameStr.Count != 0)
        {
            strOrgTempName = dvOrgTempNameStr[0][0].ToString();
        }


        DataSourceSelectArguments srOrgIDStr = new DataSourceSelectArguments();
        DataView dvOrgIDStr = (DataView)SqlDataSource111.Select(srOrgIDStr);

        if (dvOrgIDStr.Count != 0)
        {
            strOrgID = dvOrgIDStr[0][0].ToString();
        }

        DataSourceSelectArguments srOrgAccessRequestedStr = new DataSourceSelectArguments();
        DataView dvOrgAccessRequestedStr = (DataView)SqlDataSource112.Select(srOrgAccessRequestedStr);

        if (dvOrgAccessRequestedStr.Count != 0)
        {
            strOrgAccessRequested = dvOrgAccessRequestedStr[0][0].ToString();
        }

        DataSourceSelectArguments srOrgModAccessRequestedStr = new DataSourceSelectArguments();
        DataView dvOrgModAccessRequestedStr = (DataView)SqlDataSource113.Select(srOrgModAccessRequestedStr);

        if (dvOrgModAccessRequestedStr.Count != 0)
        {
            strOrgModAccessRequested = dvOrgModAccessRequestedStr[0][0].ToString();
        }

        DataSourceSelectArguments srOrgLicAccessRequestedStr = new DataSourceSelectArguments();
        DataView dvOrgLicAccessRequestedStr = (DataView)SqlDataSource114.Select(srOrgLicAccessRequestedStr);

        if (dvOrgLicAccessRequestedStr.Count != 0)
        {
            strOrgLicAccessRequested = dvOrgLicAccessRequestedStr[0][0].ToString();
        }

        DataSourceSelectArguments srOrgMembershipUserIDStr = new DataSourceSelectArguments();
        DataView dvOrgMembershipUserIDStr = (DataView)SqlDataSource115.Select(srOrgMembershipUserIDStr);

        if (dvOrgMembershipUserIDStr.Count != 0)
        {
            strOrgMembershipUserID = dvOrgMembershipUserIDStr[0][0].ToString();
        }

        DataSourceSelectArguments srUserPasswordExpiryDt = new DataSourceSelectArguments();
        DataView dvUserPasswordExpiryDt = (DataView)SqlDataSource116.Select(srUserPasswordExpiryDt);

        if (dvUserPasswordExpiryDt.Count != 0)
        {
            strDateUserPasswordExpiry = dvUserPasswordExpiryDt[0][0].ToString();
        }

        DataSourceSelectArguments srUserPasswordChangedDt = new DataSourceSelectArguments();
        DataView dvUserPasswordChangedDt = (DataView)SqlDataSource126.Select(srUserPasswordChangedDt);

        if (dvUserPasswordChangedDt.Count != 0)
        {
            strDateUserPasswordChanged = dvUserPasswordChangedDt[0][0].ToString();
        }



        DataSourceSelectArguments srUserPasswordResetTokenDt = new DataSourceSelectArguments();
        DataView dvUserPasswordResetTokenDt = (DataView)SqlDataSource122.Select(srUserPasswordResetTokenDt);

        if (dvUserPasswordResetTokenDt.Count != 0)
        {
            strDatePasswordResetToken = dvUserPasswordResetTokenDt[0][0].ToString();
        }

        DataSourceSelectArguments srDateRegisteredDt = new DataSourceSelectArguments();
        DataView dvDateRegisteredDt = (DataView)SqlDataSource121.Select(srDateRegisteredDt);

        if (dvDateRegisteredDt.Count != 0)
        {
            strDateRegistered = dvDateRegisteredDt[0][0].ToString();
        }

        DataSourceSelectArguments srUserTempDetailsStr = new DataSourceSelectArguments();
        DataView dvUserTempDetailsStr = (DataView)SqlDataSource117.Select(srUserTempDetailsStr);

        if (dvUserTempDetailsStr.Count != 0)
        {
            strUserID_TempID = dvUserTempDetailsStr[0][0].ToString();
        }

        DataSourceSelectArguments srOrganisationRequestStr = new DataSourceSelectArguments();
        DataView dvOrganisationRequestStr = (DataView)SqlDataSource119.Select(srOrganisationRequestStr);

        if (dvOrganisationRequestStr.Count != 0)
        {
            strOrganisationRequest = dvOrganisationRequestStr[0][0].ToString();
        }


        DataSourceSelectArguments srUserID_UPMStr = new DataSourceSelectArguments();
        DataView dvUserID_UPMStr = (DataView)SqlDataSource120.Select(srUserID_UPMStr);

        if (dvUserID_UPMStr.Count != 0)
        {
            strUserID_UPM = dvUserID_UPMStr[0][0].ToString();
        }


        DataSourceSelectArguments srEventTypeRejectedStr = new DataSourceSelectArguments();
        DataView dvEventTypeRejectedStr = (DataView)SqlDataSource123.Select(srEventTypeRejectedStr);

        if (dvEventTypeRejectedStr.Count != 0)
        {
            strEventTypeRejected = dvEventTypeRejectedStr[0][0].ToString();
        }



        dtDateToday = DateTime.Now;

        /*
         * Password expiry notification and countdown
         *
         */

        dtDateUserPasswordExpiry = null;

        if (!string.IsNullOrEmpty(strDateUserPasswordExpiry))
        {
            dtDateUserPasswordExpiry = DateTime.ParseExact(strDateUserPasswordExpiry, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
            dtDateUserPasswordExpiryForSubtraction = DateTime.ParseExact(strDateUserPasswordExpiry, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
        }
        if (dtDateUserPasswordExpiry != null && dtDateToday > dtDateUserPasswordExpiry && strOrgID != "7c310be0-c20f-de11-b526-0022642a33b2")
        {
            divPasswordExpiry.Visible   = true;
            lblPasswordExpiry.Text      = "EDEN password has expired";
            lblPasswordExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divPasswordExpiry.Visible = false;
        }

        /*
         * Registration expiry
         *
         */

        if (!string.IsNullOrEmpty(strDateRegistered))
        {
            dtDateRegistered = DateTime.ParseExact(strDateRegistered, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
            tsDateRegistrationValidTimeRemaining = dtDateRegistered.AddHours(+24).Subtract(DateTime.Now);
        }

        if (strUserID_SSO == null && dtDateRegistered != null && strDateRegistered != null && dtDateRegistered < DateTime.Now.AddHours(-24))
        {
            divRegistrationExpiry.Visible   = true;
            lblRegistrationExpiry.Text      = "<i>Registration token has expired.</i> <br />- User's registration must be deleted to allow re-registration";
            lblRegistrationExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divRegistrationExpiry.Visible = false;
        }

        if (strUserID_SSO == null && dtDateRegistered != null && strDateRegistered != null && dtDateRegistered > DateTime.Now.AddHours(-24))
        {
            divRegistrationExpiry.Visible   = true;
            lblRegistrationExpiry.Text      = "Registration token is valid.<br />- The account verification link can be copied and emailed to the user if the notification has been blocked or re-routed. <br/>- This link is valid until " + dtDateRegistered.AddHours(+24) + ". Remaining time: <b>" + tsDateRegistrationValidTimeRemaining.ToString(@"hh\:mm") + "</b> hours";
            lblRegistrationExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900");
        }
        else
        {
            divRegistrationExpiry.Visible = false;
        }

        if (dtDateRegistered == null)
        {
            divRegistrationExpiry.Visible = false;
        }

        if (strUserID_SSO != null)
        {
            divRegistrationExpiry.Visible = false;
        }



        /*
         * Password reset token expiry
         *
         */
        //dtDatePasswordResetToken='';
        if (!string.IsNullOrEmpty(strDatePasswordResetToken))
        {
            dtDatePasswordResetToken = DateTime.ParseExact(strDatePasswordResetToken, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
            tsDatePasswordResetTokenTimeRemaining = dtDatePasswordResetToken.AddHours(+24).Subtract(DateTime.Now);
        }

        if (strUserID_SSO != null && dtDatePasswordResetToken != null && strDatePasswordResetToken != null && dtDatePasswordResetToken < DateTime.Now.AddHours(-24))
        {
            divPasswordResetTokenExpiry.Visible   = true;
            lblPasswordResetTokenExpiry.Text      = "<br /><i>Password reset token has expired.</i> <br />- The user will need to be begin the password reset process again and generate a new token.";
            lblPasswordResetTokenExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divPasswordResetTokenExpiry.Visible = false;
        }

        if (strUserID_SSO != null && dtDatePasswordResetToken != null && dtDatePasswordResetToken > DateTime.Now.AddHours(-24))
        {
            divPasswordResetTokenExpiry.Visible   = true;
            lblPasswordResetTokenExpiry.Text      = "<br />Password reset token is valid.<br />- The password reset token can be copied and emailed to the user.<br/>- This token is valid until " + dtDatePasswordResetToken.AddHours(+24) + ". Remaining time: <b>" + tsDatePasswordResetTokenTimeRemaining.ToString(@"hh\:mm") + "</b> hours (after which the user will need to be begin the password reset process again and generate a new token).";
            lblPasswordResetTokenExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900");
        }

        if (dtDatePasswordResetToken == null)
        {
            divPasswordResetTokenExpiry.Visible = false;
        }

        if (strUserID_ID == null &&
            strUserID_SSO == null &&
            strUserID_TempID == null &&
            strOrgID == null &&
            strOrgTemp == null &&
            strOrgTempID == null &&
            strTokenUser == null &&
            strOrgAccessRequested == null &&
            strOrgMembershipUserID == null
            )
        {
            divEmailNotFound.Visible   = true;
            lblEmailNotFound.Text      = "Email address not found";
            lblEmailNotFound.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divEmailNotFound.Visible = false;
        }

        if (strUserID_ID != null &&
            strUserID_SSO == null &&
            strUserID_TempID == null &&
            strOrgID == null &&
            strOrgTemp == null &&
            strOrgTempID == null &&
            strTokenUser != null &&
            strOrgAccessRequested == null &&
            strOrgMembershipUserID == null
            )
        {
            divUserNoConfirmationClicked.Visible   = true;
            lblUserNoConfirmationClicked.Text      = "Status: User has not clicked confirmation email and signed in";
            lblUserNoConfirmationClicked.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserNoConfirmationClicked.Visible = false;
        }

        if (strUserID_ID != null &&
            strUserID_SSO != null &&
            strUserID_TempID == null &&
            strOrgID == null &&
            strOrgTemp == null &&
            strOrgTempID == null &&
            strTokenUser != null &&
            strOrgAccessRequested == null &&
            strOrgMembershipUserID == null
            )
        {
            divUserConfirmSignedNoStep1.Visible   = true;
            lblUserConfirmSignedNoStep1.Text      = "Status: EDEN Portal Access Request - Step 1: User has clicked confirmation email, but has not selected an organisation";
            lblUserConfirmSignedNoStep1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserConfirmSignedNoStep1.Visible = false;
        }

        if (strUserID_ID != null &&
            strUserID_SSO != null &&
            strUserID_TempID == null &&
            strOrgID == null &&
            strOrgTemp == null &&
            strOrgTempID != null &&
            strTokenUser != null &&
            strOrgAccessRequested == null &&
            strOrgMembershipUserID == null
            )
        {
            divUserConfirmSignedStep2.Visible    = true;
            divUserConfirmTempOrgDetails.Visible = true;
            lblUserConfirmSignedStep2.Text       = "Status: EDEN Portal Access Request - Step 2: User has selected an organisation, but has not yet added their personal and contact details";
            lblUserConfirmSignedStep2.ForeColor  = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserConfirmSignedStep2.Visible    = false;
            divUserConfirmTempOrgDetails.Visible = false;
        }

        if (strUserID_ID != null &&
            strUserID_SSO != null &&
            strUserID_TempID == null &&
            strOrgID == null &&
            strOrgTemp != null &&
            strTokenUser != null
            )
        {
            divUserConfirmSignedLAStep2.Visible   = true;
            divUserConfirmTempOrgDetails.Visible  = true;
            lblUserConfirmSignedLAStep2.Text      = "Status: EDEN Portal Access Request - Step 2: User has selected an organisation, but has not yet added their personal and contact details";
            lblUserConfirmSignedLAStep2.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserConfirmSignedLAStep2.Visible  = false;
            divUserConfirmTempOrgDetails.Visible = false;
        }

        if (strUserID_ID != null &&
            strUserID_SSO != null &&
            strUserID_TempID != null &&
            strOrgID == null &&
            strOrgTemp == null &&
            strOrgTempID != null &&
            strOrgAccessRequested == null &&
            strTokenUser != null &&
            strOrgMembershipUserID == null &&
            strEventTypeRejected != "Organisation Membership Request Rejected"
            )
        {
            divUserConfirmSignedStep3.Visible    = true;
            divUserConfirmTempOrgDetails.Visible = true;
            lblUserConfirmSignedStep3.Text       = "Status: EDEN Portal Access Request - Step 3: User has selected an organisation, but has not yet selected a module and submitted the access request";
            lblUserConfirmSignedStep3.ForeColor  = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserConfirmSignedStep3.Visible    = false;
            divUserConfirmTempOrgDetails.Visible = false;
        }

        //if (strUserID_SSO != null && strOrgID == null && strUserID_TempID != null && strOrgTemp != null && strOrgAccessRequested == null)
        if (strUserID_ID != null &&
            strUserID_SSO != null &&
            strUserID_TempID != null &&
            strOrgID == null &&
            strOrgTemp != null &&
            strOrgAccessRequested == null &&
            strTokenUser != null &&
            strOrgMembershipUserID == null &&
            strOrganisationRequest == null &&
            strEventTypeRejected == null
            )
        {
            divUserConfirmSignedLAStep3.Visible   = true;
            divUserConfirmTempOrgDetails.Visible  = true;
            lblUserConfirmSignedLAStep3.Text      = "Status: EDEN Portal Access Request - Step 3: User has selected an organisation, but has not yet selected a module and submitted the access request";
            lblUserConfirmSignedLAStep3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserConfirmSignedLAStep3.Visible  = false;
            divUserConfirmTempOrgDetails.Visible = false;
        }

        if (strUserID_ID != null &&
            strUserID_SSO != null &&
            strUserID_TempID != null &&
            strOrgID == null &&
            strOrgTemp != null &&
            strOrgAccessRequested == null &&
            strTokenUser != null &&
            strOrgMembershipUserID == null &&
            strOrganisationRequest != null
            )
        {
            divUserNewOrgCreate.Visible   = true;
            lblUserNewOrgCreate.Text      = "Status: User has selected a module and requested to register a <i>new</i> organisation on EDEN. The request is now with the EPA for approval";
            lblUserNewOrgCreate.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900");
        }
        else
        {
            divUserNewOrgCreate.Visible = false;
        }

        if (strUserID_ID != null &&
            strUserID_SSO != null &&
            strUserID_TempID != null &&
            strOrgID == null &&
            strOrgTemp == null &&
            strOrgTempID != null &&
            strOrgAccessRequested != null &&
            strTokenUser != null &&
            strOrgMembershipUserID == null
            )
        {
            divUserRegCompleteNoApproval.Visible   = true;
            divUserConfirmTempOrgDetails.Visible   = true;
            lblUserRegCompleteNoApproval.Text      = "Status: User has selected an organisation, selected a module and submitted the access request. The org admin(s) can now process this request";
            lblUserRegCompleteNoApproval.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900");
        }
        else
        {
            divUserRegCompleteNoApproval.Visible = false;
            divUserConfirmTempOrgDetails.Visible = false;
        }

        //if (strUserID_SSO != null && strOrgID == null && strUserID_TempID != null && strOrgTemp != null && strOrgAccessRequested != null)
        if (strUserID_ID != null &&
            strUserID_SSO != null &&
            strUserID_TempID != null &&
            strOrgID == null &&
            strOrgTemp != null &&
            strOrgAccessRequested != null &&
            strTokenUser != null &&
            strOrgMembershipUserID == null
            )
        {
            divUserRegCompleteNoApprovalLA.Visible   = true;
            lblUserRegCompleteNoApprovalLA.Text      = "Status: User has selected an organisation, selected a module and submitted the access request. The org admin(s) can now process this request";
            lblUserRegCompleteNoApprovalLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900");
        }
        else
        {
            divUserRegCompleteNoApprovalLA.Visible = false;
        }



        if (strOrgModAccessRequested != null && strOrgID != null)
        {
            divModuleAccessPending.Visible   = true;
            lblModuleAccessPending.Text      = "Status: One or more module access requests by this user currently Pending Approval";
            lblModuleAccessPending.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divModuleAccessPending.Visible = false;
        }

        if (strOrgID != null)
        {
            divUserConfirmSignedNoStep1.Visible = false;
        }

        if (strUserID_TempID != null)
        {
            divPasswordExpiry.Visible = false;
        }

        if (strOrgModAccessRequested != null && strOrgLicAccessRequested != null)
        {
            GridView16.Visible = true;
            GridView17.Visible = false;
        }

        if (strOrgModAccessRequested == strOrgLicAccessRequested)
        {
            GridView16.Visible = true;
            GridView17.Visible = true;
        }

        if (strOrgMembershipUserID == null)
        {
            GridView23.Visible = true;
        }
        else
        {
            GridView23.Visible = false;
        }


        if (strOrgMembershipUserID == null)
        {
            GridView22.Visible = true;
        }
        else
        {
            GridView22.Visible = false;
        }

        if (strUserID_SSO == null & strTokenUser != null)
        {
            divVerificationLink.Visible = true;
        }
        else
        {
            divVerificationLink.Visible = false;
        }

        if (strUserID_SSO != null)
        {
            divVerificationLink.Visible = false;
        }

        if (strUserID_SSO != null)
        {
            divUserExternalLinks.Visible = true;
        }
        else
        {
            divUserExternalLinks.Visible = false;
        }

        if (strTokenPass == null)
        {
            divPasswordReset.Visible = false;
        }
        else
        {
            divPasswordReset.Visible = true;
        }


        /*
         * EPA Users
         */

        if (strUserID_ID == null &&
            strUserID_SSO != null &&
            strUserID_TempID == null &&
            strUserID_UPM != null &&
            strOrgID == null &&
            strOrgTemp == null &&
            strOrgTempID == null &&
            strTokenUser == null &&
            strTokenPass == null &&
            strOrgAccessRequested == null &&
            strOrgModAccessRequested == null &&
            strOrgLicAccessRequested == null &&
            strOrgMembershipUserID == null &&
            strOrganisationRequest == null &&
            strEventTypeRejected == null
            )
        {
            divUserEPAStep1.Visible   = true;
            lblUserEPAStep1.Text      = "Status: EDEN Portal Access Request - Step 1: EPA user has signed up, but has not selected an organisation";
            lblUserEPAStep1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserEPAStep1.Visible = false;
        }


        if (strUserID_ID == null &&
            strUserID_SSO != null &&
            strUserID_TempID == null &&
            strUserID_UPM != null &&
            strOrgTemp != null &&
            strOrgAccessRequested == null &&
            strOrgMembershipUserID == null
            )
        {
            divUserEPAStep2.Visible   = true;
            lblUserEPAStep2.Text      = "Status: EDEN Portal Access Request - Step 2: EPA user has selected organisation, but has not yet added their personal and contact details";
            lblUserEPAStep2.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserEPAStep2.Visible = false;
        }

        if (strUserID_ID == null &&
            strUserID_SSO != null &&
            strUserID_TempID != null &&
            strUserID_UPM != null &&
            strOrgTemp != null &&
            strOrgAccessRequested == null &&
            strOrgMembershipUserID == null
            )
        {
            divUserEPAStep3.Visible   = true;
            lblUserEPAStep3.Text      = "Status: EDEN Portal Access Request - Step 3: EPA user has added their personal and contact details, but has not yet selected a module";
            lblUserEPAStep3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserEPAStep3.Visible = false;
        }

        if (strUserID_ID == null &&
            strUserID_SSO != null &&
            strUserID_TempID != null &&
            strUserID_UPM != null &&
            strOrgTemp != null &&
            strOrgAccessRequested != null
            )
        {
            divUserRegCompleteNoApprovalEPA.Visible   = true;
            lblUserRegCompleteNoApprovalEPA.Text      = "EPA user has selected an organisation, selected a module and submitted the access request. The EPA org admin(s) can now process this request";
            lblUserRegCompleteNoApprovalEPA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900");
        }
        else
        {
            divUserRegCompleteNoApprovalEPA.Visible = false;
        }


        if (strUserID_ID == null &&
            strUserID_SSO != null &&
            strUserID_TempID == null &&
            strUserID_UPM != null &&
            strOrgID == null &&
            strOrgTemp == null &&
            strOrgTempID == null &&
            strTokenUser == null &&
            strTokenPass == null &&
            strOrgAccessRequested == null &&
            strOrgModAccessRequested == null &&
            strOrgLicAccessRequested == null &&
            strOrgMembershipUserID == null &&
            strOrganisationRequest == null &&
            strEventTypeRejected == "Organisation Rejected"
            )
        {
            divUserRejectedLA.Visible   = true;
            lblUserRejectedLA.Text      = "Status: User has signed up, but the organisation has been <b>rejected</b><br /> - This email address must be manually deleted from the SSO to be used again to register.";
            lblUserRejectedLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserRejectedLA.Visible = false;
        }


        if (strUserID_ID != null &&
            strUserID_SSO != null &&
            strUserID_TempID != null &&
            strEventTypeRejected == "Organisation Rejected"
            )
        {
            divOrgRejected.Visible   = true;
            lblOrgRejected.Text      = "Status: User has signed up, but the <b>organisation creation request</b> has been <b>rejected</b><br /> - This email address must be manually deleted from the SSO to be used again to register.";
            lblOrgRejected.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divOrgRejected.Visible = false;
        }


        if (
            strEventTypeRejected == "Organisation Membership Request Rejected"
            )
        {
            divUserRejectedLA.Visible   = true;
            lblUserRejectedLA.Text      = "Status: User has signed up, but the <b>organisation membership request</b> has been <b>rejected</b><br /> - This email address must be manually deleted from the SSO to be used again to register.";
            lblUserRejectedLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserRejectedLA.Visible = false;
        }


        if (
            strEventTypeRejected == "Module Authorisation Rejected"
            )
        {
            divUserRejectedLA.Visible   = true;
            lblUserRejectedLA.Text      = "Status: User's organisation access has been approved, but a module authorisation request has been rejected. (This may have been rectified - please check the notifications below).<br />";
            lblUserRejectedLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000");
        }
        else
        {
            divUserRejectedLA.Visible = false;
        }


        tsDatePasswordExpiryLessDatePasswordReset = dtDateUserPasswordExpiryForSubtraction - dtDatePasswordResetToken;
        int passwordReset_Expiry_DifferenceInDays = tsDatePasswordExpiryLessDatePasswordReset.Days;

        if (tsDatePasswordExpiryLessDatePasswordReset.Days == 90)
        {
            divPasswordResetTokenExpiry.Visible = false;
        }


        divTokens.Visible             = true;
        divSeperatorCurrent.Visible   = true;
        divSeperatorPending.Visible   = true;
        divSeperatorLicences.Visible  = true;
        divSeperatorTokens.Visible    = true;
        txtCopyVerificationLink.Text  = "https://account.edenireland.ie/signup/confirmemail?userId=" + strUserID_ID + "&token=" + strTokenUser;
        txtCopyPasswordResetLink.Text = "https://account.edenireland.ie/passwordreset/resetpassword?userId=" + strUserID_SSO + "&token=" + strTokenPass;
        GridView1.DataBind();
        GridView2.DataBind();
        GridView3.DataBind();
        GridView4.DataBind();
        GridView5.DataBind();
        GridView6.DataBind();
        GridView7.DataBind();
        GridView8.DataBind();
        GridView9.DataBind();
        GridView10.DataBind();
        GridView11.DataBind();
        GridView12.DataBind();
        GridView13.DataBind();
        GridView14.DataBind();
        GridView15.DataBind();
        GridView16.DataBind();
        GridView17.DataBind();
        GridView18.DataBind();
        GridView19.DataBind();
        GridView20.DataBind();
        GridView21.DataBind();
        GridView22.DataBind();
        GridView23.DataBind();
        GridView24.DataBind();
    }
    protected void Button17_Click(object sender, EventArgs e)
    {
        string     str131 = "delete from  tablefielddetail where  tableId='" + ViewState["tableid"] + "'";
        SqlCommand cmd131 = new SqlCommand(str131, con);

        con.Open();
        cmd131.ExecuteNonQuery();
        con.Close();
        foreach (GridViewRow gr51 in GridView8.Rows)
        {
            Label      txtfeild         = ((Label)gr51.FindControl("Label25"));
            Label      ddltype          = ((Label)gr51.FindControl("Label27"));
            Label      txtsize          = ((Label)gr51.FindControl("Label28"));
            Label      chkprimary       = ((Label)gr51.FindControl("Label29"));
            Label      chkforign        = ((Label)gr51.FindControl("Label31"));
            Label      ddlforigntableid = ((Label)gr51.FindControl("Label351"));
            Label      ddlforignfeildid = ((Label)gr51.FindControl("Label354"));
            Label      chknull          = ((Label)gr51.FindControl("Label34"));
            SqlCommand cmd33            = new SqlCommand("Insert into tablefielddetail(TableId,feildname,fieldtype,size,Isforeignkey,foreignkeytblid,foreignkeyfieldId,isprimarykey,notallownull)Values('" + Convert.ToInt32(ViewState["tableid"]) + "','" + txtfeild.Text + "','" + ddltype.Text + "','" + txtsize.Text + "','" + chkforign.Text + "','" + ddlforigntableid.Text + "','" + ddlforignfeildid.Text + "','" + chkprimary.Text + "','" + chknull.Text + "')", con);

            if (con.State.ToString() != "Open")
            {
                con.Open();
            }
            cmd33.ExecuteNonQuery();
        }



        CheckDbConn();
        SqlDataAdapter da = new SqlDataAdapter("SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name='" + ViewState["TableName"].ToString() + "'", conn1);
        DataTable      dt = new DataTable();

        da.Fill(dt);
        DataTable dt_s = new DataTable();

        if (dt.Rows.Count > 0)
        {
            if (dt_s.Rows.Count < 1)
            {
                dt_s.Columns.Add("COLUMN_NAME");
                dt_s.Columns.Add("DATA_TYPE");
            }
            for (int k = 0; k < dt.Rows.Count; k++)
            {
                DataRow dr = dt_s.NewRow();
                dr["COLUMN_NAME"] = dt.Rows[k]["COLUMN_NAME"].ToString();
                dr["DATA_TYPE"]   = dt.Rows[k]["DATA_TYPE"].ToString();
                dt_s.Rows.Add(dr);
            }

            if (dt_s.Rows.Count == GridView8.Rows.Count)
            {
                foreach (GridViewRow gr5 in GridView8.Rows)
                {
                    TextBox txtfeild = ((TextBox)gr5.FindControl("TextBox2"));
                }
            }
            else
            {
                ModalPopupExtender1.Show();
                GridView9.DataSource = dt_s;
                GridView9.DataBind();
                DataTable dtu = select("select feildname,fieldtype from tablefielddetail where TableId='" + ViewState["tableid"] + "'");
                GridView10.DataSource = dtu;
                GridView10.DataBind();
            }
        }
        else
        {
        }
        Panel9.Visible = false;
        Label360.Text  = "Updated Successfully";
    }
Exemple #6
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "setorder")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;

            GridView1.SelectedIndex = row.RowIndex;
            PPID.Text       = e.CommandArgument.ToString();
            Panel9.Visible  = true;
            Panel10.Visible = true;

            GridView4.DataSource = dp.Query_ConnectedWorkOrder(new Guid(PPID.Text));
            GridView4.DataBind();
            GridView5.DataSource = dp.Query_WorkOrder(TextBox20.Text);
            GridView5.DataBind();
            UpdatePanel9.Update();
            UpdatePanel10.Update();
        }

        if (e.CommandName == "getorder")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView1.SelectedIndex = row.RowIndex;
            PPID.Text            = e.CommandArgument.ToString();
            Panel9.Visible       = false;
            Panel10.Visible      = false;
            Panel12.Visible      = true;
            GridView9.DataSource = dp.Query_ConnectedWorkOrder(new Guid(PPID.Text));
            GridView9.DataBind();
            UpdatePanel12.Update();
            UpdatePanel10.Update();
            UpdatePanel9.Update();
        }
        if (e.CommandName == "setview")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView1.SelectedIndex = row.RowIndex;
            PPID.Text = e.CommandArgument.ToString();
            DropDownList3.Items.Clear();

            SqlDataReader myReader = dp.Query_CapableDep(new Guid(PPID.Text));

            SqlDataReader myReader2 = dp.Query_CapableDepDone(new Guid(PPID.Text));


            while (myReader.Read())
            {
                string a = myReader["BDOS_Name"].ToString();

                if (Session["Department"].ToString().Contains(myReader["BDOS_Name"].ToString()))
                {
                    DropDownList3.Items.Add(new ListItem(myReader["BDOS_Name"].ToString(), myReader["PPDS_ID"].ToString()));//增加Item
                }
            }



            while (myReader2.Read())
            {
                ListItem li = DropDownList3.Items.FindByText(myReader2["BDOS_Name"].ToString());
                DropDownList3.Items.Remove(li);
            }
            if (DropDownList3.Items.Count > 0)
            {
                Panel11.Visible = true;
                UpdatePanel11.Update();
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('处理意见已填写或您没有相应的权限!')", true);
            }
        }
        if (e.CommandName == "getview")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView1.SelectedIndex = row.RowIndex;
            PPID.Text             = e.CommandArgument.ToString();
            GridView10.DataSource = dp.GetAuditSuggest(new Guid(PPID.Text));
            GridView10.DataBind();
            Panel15.Visible = true;
            UpdatePanel15.Update();
        }
        if (e.CommandName == "track")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView1.SelectedIndex = row.RowIndex;
            PPID.Text = e.CommandArgument.ToString();

            Panel13.Visible = true;
            Panel14.Visible = false;
            Panel15.Visible = false;

            UpdatePanel13.Update();
            UpdatePanel14.Update();
            UpdatePanel15.Update();
        }
        if (e.CommandName == "audit")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView1.SelectedIndex = row.RowIndex;
            PPID.Text            = e.CommandArgument.ToString();
            GridView8.DataSource = dp.GetAuditSuggest(new Guid(PPID.Text));
            GridView8.DataBind();
            Panel14.Visible = true;
            UpdatePanel14.Update();
        }
        if (e.CommandName == "mod")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView1.SelectedIndex = row.RowIndex;
            switchlabel.Text        = "修改";
            PPID.Text      = e.CommandArgument.ToString();
            Panel3.Visible = true;
            UpdatePanel3.Update();
            UpdatePanel4.Update();
        }
        if (e.CommandName == "del")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridView1.SelectedIndex = row.RowIndex;
            PPID.Text = e.CommandArgument.ToString();
            dp.Delete_DefectProduct(new Guid(PPID.Text));
            GridView1.DataSource = dp.Query_DefectProduct();

            GridView1.DataBind();
            Panel4.Visible  = false;
            Panel10.Visible = false;
            Panel14.Visible = false;
            UpdatePanel2.Update();
            UpdatePanel3.Update();
            UpdatePanel4.Update();
            UpdatePanel10.Update();
            UpdatePanel14.Update();
        }
    }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //create database sample
            //go
            //use sample
            //go
            //create table products (id int, name varchar(100), price int)
            //go
            //insert into products values(1, 'racecare', 10)
            //insert into products values (2, 'balloons', 110)
            //insert into products values (3, 'webcam', 12)
            //go
            //select id,name,price from products

            // 1.) Inital
            SqlConnection con = new SqlConnection("data source=CATROOM\\SQLEXPRESS; database=sample; integrated security=SSPI");

            try
            {
                SqlCommand cmd = new SqlCommand("select id,name,price from products", con);
                con.Open();
                SqlDataReader sdr = cmd.ExecuteReader();
                GridView1.DataSource = sdr;
                GridView1.DataBind();
            }
            catch
            {
            }
            finally
            {
                con.Close();
            }


            //2.) using the using command
            string CS2 = "data source=CATROOM\\SQLEXPRESS; database=sample; integrated security=SSPI";

            using (SqlConnection con2 = new SqlConnection(CS2))
            {
                SqlCommand cmd2 = new SqlCommand("select id,name,price from products", con2);
                con2.Open();
                SqlDataReader sdr = cmd2.ExecuteReader();
                GridView2.DataSource = sdr;
                GridView2.DataBind();
            }

            //3.) connection string in app config
            string CS3 = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            //Can also call by index (bad practice)
            //ConfigurationManager.ConnectionStrings[0];
            using (SqlConnection con3 = new SqlConnection(CS3))
            {
                SqlCommand cmd3 = new SqlCommand("select id,name,price from products", con3);
                con3.Open();
                SqlDataReader sdr = cmd3.ExecuteReader();
                GridView3.DataSource = sdr;
                GridView3.DataBind();
            }


            //4.) SQL command class

            // ExecuteReader- use when tsql retunrs multiple rows
            // ExecuteNonquery- use when perform Insert/Upd/Del
            // ExeculateScalar- when returns single scalar value

            string CS4 = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            //ExecuteReader
            using (SqlConnection con4 = new SqlConnection(CS4))
            {
                SqlCommand cmd4 = new SqlCommand("select id,name,price from products", con4);
                con4.Open();
                SqlDataReader sdr = cmd4.ExecuteReader();
                GridView4.DataSource = sdr;
                GridView4.DataBind();
            }

            // ExeculateScalar (return single value)
            using (SqlConnection con5 = new SqlConnection(CS4))
            {
                SqlCommand cmd5 = new SqlCommand("select count(*) from products", con5);
                con5.Open();
                int count = (int)cmd5.ExecuteScalar();
                Response.Write("Using ExecuteScalar total rows count= " + count.ToString());
                Response.Write("<br>");
            }

            // ExeculateNonQuery (for CRUD)
            using (SqlConnection con6 = new SqlConnection(CS4))
            {
                con6.Open();

                SqlCommand cmd6 = new SqlCommand("delete from products where id=4", con6);
                int        returnValueOfRowsChanged = cmd6.ExecuteNonQuery();

                // reuse cmd object
                cmd6 = new SqlCommand("insert into products values(4, 'boop', 121)", con6);
                returnValueOfRowsChanged = cmd6.ExecuteNonQuery();
                Response.Write("Using ExeculateNonQuery total rows inserted= " + returnValueOfRowsChanged.ToString());
                Response.Write("<br>");
            }

//create procedure spListProducts
//@id int
//as
//begin
//select* from products
//where id = @id
//end

            //5.) Call  stored procedure (help prevent sql injection)
            using (SqlConnection con7 = new SqlConnection(CS4))
            {
                SqlCommand cmd7 = new SqlCommand("spListProducts", con7);
                cmd7.CommandType = System.Data.CommandType.StoredProcedure;
                cmd7.Parameters.AddWithValue("@id", 3);
                con7.Open();
                SqlDataReader sdr = cmd7.ExecuteReader();
                GridView5.DataSource = sdr;
                GridView5.DataBind();
            }


//create procedure spListProductsOutput
//@id int,
//@count int out
//as
//begin
//select @count = count(*) from products where id = @id
//end

            //5.) Call  stored procedure with output parameters
            using (SqlConnection con8 = new SqlConnection(CS4))
            {
                SqlCommand cmd8 = new SqlCommand("spListProductsOutput", con8);
                cmd8.CommandType = System.Data.CommandType.StoredProcedure;
                cmd8.Parameters.AddWithValue("@id", 3);


                SqlParameter outputParameter = new SqlParameter();
                outputParameter.ParameterName = "@count";
                outputParameter.SqlDbType     = System.Data.SqlDbType.Int;
                outputParameter.Direction     = System.Data.ParameterDirection.Output;
                cmd8.Parameters.Add(outputParameter);

                con8.Open();
                SqlDataReader sdr = cmd8.ExecuteReader();

                con.Open();

                int returnOutputValue = (int)outputParameter.Value;
                Response.Write("Output parameter value= " + returnOutputValue.ToString());
                Response.Write("<br>");
            }



            //6.) SQLDataReader
            using (SqlConnection con9 = new SqlConnection(CS4))
            {
                SqlCommand cmd9 = new SqlCommand("select id,name,price from products", con9);
                con9.Open();

                using (SqlDataReader sdr = cmd9.ExecuteReader())
                {
                    DataTable table = new DataTable();
                    table.Columns.Add("id");
                    table.Columns.Add("name");
                    table.Columns.Add("price");
                    table.Columns.Add("discountprice");

                    while (sdr.Read())
                    {
                        DataRow datarow         = table.NewRow();
                        int     originalPrice   = (int)sdr["price"];
                        double  discountedPrice = originalPrice * .9;

                        datarow["id"]            = sdr["ID"];
                        datarow["name"]          = sdr["name"];
                        datarow["price"]         = originalPrice;
                        datarow["discountprice"] = discountedPrice;
                        table.Rows.Add(datarow);
                    }
                    GridView6.DataSource = table;
                    GridView6.DataBind();
                }
            }


            //7.) SQLDataReader NextResult
            using (SqlConnection con10 = new SqlConnection(CS4))
            {
                SqlCommand cmd10 = new SqlCommand("select id,price from products;select id,name from products", con10);
                con10.Open();
                using (SqlDataReader sdr = cmd10.ExecuteReader())
                {
                    GridView7.DataSource = sdr;
                    GridView7.DataBind();

                    while (sdr.NextResult())
                    {
                        GridView8.DataSource = sdr;
                        GridView8.DataBind();
                    }
                }
            }


            //8.) SQLDataApater and DataSet
            using (SqlConnection con10 = new SqlConnection(CS4))
            {
                SqlDataAdapter da = new SqlDataAdapter("select id,price,name from products", con10);
                DataSet        ds = new DataSet(); //in memory representation of table in memory
                da.Fill(ds);

                GridView9.DataSource = ds;
                GridView9.DataBind();
            }


            //create procedure spListTwoResults
            //as
            //begin
            //select* from products
            //select id from products
            //end

            //9.) DataSet in asp.net
            using (SqlConnection con11 = new SqlConnection(CS4))
            {
                SqlDataAdapter da = new SqlDataAdapter("spListTwoResults", con11);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;

                DataSet ds = new DataSet(); //in memory representation of table in memory
                da.Fill(ds);

                GridView10.DataSource = ds.Tables[0];
                GridView10.DataBind();

                GridView11.DataSource = ds.Tables[1];
                GridView11.DataBind();
            }


            //10.) Caching dataset
            using (SqlConnection con11 = new SqlConnection(CS4))
            {
                SqlDataAdapter da = new SqlDataAdapter("spListTwoResults", con11);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;

                DataSet ds = new DataSet(); //in memory representation of table in memory
                da.Fill(ds);

                GridView10.DataSource = ds.Tables[0];
                GridView10.DataBind();

                GridView11.DataSource = ds.Tables[1];
                GridView11.DataBind();
            }


//Create Table tblStudents
//(
// ID int identity primary key,
// Name nvarchar(50),
// Gender nvarchar(20),
// TotalMarks int
//)

//Insert into tblStudents values('Mark Hastings', 'Male', 900)
//Insert into tblStudents values('Pam Nicholas', 'Female', 760)
//Insert into tblStudents values('John Stenson', 'Male', 980)
//Insert into tblStudents values('Ram Gerald', 'Male', 990)
//Insert into tblStudents values('Ron Simpson', 'Male', 440)
//Insert into tblStudents values('Able Wicht', 'Male', 320)
//Insert into tblStudents values('Steve Thompson', 'Male', 983)
//Insert into tblStudents values('James Bynes', 'Male', 720)
//Insert into tblStudents values('Mary Ward', 'Female', 870)
//Insert into tblStudents values('Nick Niron', 'Male', 680)

            //11.) CommandBuilder
            using (SqlConnection con11 = new SqlConnection(CS4))
            {
                SqlDataAdapter da = new SqlDataAdapter("spListTwoResults", con11);
                da.SelectCommand.CommandType = CommandType.StoredProcedure;

                DataSet ds = new DataSet(); //in memory representation of table in memory
                da.Fill(ds);

                GridView10.DataSource = ds.Tables[0];
                GridView10.DataBind();

                GridView11.DataSource = ds.Tables[1];
                GridView11.DataBind();
            }
        }//end pageload
 protected void Button1_Click(object sender, EventArgs e)
 {
     //--------------------------------BUGS
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Bugs' "
                          + " From Caso "
                          + " Where categoria = 1", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData);
     GridView1.DataSource = (tblData);
     GridView1.DataBind();
     //--------------------------------Mejoras
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Mejoras' "
                          + " From Caso "
                          + " Where categoria = 2", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData2);
     GridView2.DataSource = (tblData2);
     GridView2.DataBind();
     //--------------------------------INVESTIGACIONES
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Investigaciones' "
                          + " From Caso "
                          + " Where categoria = 3", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData3);
     GridView3.DataSource = (tblData3);
     GridView3.DataBind();
     //--------------------------------Actividades
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Actividades' "
                          + " From Caso "
                          + " Where categoria = 4", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData4);
     GridView4.DataSource = (tblData4);
     GridView4.DataBind();
     //--------------------------------Activos
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Activos' "
                          + " From Caso "
                          + " Where estado = 1", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData5);
     GridView5.DataSource = (tblData5);
     GridView5.DataBind();
     //--------------------------------Reactivados
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Reactivados' "
                          + " From Caso "
                          + " Where estado = 2", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData6);
     GridView6.DataSource = (tblData6);
     GridView6.DataBind();
     //--------------------------------Cerrados
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Cerrados' "
                          + " From Caso "
                          + " Where estado = 3", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData7);
     GridView7.DataSource = (tblData7);
     GridView7.DataBind();
     //--------------------------------Reactivados
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Resueltos' "
                          + " From Caso "
                          + " Where estado = 4", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData8);
     GridView8.DataSource = (tblData8);
     GridView8.DataBind();
     //--------------------------------Criticos
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos Criticos' "
                          + " From Caso "
                          + " Where prioridad = 1", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData9);
     GridView9.DataSource = (tblData9);
     GridView9.DataBind();
     //--------------------------------Deben Arreglarse
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos que Deben Arreglarse' "
                          + " From Caso "
                          + " Where prioridad = 2", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData10);
     GridView10.DataSource = (tblData10);
     GridView10.DataBind();
     //--------------------------------Arreglarse si hay tiempo
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos que Deben Arreglarse si hay tiempo' "
                          + " From Caso "
                          + " Where prioridad = 3", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData11);
     GridView11.DataSource = (tblData11);
     GridView11.DataBind();
     //--------------------------------Reactivados
     cn  = Conexion.conectar();
     cmd = new SqlCommand("Select COUNT(categoria) As 'Casos que no deben arreglarse' "
                          + " From Caso "
                          + " Where prioridad = 4", cn.getSqlConnection());
     sda = new SqlDataAdapter(cmd);
     sda.Fill(tblData12);
     GridView12.DataSource = (tblData12);
     GridView12.DataBind();
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            c.Open();
            String     month = DateTime.Now.ToString("MMMMMMMMMMMMM");
            SqlCommand cmd   = new SqlCommand("Select AbsentTeacherId,ZeroPeriod from Arrangement where ZPDTArrName = '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd1  = new SqlCommand("Select AbsentTeacherId,FirstPeriod from Arrangement where FPDTArrName = '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd2  = new SqlCommand("Select AbsentTeacherId,SecondPeriod from Arrangement where SPDTArrName =  '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd3  = new SqlCommand("Select AbsentTeacherId,ThirdPeriod from Arrangement where TPDTArrName = '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd4  = new SqlCommand("Select AbsentTeacherId,FourthPeriod from Arrangement where FOPDTArrName =  '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd5  = new SqlCommand("Select AbsentTeacherId,FifthPeriod from Arrangement where FIPDTArrName = '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd6  = new SqlCommand("Select AbsentTeacherId,SixthPeriod from Arrangement where SIPDTArrName = '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd7  = new SqlCommand("Select AbsentTeacherId,SeventhPeriod from Arrangement where SEPDTArrName = '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd8  = new SqlCommand("Select AbsentTeacherId,EighthPeriod from Arrangement where EPDTArrName = '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd9  = new SqlCommand("Select AbsentTeacherId,NinethPeriod from Arrangement where NPDTArrName = '" + Session["user"].ToString() + "' and Daay='" + DateTime.Now.ToString("dddddddddd") + "'", c);
            SqlCommand cmd10 = new SqlCommand("Select Day from No_Of_Arrangement as Today where TeacherId= '" + Session["user"].ToString() + "' ", c);
            SqlCommand cmd11 = new SqlCommand("Select Week from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
            SqlCommand cmd13 = new SqlCommand("Select Year from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable      dt = new DataTable();
            if (da.Fill(dt) > 0)
            {
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }


            SqlDataAdapter da1 = new SqlDataAdapter(cmd1);
            DataTable      dt1 = new DataTable();
            if (da1.Fill(dt1) > 0)
            {
                GridView2.DataSource = dt1;
                GridView2.DataBind();
            }


            SqlDataAdapter da2 = new SqlDataAdapter(cmd2);
            DataTable      dt2 = new DataTable();
            if (da2.Fill(dt2) > 0)
            {
                GridView3.DataSource = dt2;
                GridView3.DataBind();
            }


            SqlDataAdapter da3 = new SqlDataAdapter(cmd3);
            DataTable      dt3 = new DataTable();
            if (da3.Fill(dt3) > 0)
            {
                GridView4.DataSource = dt3;
                GridView4.DataBind();
            }

            SqlDataAdapter da4 = new SqlDataAdapter(cmd4);
            DataTable      dt4 = new DataTable();
            if (da4.Fill(dt4) > 0)
            {
                GridView5.DataSource = dt4;
                GridView5.DataBind();
            }


            SqlDataAdapter da5 = new SqlDataAdapter(cmd5);
            DataTable      dt5 = new DataTable();
            if (da5.Fill(dt5) > 0)
            {
                GridView6.DataSource = dt5;
                GridView6.DataBind();
            }

            SqlDataAdapter da6 = new SqlDataAdapter(cmd6);
            DataTable      dt6 = new DataTable();
            if (da6.Fill(dt6) > 0)
            {
                GridView7.DataSource = dt6;
                GridView7.DataBind();
            }

            SqlDataAdapter da7 = new SqlDataAdapter(cmd7);
            DataTable      dt7 = new DataTable();
            if (da7.Fill(dt7) > 0)
            {
                GridView8.DataSource = dt7;
                GridView8.DataBind();
            }

            SqlDataAdapter da8 = new SqlDataAdapter(cmd8);
            DataTable      dt8 = new DataTable();
            if (da8.Fill(dt8) > 0)
            {
                GridView9.DataSource = dt8;
                GridView9.DataBind();
            }

            SqlDataAdapter da9 = new SqlDataAdapter(cmd9);
            DataTable      dt9 = new DataTable();
            if (da9.Fill(dt9) > 0)
            {
                GridView10.DataSource = dt9;
                GridView10.DataBind();
            }

            SqlDataAdapter da10 = new SqlDataAdapter(cmd10);
            DataTable      dt10 = new DataTable();
            if (da10.Fill(dt10) > 0)
            {
                GridView11.DataSource = dt10;
                GridView11.DataBind();
            }

            SqlDataAdapter da11 = new SqlDataAdapter(cmd11);
            DataTable      dt11 = new DataTable();
            if (da11.Fill(dt11) > 0)
            {
                GridView12.DataSource = dt11;
                GridView12.DataBind();
            }


            if (month == "January")
            {
                SqlCommand     cmd12 = new SqlCommand("Select January from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "February")
            {
                SqlCommand     cmd12 = new SqlCommand("Select February from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "March")
            {
                SqlCommand     cmd12 = new SqlCommand("Select March from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "April")
            {
                SqlCommand     cmd12 = new SqlCommand("Select April from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "May")
            {
                SqlCommand     cmd12 = new SqlCommand("Select May from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "June")
            {
                SqlCommand     cmd12 = new SqlCommand("Select June from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "July")
            {
                SqlCommand     cmd12 = new SqlCommand("Select July from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "August")
            {
                SqlCommand     cmd12 = new SqlCommand("Select August from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "September")
            {
                SqlCommand     cmd12 = new SqlCommand("Select September from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "October")
            {
                SqlCommand     cmd12 = new SqlCommand("Select October from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "November")
            {
                SqlCommand     cmd12 = new SqlCommand("Select November from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }
            if (month == "December")
            {
                SqlCommand     cmd12 = new SqlCommand("Select December from No_Of_Arrangement where TeacherId= '" + Session["user"].ToString() + "' ", c);
                SqlDataAdapter da12  = new SqlDataAdapter(cmd12);
                DataTable      dt12  = new DataTable();
                if (da12.Fill(dt12) > 0)
                {
                    GridView13.DataSource = dt12;
                    GridView13.DataBind();
                }
            }


            SqlDataAdapter da13 = new SqlDataAdapter(cmd13);
            DataTable      dt13 = new DataTable();
            if (da13.Fill(dt13) > 0)
            {
                GridView14.DataSource = dt13;
                GridView14.DataBind();
            }

            c.Close();
        }
        catch (Exception ex) {
            Label1.Text = ex.Message;
        }
    }
Exemple #10
0
    protected void grdvw_List_RowEditing(object sender, GridViewEditEventArgs e)
    {
        strSelectedId     = grdvw_List.Rows[e.NewEditIndex].Cells[1].Text;
        txt_ItemName.Text = grdvw_List.Rows[e.NewEditIndex].Cells[2].Text;
        if (grdvw_List.Rows[e.NewEditIndex].Cells[2].Text.Trim() != "&nbsp;")
        {
            txt_AccessTime.Text = grdvw_List.Rows[e.NewEditIndex].Cells[4].Text;
        }
        else
        {
            txt_AccessTime.Text = "";
        }
        txt_person0.Text = grdvw_List.Rows[e.NewEditIndex].Cells[3].Text;

        txt_ItemName.ReadOnly = true;
        txt_person0.ReadOnly  = true;


        //备注绑定
        //项目接收备注显示
        string  remarkstr  = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='1' order by t_Y_Detail.id";
        DataSet ds_Remark1 = new MyDataOp(remarkstr).CreateDataSet();
        string  strtemp    = "select Name,UserID from t_R_UserInfo";
        DataSet ds_User    = new MyDataOp(strtemp).CreateDataSet();

        foreach (DataRow dr in ds_Remark1.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView1.DataSource = ds_Remark1;
        GridView1.DataBind();
        string  remarkstr2 = "select  CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='2' order by t_Y_Detail.id";
        DataSet ds_Remark2 = new MyDataOp(remarkstr2).CreateDataSet();

        foreach (DataRow dr in ds_Remark2.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView2.DataSource = ds_Remark2;
        GridView2.DataBind();
        string  remarkstr3 = "select  CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='3' order by t_Y_Detail.id";
        DataSet ds_Remark3 = new MyDataOp(remarkstr3).CreateDataSet();

        foreach (DataRow dr in ds_Remark3.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView3.DataSource = ds_Remark3;
        GridView3.DataBind();
        string  remarkstr4 = "select  CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='4' order by t_Y_Detail.id";
        DataSet ds_Remark4 = new MyDataOp(remarkstr4).CreateDataSet();

        foreach (DataRow dr in ds_Remark4.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView4.DataSource = ds_Remark4;
        GridView4.DataBind();
        string  remarkstr5 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='5' order by t_Y_Detail.id";
        DataSet ds_Remark5 = new MyDataOp(remarkstr5).CreateDataSet();

        foreach (DataRow dr in ds_Remark5.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView5.DataSource = ds_Remark5;
        GridView5.DataBind();
        string  remarkstr6 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='6' order by t_Y_Detail.id";
        DataSet ds_Remark6 = new MyDataOp(remarkstr6).CreateDataSet();

        foreach (DataRow dr in ds_Remark6.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView6.DataSource = ds_Remark6;
        GridView6.DataBind();
        string  remarkstr7 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='7' order by t_Y_Detail.id";
        DataSet ds_Remark7 = new MyDataOp(remarkstr7).CreateDataSet();

        foreach (DataRow dr in ds_Remark7.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView7.DataSource = ds_Remark7;
        GridView7.DataBind();
        string  remarkstr8 = "select  CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='8' order by t_Y_Detail.id";
        DataSet ds_Remark8 = new MyDataOp(remarkstr8).CreateDataSet();

        foreach (DataRow dr in ds_Remark8.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView8.DataSource = ds_Remark8;
        GridView8.DataBind();
        string  remarkstr9 = "select  CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='9' order by t_Y_Detail.id";
        DataSet ds_Remark9 = new MyDataOp(remarkstr9).CreateDataSet();

        foreach (DataRow dr in ds_Remark9.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView9.DataSource = ds_Remark9;
        GridView9.DataBind();
        string  remarkstr10 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='10' order by t_Y_Detail.id";
        DataSet ds_Remark10 = new MyDataOp(remarkstr10).CreateDataSet();

        foreach (DataRow dr in ds_Remark10.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView10.DataSource = ds_Remark10;
        GridView10.DataBind();
        string  remarkstr11 = "select  CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='11' order by t_Y_Detail.id";
        DataSet ds_Remark11 = new MyDataOp(remarkstr11).CreateDataSet();

        foreach (DataRow dr in ds_Remark11.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView11.DataSource = ds_Remark11;
        GridView11.DataBind();
        string  remarkstr12 = "select  CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='12' order by t_Y_Detail.id";
        DataSet ds_Remark12 = new MyDataOp(remarkstr12).CreateDataSet();

        foreach (DataRow dr in ds_Remark12.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView12.DataSource = ds_Remark12;
        GridView12.DataBind();
        string  remarkstr13 = "select  CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='13' order by t_Y_Detail.id";
        DataSet ds_Remark13 = new MyDataOp(remarkstr13).CreateDataSet();

        foreach (DataRow dr in ds_Remark13.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView13.DataSource = ds_Remark13;
        GridView13.DataBind();
        string  remarkstr14 = "select  CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='14' order by t_Y_Detail.id";
        DataSet ds_Remark14 = new MyDataOp(remarkstr14).CreateDataSet();

        foreach (DataRow dr in ds_Remark14.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView14.DataSource = ds_Remark14;
        GridView14.DataBind();
        //备注绑定
        //有回退的,则显示回退备注,非回退,不显示
        //string backremarkstr = "select  createdate 备注时间,t_Y_BackInfo.remark 备注及意见,userid 用户名 from t_Y_BackInfo inner join t_Y_FlowInfo on t_Y_BackInfo.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_BackInfo.functionid where t_Y_BackInfo.itemid='" + strSelectedId + "' and t_Y_BackInfo.functionid='15' order by t_Y_BackInfo.id";

        //// string backremarkstr = "select * from t_Y_BackInfo where itemid='" + strSelectedId + "' and functionid='2'";
        //DataSet ds_Remark_back = new MyDataOp(backremarkstr).CreateDataSet();
        //foreach (DataRow dr in ds_Remark_back.Tables[0].Rows)
        //{
        //    foreach (DataRow drr in ds_User.Tables[0].Rows)
        //    {
        //        if (dr["用户名"].ToString() == drr["UserID"].ToString())
        //            dr["用户名"] = drr["Name"].ToString();

        //    }
        //}
        //GridView_back.DataSource = ds_Remark_back;
        //GridView_back.DataBind();
        //回退的数据编辑,显示前面的备注信息,只读
        string  remarkstr_now = "select ItemName 项目类型, name 阶段,CreateDate 备注时间,bz 备注及意见,userid 用户名,flag,t_Y_Detail.id from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='15' order by t_Y_Detail.id";
        DataSet ds_Remark_now = new MyDataOp(remarkstr_now).CreateDataSet();

        foreach (DataRow dr in ds_Remark_now.Tables[0].Rows)
        {
            foreach (DataRow drr in ds_User.Tables[0].Rows)
            {
                if (dr["用户名"].ToString() == drr["UserID"].ToString())
                {
                    dr["用户名"] = drr["Name"].ToString();
                }
            }
        }
        GridView_now.DataSource = ds_Remark_now;
        GridView_now.DataBind();
        DataRow[] dr_remark = ds_Remark_now.Tables[0].Select("flag=0");
        if (dr_remark.Length > 0)
        {
            txt_Remark_now.Text = dr_remark[0][3].ToString();
            SelectedId          = dr_remark[0][6].ToString();
        }
        //if (ds_Remark_back.Tables[0].Rows.Count > 0)
        //{


        //    Panel_back.Visible = true;


        //}
        //else
        //{

        //    Panel_back.Visible = false;
        //}
        ds_Remark1.Dispose();
        ds_Remark2.Dispose();
        ds_Remark3.Dispose();
        ds_Remark4.Dispose();
        ds_Remark5.Dispose();
        ds_Remark6.Dispose();
        ds_Remark7.Dispose();
        ds_Remark8.Dispose();
        ds_Remark9.Dispose();
        ds_Remark10.Dispose();
        ds_Remark11.Dispose();
        ds_Remark12.Dispose();
        ds_Remark13.Dispose();
        ds_Remark14.Dispose();
        // ds_Remark_back.Dispose();
        ds_Remark_now.Dispose();



        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "showAddEdit();", true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["U_name"] == null)
            {
                Response.Redirect("AdminLogin.aspx");
            }
            else
            {
                GetcountofComments();
                SqlDataAdapter da1 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='1'", con);
                DataSet        ds1 = new DataSet();
                da1.Fill(ds1, "tbl_CompltChangeCommentCount");
                GridView2.DataSource = ds1;
                GridView2.DataBind();

                SqlDataAdapter da2 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='2'", con);
                DataSet        ds2 = new DataSet();
                da2.Fill(ds2, "tbl_CompltChangeCommentCount");
                GridView3.DataSource = ds2;
                GridView3.DataBind();

                SqlDataAdapter da3 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='3'", con);
                DataSet        ds3 = new DataSet();
                da3.Fill(ds3, "tbl_CompltChangeCommentCount");
                GridView4.DataSource = ds3;
                GridView4.DataBind();

                SqlDataAdapter da4 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='4'", con);
                DataSet        ds4 = new DataSet();
                da4.Fill(ds4, "tbl_CompltChangeCommentCount");
                GridView5.DataSource = ds4;
                GridView5.DataBind();

                SqlDataAdapter da5 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='5'", con);
                DataSet        ds5 = new DataSet();
                da5.Fill(ds5, "tbl_CompltChangeCommentCount");
                GridView6.DataSource = ds5;
                GridView6.DataBind();

                SqlDataAdapter da6 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='6'", con);
                DataSet        ds6 = new DataSet();
                da6.Fill(ds6, "tbl_CompltChangeCommentCount");
                GridView7.DataSource = ds6;
                GridView7.DataBind();

                SqlDataAdapter da7 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='7'", con);
                DataSet        ds7 = new DataSet();
                da7.Fill(ds7, "tbl_CompltChangeCommentCount");
                GridView8.DataSource = ds7;
                GridView8.DataBind();

                SqlDataAdapter da8 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='8'", con);
                DataSet        ds8 = new DataSet();
                da8.Fill(ds8, "tbl_CompltChangeCommentCount");
                GridView9.DataSource = ds8;
                GridView9.DataBind();

                SqlDataAdapter da9 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='9'", con);
                DataSet        ds9 = new DataSet();
                da9.Fill(ds9, "tbl_CompltChangeCommentCount");
                GridView10.DataSource = ds9;
                GridView10.DataBind();

                SqlDataAdapter da10 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='10'", con);
                DataSet        ds10 = new DataSet();
                da10.Fill(ds10, "tbl_CompltChangeCommentCount");
                GridView11.DataSource = ds10;
                GridView11.DataBind();

                SqlDataAdapter da11 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='11'", con);
                DataSet        ds11 = new DataSet();
                da11.Fill(ds11, "tbl_CompltChangeCommentCount");
                GridView12.DataSource = ds11;
                GridView12.DataBind();

                SqlDataAdapter da12 = new SqlDataAdapter("select CityName as[City],GoodCnt as [Good Cmnt],BadCnt as [Bad Cmnt],CantSayCnt as [Cant Say Cmnt],TotalCnt as [Total],TotalNoTcmnt as [Not Cmnt],TotalVisitors as [Total Visitors] from tbl_CompltChangeCommentCount where Pro_id='12'", con);
                DataSet        ds12 = new DataSet();
                da12.Fill(ds12, "tbl_CompltChangeCommentCount");
                GridView13.DataSource = ds12;
                GridView13.DataBind();
            }
        }
        catch (Exception)
        {
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SqlConnection con = new SqlConnection(strcon);
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                SqlDataAdapter da = new SqlDataAdapter("SELECT  F.TitluFilm as 'Film',  SUM(R.NumarBilete) as 'Total Bilete', COUNT(R.RezervareID) as 'Total Rezervari' FROM  Bilet B LEFT JOIN Rezervare R ON B.RezervareID = R.RezervareID LEFT JOIN Film F  ON B.FilmID = F.FilmID  GROUP BY F.TitluFilm ", con);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                GridView1.DataSource = dt;
                GridView1.DataBind();

                SqlDataAdapter da1 = new SqlDataAdapter("SELECT DISTINCT COUNT(R.RezervareID) as Rezervari, U.Username FROM[User] U INNER JOIN Rezervare R ON R.UserID = U.UserID GROUP BY U.Username HAVING COUNT(R.RezervareID) = (SELECT MAX(C.Suma) FROM(SELECT(COUNT(RR.RezervareID)) AS Suma, UU.Username FROM[User] UU INNER JOIN Rezervare RR ON RR.UserID = UU.UserID GROUP BY UU.Username) C); ", con);
                DataTable      dt1 = new DataTable();

                da1.Fill(dt1);
                GridView2.DataSource = dt1;
                GridView2.DataBind();

                SqlDataAdapter da2 = new SqlDataAdapter("SELECT DISTINCT P.Platit,COUNT(R.RezervareID) as 'Numar rezervari', U.Username FROM [User] U INNER JOIN Rezervare R ON U.UserID = R.UserID INNER JOIN Plata P ON R.RezervareID = P.RezervareID WHERE P.Platit = 'NU' GROUP BY U.Username, Platit HAVING COUNT(R.RezervareID) IN (SELECT (COUNT(RR.RezervareID))  FROM [User] UU INNER JOIN Rezervare RR ON RR.UserID = UU.UserID GROUP BY UU.Username	HAVING COUNT(RR.RezervareID) > 1) ", con);
                DataTable      dt2 = new DataTable();

                da2.Fill(dt2);
                GridView3.DataSource = dt2;
                GridView3.DataBind();

                SqlDataAdapter da3 = new SqlDataAdapter("SELECT DISTINCT F.TitluFilm as 'Titlu Film', S.NumeSala as 'Nume Sala' FROM Film F LEFT JOIN Bilet B ON B.FilmID = F.FilmID left join Sala S on S.SalaID = F.SalaID  WHERE  F.FilmID NOT IN (SELECT FilmID FROM Bilet)", con);
                DataTable      dt3 = new DataTable();

                da3.Fill(dt3);
                GridView4.DataSource = dt3;
                GridView4.DataBind();

                SqlDataAdapter da4 = new SqlDataAdapter(" SELECT F.TitluFilm as 'Titlu Film' FROM Film F ORDER BY (SELECT Sum(R.NumarBilete)  FROM Rezervare R inner join Bilet B ON R.RezervareID  = B.RezervareID INNER JOIN [User] U ON U.UserID = R.UserID INNER JOIN Film FF ON B.FilmID = FF.FilmID where ff.filmid = f.filmid group by ff.filmid) desc ", con);
                DataTable      dt4 = new DataTable();

                da4.Fill(dt4);
                GridView5.DataSource = dt4;
                GridView5.DataBind();

                SqlDataAdapter da5 = new SqlDataAdapter("SELECT R.NumarRezervare, R.NumarBilete, U.Username FROM Rezervare R INNER JOIN [User] U ON U.UserID = R.UserID WHERE U.Username ='******'", con);
                DataTable      dt5 = new DataTable();

                da5.Fill(dt5);
                GridView6.DataSource = dt5;
                GridView6.DataBind();


                SqlDataAdapter da6 = new SqlDataAdapter("SELECT R.NumarRezervare, P.Platit FROM Rezervare R INNER JOIN Plata P ON P.RezervareID = r.RezervareID", con);
                DataTable      dt6 = new DataTable();

                da6.Fill(dt6);
                GridView7.DataSource = dt6;
                GridView7.DataBind();

                SqlDataAdapter da7 = new SqlDataAdapter("SELECT * FROM [USER] U INNER JOIN Rezervare R ON U.UserID = R.UserID", con);
                DataTable      dt7 = new DataTable();

                da7.Fill(dt7);
                GridView8.DataSource = dt7;
                GridView8.DataBind();

                SqlDataAdapter da8 = new SqlDataAdapter("SELECT R.NumarRezervare, P.Platit FROM Plata P INNER JOIN Rezervare R ON P.RezervareID = R.RezervareID WHERE P.Platit = 'DA' ", con);
                DataTable      dt8 = new DataTable();

                da8.Fill(dt8);
                GridView9.DataSource = dt8;
                GridView9.DataBind();

                con.Close();
                //      Response.Write("<script>alert('Total Bilete');</script>");
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('" + ex.Message + "');</script>");
            }
        }
    public void fetchdata()
    {
        string        connectionString = ConfigurationManager.ConnectionStrings["mycon"].ConnectionString;
        SqlConnection con = new SqlConnection(connectionString);

        con.Open();
        SqlCommand    c   = new SqlCommand("select papername from Publication  where btype='General science' and published='Yes'", con);
        SqlDataReader rdr = c.ExecuteReader();

        GridView1.DataSource = rdr;
        GridView1.DataBind();
        GridView1.GridLines = GridLines.None;
        rdr.Close();
        con.Close();

        con.Open();
        SqlCommand    c2   = new SqlCommand("select papername from Publication  where btype='Neuroscience & Psychology' and published='Yes'", con);
        SqlDataReader rdr2 = c2.ExecuteReader();

        GridView2.DataSource = rdr2;
        GridView2.DataBind();
        GridView2.GridLines = GridLines.None;
        rdr2.Close();
        con.Close();
        con.Open();
        SqlCommand    c3   = new SqlCommand("select papername from Publication  where btype='Genetics & Molicular Biology' and published='Yes'", con);
        SqlDataReader rdr3 = c3.ExecuteReader();

        GridView3.DataSource = rdr3;
        GridView3.DataBind();
        GridView3.GridLines = GridLines.None;
        rdr3.Close();
        con.Close();
        con.Open();
        SqlCommand    c4   = new SqlCommand("select papername from Publication  where btype='Biochemistry' and published='Yes'", con);
        SqlDataReader rdr4 = c4.ExecuteReader();

        GridView4.DataSource = rdr4;
        GridView4.DataBind();
        GridView4.GridLines = GridLines.None;
        rdr4.Close();
        con.Close();
        con.Open();
        SqlCommand    c5   = new SqlCommand("select papername from Publication  where btype='Engineering' and published='Yes'", con);
        SqlDataReader rdr5 = c5.ExecuteReader();

        GridView5.DataSource = rdr5;
        GridView5.DataBind();
        GridView5.GridLines = GridLines.None;
        rdr5.Close();
        con.Close();
        con.Open();
        SqlCommand    c6   = new SqlCommand("select papername from Publication  where btype='Chemistry' and published='Yes'", con);
        SqlDataReader rdr6 = c6.ExecuteReader();

        GridView6.DataSource = rdr6;
        GridView6.DataBind();
        GridView6.GridLines = GridLines.None;
        rdr6.Close();
        con.Close();

        con.Open();
        SqlCommand    c7   = new SqlCommand("select papername from Publication  where btype='Physics' and published='Yes'", con);
        SqlDataReader rdr7 = c7.ExecuteReader();

        GridView7.DataSource = rdr7;
        GridView7.DataBind();
        GridView7.GridLines = GridLines.None;
        rdr7.Close();
        con.Close();
        con.Open();
        SqlCommand    c8   = new SqlCommand("select papername from Publication  where btype='Material Sciences' and published='Yes'", con);
        SqlDataReader rdr8 = c8.ExecuteReader();

        GridView8.DataSource = rdr8;
        GridView8.DataBind();
        GridView8.GridLines = GridLines.None;
        rdr8.Close();
        con.Close();
        con.Open();
        SqlCommand    c9   = new SqlCommand("select papername from Publication  where btype='Social & Political Science' and published='Yes'", con);
        SqlDataReader rdr9 = c9.ExecuteReader();

        GridView9.DataSource = rdr9;
        GridView9.DataBind();
        GridView9.GridLines = GridLines.None;
        rdr9.Close();
        con.Close();
        con.Open();
        SqlCommand    c10   = new SqlCommand("select papername from Publication  where btype='Earth & Environmental Science' and published='Yes'", con);
        SqlDataReader rdr10 = c10.ExecuteReader();

        GridView10.DataSource = rdr10;
        GridView10.DataBind();
        GridView10.GridLines = GridLines.None;
        rdr10.Close();
        con.Close();
        con.Open();
        SqlCommand    c11   = new SqlCommand("select papername from Publication  where btype='Chemical Engineering' and published='Yes'", con);
        SqlDataReader rdr11 = c11.ExecuteReader();

        GridView11.DataSource = rdr11;
        GridView11.DataBind();
        GridView11.GridLines = GridLines.None;
        rdr11.Close();
        con.Close();
        con.Open();
        SqlCommand    c12   = new SqlCommand("select papername from Publication  where btype='Medical' and published='Yes'", con);
        SqlDataReader rdr12 = c12.ExecuteReader();

        GridView12.DataSource = rdr12;
        GridView12.DataBind();
        GridView12.GridLines = GridLines.None;
        rdr12.Close();
        con.Close();
        con.Open();
        SqlCommand    c13   = new SqlCommand("select papername from Publication  where btype='Agri Food & Aqua' and published='Yes'", con);
        SqlDataReader rdr13 = c13.ExecuteReader();

        GridView13.DataSource = rdr13;
        GridView13.DataBind();
        GridView13.GridLines = GridLines.None;
        rdr13.Close();
        con.Close();
        con.Open();
        SqlCommand    c14   = new SqlCommand("select papername from Publication  where btype='Immunology & Microbiology' and published='Yes'", con);
        SqlDataReader rdr14 = c14.ExecuteReader();

        GridView14.DataSource = rdr14;
        GridView14.DataBind();
        GridView14.GridLines = GridLines.None;
        rdr14.Close();
        con.Close();
        con.Open();
        SqlCommand    c15   = new SqlCommand("select papername from Publication  where btype='Pharmaceutical Sciences' and published='Yes'", con);
        SqlDataReader rdr15 = c15.ExecuteReader();

        GridView15.DataSource = rdr15;
        GridView15.DataBind();
        GridView15.GridLines = GridLines.None;
        rdr15.Close();
        con.Close();
        con.Open();
        SqlCommand    c16   = new SqlCommand("select papername from Publication  where btype='Informatics' and published='Yes'", con);
        SqlDataReader rdr16 = c16.ExecuteReader();

        GridView16.DataSource = rdr16;
        GridView16.DataBind();
        GridView16.GridLines = GridLines.None;
        rdr16.Close();
        con.Close();
        con.Open();
        SqlCommand    c17   = new SqlCommand("select papername from Publication  where btype='Business and Management' and published='Yes'", con);
        SqlDataReader rdr17 = c17.ExecuteReader();

        GridView17.DataSource = rdr17;
        GridView17.DataBind();
        GridView17.GridLines = GridLines.None;
        rdr17.Close();
        con.Close();
    }
Exemple #14
0
        public void resultRepeat()
        {
            try
            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("S.S.T", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView1.DataSource = registros;
                    GridView1.DataBind();
                }
                else
                {
                    GridView1.DataSource = null;
                    GridView1.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
            try
            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("P.E.S.V", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView2.DataSource = registros;
                    GridView2.DataBind();
                }
                else
                {
                    GridView2.DataSource = null;
                    GridView2.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
            try
            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("RRHH", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView3.DataSource = registros;
                    GridView3.DataBind();
                }
                else
                {
                    GridView3.DataSource = null;
                    GridView3.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
            try
            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("Correspondencia", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView4.DataSource = registros;
                    GridView4.DataBind();
                }
                else
                {
                    GridView4.DataSource = null;
                    GridView4.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
            try

            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("Plan_Contingencia", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView5.DataSource = registros;
                    GridView5.DataBind();
                }
                else
                {
                    GridView5.DataSource = null;
                    GridView5.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
            try
            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("Covid_19", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView6.DataSource = registros;
                    GridView6.DataBind();
                }
                else
                {
                    GridView6.DataSource = null;
                    GridView6.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
            try
            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("Examen_MA", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView7.DataSource = registros;
                    GridView7.DataBind();
                }
                else
                {
                    GridView7.DataSource = null;
                    GridView7.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
            try
            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("Plan_MA", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView8.DataSource = registros;
                    GridView8.DataBind();
                }
                else
                {
                    GridView8.DataSource = null;
                    GridView8.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
            try
            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("CursosMA", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView9.DataSource = registros;
                    GridView9.DataBind();
                }
                else
                {
                    GridView9.DataSource = null;
                    GridView9.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
            try
            {
                String bd        = Session["BD"].ToString();
                var    registros = Controlasql.ClistFiles("Formatos_sanidad", bd);
                if (registros.Rows.Count > 0)
                {
                    GridView10.DataSource = registros;
                    GridView10.DataBind();
                }
                else
                {
                    GridView10.DataSource = null;
                    GridView10.DataBind();
                }
            }
            catch (Exception ex)
            {
                alerta.MessageBox(this, $"{ex}");
                //  Response.Redirect("Exceptionnet.aspx");
            }
        }
 protected void GridView9_IndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridView9.PageIndex = e.NewPageIndex;
     GridView9.DataBind();
 }