private void getBuilding(String lid, String trnDate, String amount, String description, String reference, String period, String code, bool alloc, DateTime dt, String oldReference)
    {
        String  sql = "SELECT Building, Code, AccNumber, Contra, DataPath FROM tblBuildings WHERE (Code = '" + code + "') ";
        DataSet ds  = utils.getData(sql, null);

        if (!alloc)
        {
            trnDate = dt.ToString("dd/MM/yyyy");
        }
        if ((ds != null) && (ds.Tables.Count > 0) && (ds.Tables[0].Rows.Count > 0))
        {
            DataRow dr   = ds.Tables[0].Rows[0];
            String  sql2 = "INSERT INTO tblExport (lid, trnDate, amount, building, code, description, reference, accnumber, contra, datapath, period, una)";
            sql2 += " VALUES('" + lid + "', '" + trnDate + "', '" + amount + "', '" + dr["Building"].ToString() + "', '" + code + "', '" + description + "', '" + reference;
            sql2 += "', '" + dr["AccNumber"].ToString() + "', '" + dr["Contra"].ToString() + "', '" + dr["DataPath"].ToString() + "', '" + period + "', '" + alloc.ToString() + "');";

            sql2 += "INSERT INTO tblMatch(statementRef, astroRef) VALUES('" + oldReference + "','" + reference + "')";
            //lblError.Text = sql2;
            String sqlReply = utils.executeQuery(sql2, null);
            if (sqlReply == "")
            {
                SqlDataSource5.Select(new DataSourceSelectArguments());
                SqlDataSource5.DataBind();
                GridView5.DataBind();
                SqlDataSource1.Select(new DataSourceSelectArguments());
                SqlDataSource1.DataBind();
                GridView6.DataBind();
            }
            else
            {
                lblError.Text = sqlReply;
            }
        }
    }
Esempio n. 2
0
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DropDownList1.SelectedValue == "Inner")
     {
         DataView mydata = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
     else if (DropDownList1.SelectedValue == "Left")
     {
         DataView mydata = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
     else if (DropDownList1.SelectedValue == "Right")
     {
         DataView mydata = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
     else
     {
         DataView mydata = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
 }
        protected void btnSorgula_Click(object sender, EventArgs e)
        {
            DataView dv = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

            if (dv.Count > 0)
            {
                foreach (DataRowView drow in dv)
                {
                    lblMessage.Text             = "Hasta bulundu!";
                    txtName.Text                = drow["name"].ToString();
                    txtSurname.Text             = drow["surname"].ToString();
                    txtBirth.Text               = drow["birth_year"].ToString();
                    listInsurance.SelectedValue = drow["insurance_id"].ToString();
                    pnlHastaForm.Visible        = true;
                }
            }
            else
            {
                lblMessage.Text             = "Hasta kayıtlı değil.";
                txtName.Text                = "";
                txtSurname.Text             = "";
                txtBirth.Text               = "";
                listInsurance.SelectedIndex = 0;
                pnlHastaForm.Visible        = true;
            }
        }
    protected void getData()
    {
        DataView stud_Address = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in stud_Address)
        {
            DataRow row = drv.Row;
            lblSadd.Text  = row["Address1"].ToString();
            lblSadd1.Text = row["Address2"].ToString();
            lblPost.Text  = row["Postcode"].ToString();
            lblCity.Text  = row["City"].ToString();
            lblState.Text = row["State"].ToString();
        }

        DataView parentF = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in parentF)
        {
            DataRow row = drv.Row;

            lblFname.Text   = row["Name"].ToString();
            lblFOcc.Text    = row["Occupation"].ToString();
            lblFsalary.Text = row["Salary"].ToString();
            lblphone.Text   = row["Contact"].ToString();
        }

        DataView parentAdd = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in parentAdd)
        {
            DataRow row = drv.Row;
            lblFadd.Text   = row["Address1"].ToString();
            lblFpost.Text  = row["Postcode"].ToString();
            lblFstate.Text = row["State"].ToString();
            lblFcity.Text  = row["City"].ToString();
        }
        DataView parentM = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in parentM)
        {
            DataRow row = drv.Row;
            lblMname.Text   = row["Name"].ToString();
            lblMOcc.Text    = row["Occupation"].ToString();
            lblMsalary.Text = row["Salary"].ToString();
        }

        DataView stud_Acad = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in stud_Acad)
        {
            DataRow row = drv.Row;
            lblSIns.Text  = row["Name_of_Institution"].ToString();
            lblSGrad.Text = row["Date"].ToString();
            lblcgpa.Text  = row["CGPA"].ToString();
            lblField.Text = row["Field_of_Study"].ToString();
        }
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int         rowIdx = int.Parse(e.CommandArgument.ToString());
        GridViewRow gvr    = GridView1.Rows[rowIdx];
        int         id     = 0;

        int.TryParse(gvr.Cells[1].Text, out id);
        String lid = gvr.Cells[2].Text;

        if (e.CommandName == "allocate")
        {
            try {
                String   building     = (gvr.FindControl("cmbBuilding") as DropDownList).SelectedValue;
                String   reference    = (gvr.FindControl("txtRef") as TextBox).Text;
                DateTime trnDate      = DateTime.Now;
                String   amt          = gvr.Cells[5].Text;
                String   description  = gvr.Cells[4].Text;
                int      period       = int.Parse((gvr.FindControl("cmbPeriod") as DropDownList).SelectedValue);
                bool     alloc        = false;
                DateTime dt           = DateTime.Parse(gvr.Cells[3].Text);
                String   build        = building;
                String   b2           = (building == "UNA" ? "" : building);
                String   oldReference = description;
                if (period != 0 && reference != "")
                {
                    String sql = "IF EXISTS (SELECT * FROM tblUnallocated WHERE lid = " + lid + ")";
                    sql += " UPDATE tblUnallocated SET amount = '" + amt + "', building = '" + building + "', allocatedDate = '" + trnDate.ToString("yyyy/MM/dd") + "', allocated = 'True', allocatedCode = '" + b2 + "', reference = '" + reference + "', period = " + period + " WHERE (lid = " + lid + ")";
                    sql += " ELSE ";
                    sql += " INSERT INTO tblUnallocated(lid, trnDate, building, amount, description, reference, period, allocatedDate, allocatedCode, trustpost)";
                    sql += " VALUES(" + lid + ", '" + gvr.Cells[3].Text + "', '" + building + "', " + amt.ToString() + ", '" + description + "', '" + reference + "', " + period.ToString();
                    sql += ", '" + trnDate + "', '" + b2 + "', 'False');";
                    sql += " UPDATE tblLedgerTransactions SET allocate = 'True' WHERE id = " + lid;
                    String sqlReply = utils.executeQuery(sql, null);
                    if (sqlReply == "")
                    {
                        getBuilding(lid, trnDate.ToString("dd/MM/yyyy"), amt, description, reference, period.ToString(), building, alloc, dt, oldReference);
                    }
                    else
                    {
                        lblError.Text = sqlReply;
                    }
                }
            } catch { }
        }
        else if (e.CommandName == "Remove")
        {
            String DeleteCommand = "DELETE FROM tblUnallocated WHERE id = " + id.ToString() + "; DELETE FROM tblLedgerTransactions WHERE id = " + lid;
            utils.executeQuery(DeleteCommand, null);
            SqlDataSource5.Select(new DataSourceSelectArguments());
            SqlDataSource5.DataBind();
            GridView1.DataBind();
        }
        SqlDataSource6.Select(new DataSourceSelectArguments());
        GridView1.DataBind();
    }
Esempio n. 6
0
    protected void Button12_Click(object sender, EventArgs e)
    {
        DataView  dv = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);
        DataTable dt = dv.ToTable();

        Label2.Text = dt.Rows[0][0].ToString();
        SqlDataSource8.Delete();
        SqlDataSource5.Delete();

        Response.Redirect("~/UserPage/UserElectricityServices.aspx");
    }
Esempio n. 7
0
    protected void btn2_Click(object sender, EventArgs e)
    {
        String Year = DropDownList1.SelectedValue;
        String sqlx = "SELECT DISTINCT UnitType FROM SchoolTable WHERE Year='" + Year + "'";

        SqlDataSource1.SelectCommand = sqlx;
        DataView dv = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());

        for (int i = 0; i < dv.Count; i++)
        {
            String uType = (String)dv[i][0];
            String Sql   = "select count(UnitName) from SchoolTable where UnitType='" + uType + "' AND Year='" + Year + "' AND Status='Activated'";
            SqlDataSource2.SelectCommand = Sql;
            DataView dv1   = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments());
            int      uName = (int)dv1[0][0];
            String   msqlx = "select count(StudFullName) from StudentTable where UnitType='" + uType + "' AND Year='" + Year + "' AND Status='Activated'";
            SqlDataSource3.SelectCommand = msqlx;
            DataView dv2   = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments());
            int      sName = (int)dv2[0][0];
            float    rf    = float.Parse(txtEnterRegistrationFeesForStudent.Text);
            float    t1    = sName * rf;
            String   msql  = "select count(FullName) from UnitLeaderTable where UnitType='" + uType + "' AND Year='" + Year + "' AND SupportingLeader='false' AND Status='Activated'";
            SqlDataSource4.SelectCommand = msql;
            DataView dv3    = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments());
            int      ulName = (int)dv3[0][0];
            String   msqlv  = "select count(FullName) from UnitLeaderTable where UnitType='" + uType + "' AND Year='" + Year + "' AND SupportingLeader='true' AND Status='Activated'";
            int      sut;
            DataView dv4 = (DataView)SqlDataSource5.Select(new DataSourceSelectArguments());
            if (dv4.Count == 1)
            {
                sut = (int)dv4[0][0];
            }
            else
            {
                sut = 0;
            }

            float  urs    = float.Parse(txtEnterFeesForUnitLeader.Text);
            float  total  = (ulName + sut) * urs;
            int    mtotal = sName + ulName + sut;
            float  rtotal = t1 + total;
            String query  = "INSERT INTO UnitInformation (UnitType, TotalUnits, TotalStudent, StudentRegistrationFees, StudentTotalFees, TotalUnitLeader, TotalSupportingLeader, UnitLeaderRegistrationFees, UnitLeaderTotalFees, TotalMembers, TotalFees, Year)  VALUES('" + uType + "'," + uName + "," + sName + "," + rf + "," + t1 + "," + ulName + "," + sut + "," + urs + "," + total + "," + mtotal + "," + rtotal + ",'" + Year + "')";
            SqlDataSource6.InsertCommand = query;
            int n = SqlDataSource6.Insert();
        }
        Response.Write("<script>alert('Data inserted successfully...')</script>");
        CleartextBoxes(this);
    }
Esempio n. 8
0
        protected void SignInBtn_Click(object sender, EventArgs e)
        {
            bool corrPassw = false;
            bool corrName  = false;

            RError.Text = "";

            SqlDataSource4.InsertParameters["ime"].DefaultValue      = RIme.Text;
            SqlDataSource4.InsertParameters["priimek"].DefaultValue  = RPriimek.Text;
            SqlDataSource4.InsertParameters["username"].DefaultValue = RUsername.Text;
            SqlDataSource4.InsertParameters["admin"].DefaultValue    = "0";
            DataView obstaja = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

            if (RUsername.Text.Equals(""))
            {
                RError.Text = RError.Text + "Vstavite uporabniško ime ";
            }
            else if (!(obstaja[0][0].ToString()).Equals("0"))
            {
                RError.Text = RError.Text + "Uporabnik s tem imenom ze obstaja, prosimo uporabite drugega. ";
            }
            else
            {
                corrName = true;
            }

            if (RGeslo1.Text.Equals(RGeslo2.Text) && Regex.IsMatch(RGeslo1.Text, @"(?=.*[A-Z].*[A-Z])(?=.*[0-9].*[0-9])(?=.*[?.*!:]+).{8,}"))
            {
                corrPassw = true;
                using (MD5 md5Hash = MD5.Create())
                {
                    string password = GetMd5Hash(md5Hash, RGeslo1.Text);
                    SqlDataSource4.InsertParameters["geslo"].DefaultValue = password;
                }
            }
            else
            {
                RError.Text  = RError.Text + "Gesla se ne ujameta ali ali ni veljavno geslo, vnesite znova ";
                RGeslo1.Text = "";
                RGeslo2.Text = "";
            }
            if (corrName && corrPassw)
            {
                SqlDataSource4.Insert();
                RError.Text = "Vaš uporabniški račun je bil uspešno ustvarjen!";
            }
        }
Esempio n. 9
0
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (DropDownList1.SelectedValue)
            {
            case "Inner":
            {
                DataView myData = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;

            case "Left Outer":
            {
                DataView myData = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;

            case "Right Outer":
            {
                DataView myData = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;

            case "Full Outer":
            {
                DataView myData = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;
            }
        }
Esempio n. 10
0
    protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (DataBinder.Eval(e.Row.DataItem, "fb_id").ToString() == Session["fb_id"].ToString() || Session["user_group"].ToString() == "1")
            {
            }
            else
            {
                e.Row.Cells[6].Text = "";
                e.Row.Cells[7].Text = "";
            }

            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                SqlDataSource5.SelectParameters["id"].DefaultValue = ((DropDownList)e.Row.FindControl("DropDownList1")).SelectedValue;
                SqlDataSource5.Select(DataSourceSelectArguments.Empty);
                DropDownList DdlCountry = (DropDownList)e.Row.FindControl("DropDownList2");
                // bind DropDown manually
                DdlCountry.DataBind();
                DdlCountry.SelectedValue = DataBinder.Eval(e.Row.DataItem, "id1").ToString();

                SqlDataSource6.SelectParameters["id"].DefaultValue = ((DropDownList)e.Row.FindControl("DropDownList1")).SelectedValue;
                SqlDataSource6.Select(DataSourceSelectArguments.Empty);
                DropDownList DdlCountry2 = (DropDownList)e.Row.FindControl("DropDownList3");
                // bind DropDown manually
                DdlCountry2.DataBind();
                DdlCountry2.SelectedValue = DataBinder.Eval(e.Row.DataItem, "id2").ToString();

                SqlDataSource7.SelectParameters["id"].DefaultValue = ((DropDownList)e.Row.FindControl("DropDownList1")).SelectedValue;
                SqlDataSource7.Select(DataSourceSelectArguments.Empty);
                DropDownList DdlCountry3 = (DropDownList)e.Row.FindControl("DropDownList4");
                // bind DropDown manually
                DdlCountry3.DataBind();
                DdlCountry3.SelectedValue = DataBinder.Eval(e.Row.DataItem, "id3").ToString();
            }
        }
    }
Esempio n. 11
0
        protected void timer1_tick(object sender, EventArgs e)
        {
            //if (0 > DateTime.Compare(DateTime.Now, DateTime.Parse(Session["timeout"].ToString())))
            //{
            //Aggiorna tabella

            SqlDataSource1.SelectCommand = "SELECT timestamp, pressione, temperatura, umidita, idsensore_ambientale FROM misura_ambientale WHERE idsensore_ambientale IN (SELECT idsensore FROM sensore_ambientale WHERE idluogo = (SELECT idluogo FROM palestra WHERE nome_centro = '" + DropDownList2.SelectedValue + "')) ORDER BY idmisura DESC LIMIT 20 ";
            SqlDataSource2.SelectCommand = "SELECT indice_attività, timestamp FROM misura_actigrafo WHERE idactigrafo = '" + DropDownList1.SelectedValue + "' AND timestamp BETWEEN timestamp(DATE_SUB(NOW(), INTERVAL 1 MINUTE)) AND timestamp(NOW()) ";
            SqlDataSource5.SelectCommand = "SELECT nome, cognome FROM utente WHERE actigrafo_idactigrafo = '" + DropDownList1.SelectedValue + "'";
            SqlDataSource6.SelectCommand = "SELECT DISTINCT idsensore FROM storico_errore WHERE idsensore IN (SELECT idsensore FROM sensore_ambientale WHERE idluogo = (SELECT idluogo FROM palestra WHERE nome_centro = '" + DropDownList2.SelectedValue + "')) AND TIMESTAMP BETWEEN TIMESTAMP (DATE_SUB(NOW(), INTERVAL 1 MINUTE)) AND TIMESTAMP (NOW()) ORDER BY iderrore DESC LIMIT 1";
            SqlDataSource7.SelectCommand = "SELECT DISTINCT * FROM storico_errore WHERE idsensore IN (SELECT idsensore FROM sensore_ambientale WHERE idluogo = (SELECT idluogo FROM palestra WHERE nome_centro = '" + DropDownList2.SelectedValue + "')) AND TIMESTAMP BETWEEN TIMESTAMP (DATE_SUB(NOW(), INTERVAL 1 MINUTE)) AND TIMESTAMP (NOW()) ORDER BY iderrore DESC LIMIT 1 ";
            SqlDataSource8.SelectCommand = "SELECT timestamp, pressione, temperatura, umidita, idsensore_ambientale FROM misura_ambientale WHERE idsensore_ambientale IN (SELECT idsensore FROM sensore_ambientale WHERE idluogo = (SELECT idluogo FROM palestra WHERE nome_centro = '" + DropDownList2.SelectedValue + "')) ORDER BY idmisura DESC LIMIT 1 ";
            GridView1.DataBind();
            GridView2.DataBind();
            Label1.Text = DateTime.Now.ToString();
            DataSourceSelectArguments sr   = new DataSourceSelectArguments();
            DataSourceSelectArguments sr_2 = new DataSourceSelectArguments();
            DataSourceSelectArguments sr_3 = new DataSourceSelectArguments();
            //DataSourceSelectArguments sr_3 = new DataSourceSelectArguments();
            //DataView dv_3 = (DataView)SqlDataSource7.Select(sr_3);
            DataView  dv   = (DataView)SqlDataSource5.Select(sr);
            DataView  dv_2 = (DataView)SqlDataSource7.Select(sr_2);
            DataView  dv_3 = (DataView)SqlDataSource2.Select(sr_3);
            DataTable dt   = dv_3.ToTable();

            if (dv.Count != 0)
            {
                Chart1.Series["Series1"].Name = dv[0][0].ToString() + " " + dv[0][1].ToString();
                Chart1.Legends[0].Font        = new System.Drawing.Font("Trebuchet MS", 15F, System.Drawing.FontStyle.Bold);
            }
            if (dv_2.Count != 0)
            {
                alarmLabel.ForeColor = System.Drawing.Color.Red;
                alarmLabel.Font.Size = 32;
                if (dv_2.Count < 2)
                {
                    alarmLabel.Text = "Rilevate anomalie su " + dv_2.Count + " sensore ambientale";
                }
                else
                {
                    alarmLabel.Text = "Rilevate anomalie su " + dv_2.Count + " sensori ambientali";
                }
            }
            else
            {
                alarmLabel.ForeColor = System.Drawing.Color.Green;
                alarmLabel.Font.Size = 12;
                alarmLabel.Text      = "Nessuna anomalia rilevata";
            }
            if (dv_3.Count > 0)
            {
                int num = int.Parse(dv_3[dv_3.Count - 1][0].ToString());
                if (num == 1)
                {
                    Image1.ImageUrl = "~/Models/Fermo.png";
                }
                else if (num == 2)
                {
                    Image1.ImageUrl = "~/Models/Lento.png";
                }
                else if (num == 3)
                {
                    Image1.ImageUrl = "~/Models/Moderato.png";
                }
                else if (num == 4)
                {
                    Image1.ImageUrl = "~/Models/Veloce.png";
                }
                else if (num == 5)
                {
                    Image1.ImageUrl = "~/Models/Vigoroso.png";
                }
            }
            //    ((Int32)DateTime.Parse(Session["timeout"].ToString()).Subtract(DateTime.Now).TotalMinutes).ToString();
            //}
        }
Esempio n. 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Label2.Text  = DateTime.Now.ToString("D");
        Label14.Text = "";
        Label16.Text = "";
        Label33.Text = "";
        Label34.Text = "";
        Label35.Text = "";
        Label36.Text = "";
        Label24.Text = "";
        Label47.Text = "";
        DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv.Table.Rows)
        {
            Cname        = (string)dv.Table.Rows[x][0];
            Cadd         = (string)dv.Table.Rows[x][1];
            Ccomp        = (string)dv.Table.Rows[x][2];
            Label14.Text = Label14.Text + Cname;
            Label33.Text = Label33.Text + Cadd;
            Label34.Text = Label34.Text + Ccomp;
            Label16.Text = Label16.Text + Cname;
            Label35.Text = Label35.Text + Cadd;
            Label36.Text = Label36.Text + Ccomp;
            Label24.Text = Label24.Text + Cname;
        }
        Venue.Text   = "";
        VAdd.Text    = "";
        N.Text       = "";
        Label37.Text = "";
        DataView dv1 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv1.Table.Rows)
        {
            Vname = (string)dv1.Table.Rows[x][0];
            Vadd  = (string)dv1.Table.Rows[x][1];
            Ename = (string)dv1.Table.Rows[x][2];
            Edate = (DateTime)dv1.Table.Rows[x][3];

            Venue.Text   = Venue.Text + Vname;
            VAdd.Text    = VAdd.Text + Vadd;
            N.Text       = N.Text + Ename;
            Label37.Text = Edate.ToString("D");
        }
        Label40.Text = "";
        Label41.Text = "";
        Label43.Text = "";
        Label44.Text = "";
        Label42.Text = "";
        Label1.Text  = "";
        DataView dv2 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv2.Table.Rows)
        {
            RF           = (double)dv2.Table.Rows[x][0];
            Total        = (double)dv2.Table.Rows[x][4];
            OE           = (double)dv2.Table.Rows[x][1];
            PB           = (double)dv2.Table.Rows[x][2];
            RPH          = (double)dv2.Table.Rows[x][3];
            DL           = (DateTime)dv2.Table.Rows[x][5];
            Label40.Text = Label40.Text + RF.ToString("n2");
            Label41.Text = Label41.Text + Total.ToString("n2");
            Label43.Text = Label43.Text + OE.ToString("n2");
            Label44.Text = Label44.Text + PB.ToString("n2");
            Label42.Text = Label42.Text + RPH.ToString("n2");
            Label1.Text  = DL.ToString("D");
        }
        Label45.Text = "";
        DataView dv3 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv3.Table.Rows)
        {
            Edate  = (DateTime)dv3.Table.Rows[x][0];
            Estime = (TimeSpan)dv3.Table.Rows[x][1];
            Eetime = (TimeSpan)dv3.Table.Rows[x][2];

            Label45.Text = Edate.ToString("D") + ' ' + ConvertMode(Estime.ToString()) + ' ' + '-' + ' ' + ConvertMode(Eetime.ToString());
        }
        Label46.Text = "";
        DataView dv4 = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv4.Table.Rows)
        {
            Aname        = (string)dv4.Table.Rows[x][0];
            Ades         = (string)dv4.Table.Rows[x][3];
            qty          = (int)dv4.Table.Rows[x][1];
            Label46.Text = Label46.Text + ' ' + Ades + ' ' + qty.ToString() + ' ' + "pcs" + ", ";
            x++;
        }
        Label3.Text = "";
        Label4.Text = "";
        string check = Label46.Text;
        int    lg    = check.Length;

        if (x > 0)
        {
            Label3.Text  = "<li> Amenity- ";
            check        = check.Substring(0, lg - 2);
            Label46.Text = check + ";";
            Label4.Text  = "</li>";
        }
        Label47.Text = "";
        DataView dv5 = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv5.Table.Rows)
        {
            Fname        = (string)dv5.Table.Rows[y][0];
            Fdes         = (string)dv5.Table.Rows[y][1];
            Label47.Text = Label47.Text + Fname + ' ' + Fdes + ", ";
            y++;
        }
        string check2 = Label47.Text;
        int    lg2    = check2.Length;

        Label5.Text = "";
        Label6.Text = "";
        if (y > 0)
        {
            Label5.Text  = "<li> Facility- ";
            check2       = check2.Substring(0, lg2 - 2);
            Label47.Text = check2 + ";";
            Label6.Text  = "</li>";
        }

        Label48.Text = "";
        DataView dv6 = (DataView)SqlDataSource7.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv6.Table.Rows)
        {
            Fname        = (string)dv6.Table.Rows[z][0];
            Fdes         = (string)dv6.Table.Rows[z][1];
            Label48.Text = Label48.Text + Mname + ' ' + Mdes + ", ";
            z++;
        }

        string check3 = Label48.Text;
        int    lg3    = check3.Length;

        if (lg3 != 0)
        {
            check3       = check3.Substring(0, lg3 - 2);
            Label48.Text = check3 + ";";
        }
    }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            String tc      = txtTc.Text;
            String name    = txtName.Text;
            String surname = txtSurname.Text;
            String birth   = txtBirth.Text;
            String ins     = listInsurance.SelectedValue;

            if (lblMessage.Text.Equals("Hasta kayıtlı değil."))
            {
                SqlCommand cmdSave = new SqlCommand("insert into patients (tc,name,surname,birth_year,insurance_type) " +
                                                    "VALUES ('" + tc + "','" + name + "','" + surname + "'," + birth + "," + ins + ")", baglantı);
                int rowsAffected = cmdSave.ExecuteNonQuery();
                if (rowsAffected == 1)
                {
                    lblMessage.Text = "Hasta Kaydedildi! ";
                }
                else
                {
                    lblMessage.Text = "Bişeyler yanlış gitti!";
                    return;
                }
            }

            String   doc_id     = listDoctors.SelectedValue;
            String   patient_id = "0";
            DataView dv         = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

            if (dv.Count > 0)
            {
                foreach (DataRowView drow in dv)
                {
                    patient_id = drow["id"].ToString();
                }
            }
            else
            {
                lblMessage.Text = "Hata";
            }
            String date = Calendar1.SelectedDate.ToString("yyyyMMdd");
            String time = rButtonsHours.SelectedValue.ToString() + ":00";

            SqlCommand cmdAppointment = new SqlCommand("insert into appointments (doctor_id,patient_id,date,time)" +
                                                       "VALUES (" + doc_id + "," + patient_id + ",convert(date,'" + date + "'),convert(time,'" + time + "'));", baglantı);
            int rowsAffected1 = 0;

            try
            {
                rowsAffected1 = cmdAppointment.ExecuteNonQuery();
                if (rowsAffected1 == 1)
                {
                    lblMessage.Text += "Randevu girildi! ";
                }
                else
                {
                    lblMessage.Text = "Bişeyler yanlış gitti!";
                    return;
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
    protected void redirectToPendingPage()
    {
        string strSQL2 = "SELECT count(*) from dbo.projects where d_id = '" + lblDivisionCode.Text + "' and pj_code = '" + lblProjectCode.Text + "' and pj_status = '" + Request.QueryString["status"] + "'";

        SqlDataSource5.SelectCommand = strSQL2;
        SqlDataSource5.DataBind();

        DataView dv2 = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dRow in dv2.Table.Rows)
        {
            if (dRow["pj_name"] != null && dRow["pj_yut_id"] != null && dRow["pj_relateDept"] != null &&
                dRow["pj_year"] != null && dRow["pj_budget"] != null && dRow["pj_integrateProject"] != null)
            {
                if (dRow["pj_filter_q1"] == null || dRow["pj_filter_q2"] == null)
                {
                    Response.Redirect("project_filter.aspx");
                }
                else if (dRow["pj_background"] == null || dRow["pj_urgency"] == null ||
                         dRow["pj_risk_info"] == null || dRow["pj_risk_reduction1"] == null ||
                         dRow["pj_risk_reduction2"] == null || dRow["pj_risk_eval1"] == null ||
                         dRow["pj_risk_eval2"] == null || dRow["pj_risk_eval3"] == null)
                {
                    Response.Redirect("project_basicinfo.aspx");
                }
                else if (dRow["pj_category"] == null)
                {
                    Response.Redirect("project_category.aspx");
                }
                else if (dRow["pj_type"] == null)
                {
                    Response.Redirect("project_type.aspx");
                }
                else
                {
                    Response.Redirect("project_pickquestion.aspx");
                }
            }
            else
            {
                //populate data to each fields on this page
                if (dRow["pj_name"] != null)
                {
                    txtProjectName.Text = dRow["pj_name"].ToString();
                }
                if (dRow["pj_budget"] != null)
                {
                    txtBudget.Text = dRow["pj_budget"].ToString();
                }
                if (dRow["pj_integrateProject"] != null)
                {
                    txtIntegrate.Text = dRow["pj_integrateProject"].ToString();
                }
                if (dRow["pj_relateDept"] != null)
                {
                    txtRelate.Text = dRow["pj_relateDept"].ToString();
                }
                if (dRow["pj_year"] != null)
                {
                    ddlYear.SelectedValue = dRow["pj_year"].ToString();
                }
                if (dRow["pj_yut_id"] != null)
                {
                    ddlYudtasad.SelectedIndex = Convert.ToInt32(dRow["pj_yut_id"].ToString());
                }
            }
        }
    }
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataView    dv  = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            DataRowView drv = dv[0];

            Table1.Rows[1].Cells[0].Text = drv["BUGS"].ToString();

            DataView    dv1  = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
            DataRowView drv1 = dv1[0];

            Table1.Rows[1].Cells[1].Text = drv1["BUGS"].ToString();

            DataView    dv2  = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
            DataRowView drv2 = dv2[0];

            Table1.Rows[1].Cells[2].Text = drv2["BUGS"].ToString();

            DataView    dv3  = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
            DataRowView drv3 = dv3[0];

            Table1.Rows[1].Cells[3].Text = drv3["BUGS"].ToString();

            DataView    dv5  = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);
            DataRowView drv5 = dv5[0];

            Table2.Rows[1].Cells[0].Text = drv5["BUGS"].ToString();

            DataView    dv6  = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
            DataRowView drv6 = dv6[0];

            Table2.Rows[1].Cells[1].Text = drv6["BUGS"].ToString();

            DataView    dv7  = (DataView)SqlDataSource7.Select(DataSourceSelectArguments.Empty);
            DataRowView drv7 = dv7[0];

            Table2.Rows[1].Cells[2].Text = drv7["BUGS"].ToString();

            DataView    dv8  = (DataView)SqlDataSource8.Select(DataSourceSelectArguments.Empty);
            DataRowView drv8 = dv8[0];

            Table2.Rows[1].Cells[3].Text = drv8["BUGS"].ToString();

            DataView    dv9  = (DataView)SqlDataSource9.Select(DataSourceSelectArguments.Empty);
            DataRowView drv9 = dv9[0];

            Table3.Rows[1].Cells[0].Text = drv9["BUGS"].ToString();

            DataView    dv10  = (DataView)SqlDataSource10.Select(DataSourceSelectArguments.Empty);
            DataRowView drv10 = dv10[0];

            Table3.Rows[1].Cells[1].Text = drv10["BUGS"].ToString();

            DataView    dv11  = (DataView)SqlDataSource11.Select(DataSourceSelectArguments.Empty);
            DataRowView drv11 = dv11[0];

            Table3.Rows[1].Cells[2].Text = drv11["BUGS"].ToString();

            DataView    dv12  = (DataView)SqlDataSource12.Select(DataSourceSelectArguments.Empty);
            DataRowView drv12 = dv12[0];

            Table3.Rows[1].Cells[3].Text = drv12["BUGS"].ToString();
        }
    protected void GridView5_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int         rowIdx = int.Parse(e.CommandArgument.ToString());
        GridViewRow gvr    = GridView5.Rows[rowIdx];
        int         id     = 0;

        int.TryParse(gvr.Cells[1].Text, out id);
        String lid = gvr.Cells[2].Text;

        if (e.CommandName == "allocate")
        {
            try {
                String   building    = (gvr.FindControl("cmbBuilding") as DropDownList).SelectedValue;
                String   reference   = (gvr.FindControl("txtRef") as TextBox).Text;
                DateTime trnDate     = DateTime.Now;
                String   amt         = (gvr.FindControl("txtAmount") as TextBox).Text;
                String   description = gvr.Cells[4].Text;
                int      period      = int.Parse((gvr.FindControl("cmbPeriod") as DropDownList).SelectedValue);
                DateTime dt          = DateTime.Parse(gvr.Cells[3].Text);
                String   b2          = (building == "UNA" ? "" : building);

                String oldReference = description;

                if (period != 0 && reference != "")
                {
                    String sql = "IF EXISTS (SELECT * FROM tblUnallocated WHERE lid = " + lid + ")";
                    sql += " UPDATE tblUnallocated SET amount = '" + amt + "', allocatedDate = '" + trnDate.ToString("yyyy/MM/dd") + "', allocated = 'True', allocatedCode = '" + b2 + "', ";
                    sql += " reference = '" + reference + "', period = " + period + " WHERE (lid = " + lid + ")";
                    sql += " ELSE ";
                    sql += " INSERT INTO tblUnallocated(lid, trnDate, amount, description, reference, period, allocatedDate, allocatedCode, trustpost)";
                    sql += " VALUES(" + lid + ", '" + gvr.Cells[3].Text + "', " + amt.ToString() + ", '" + description + "', '" + reference + "', " + period.ToString();
                    sql += ", '" + trnDate + "', '" + b2 + "', 'False');";
                    sql += " UPDATE tblLedgerTransactions SET allocate = 'True' WHERE id = " + lid;
                    //lblError.Text = sql;
                    String sqlReply = utils.executeQuery(sql, null);
                    if (sqlReply == "" && b2 != "")
                    {
                        getBuilding(lid, trnDate.ToString("dd/MM/yyyy"), amt, description, reference, period.ToString(), building, true, dt, oldReference);
                    }
                    else
                    {
                        lblError.Text = sqlReply;
                    }
                }
                else
                {
                    lblError.Text = "----";
                }
            } catch (Exception ex) {
                lblError.Text = ex.Message;
            }
        }
        else if (e.CommandName == "Remove")
        {
            int     counter = 0;
            DataSet ds      = utils.getData("SELECT count(*) as dupes FROM tblUnallocated WHERE lid = " + lid, null);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                counter = int.Parse(ds.Tables[0].Rows[0]["dupes"].ToString());
            }
            String DeleteCommand = "DELETE FROM tblUnallocated WHERE id = " + id.ToString() + ";";
            if (counter < 2)
            {
                DeleteCommand += " DELETE FROM tblLedgerTransactions WHERE id = " + lid;
            }
            utils.executeQuery(DeleteCommand, null);
            SqlDataSource5.Select(new DataSourceSelectArguments());
            SqlDataSource5.DataBind();
            GridView5.DataBind();
        }
    }
Esempio n. 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String y = "select DISTINCT [Year] from SchoolTable";

        SqlDataSource9.SelectCommand = y;
        DataView dv = (DataView)SqlDataSource9.Select(new DataSourceSelectArguments());

        for (int i = 0; i < dv.Count; i++)
        {
            if (dv[i][0] != DBNull.Value)
            {
                String year = (String)dv[i][0];

                String sql1 = "select count(UnitName) from SchoolTable where UnitType='Cub' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource1.SelectCommand = sql1;
                DataView dv1 = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());
                int      cub = (int)dv1[0][0];

                String sql2 = "select count(UnitName) from SchoolTable where UnitType='Scout' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource2.SelectCommand = sql2;
                DataView dv2   = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments());
                int      scout = (int)dv2[0][0];

                String sql3 = "select count(UnitName) from SchoolTable where UnitType='Rover' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource3.SelectCommand = sql3;
                DataView dv3   = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments());
                int      rover = (int)dv3[0][0];

                String sql4 = "select count(UnitName) from SchoolTable where UnitType='Bulbul' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource4.SelectCommand = sql4;
                DataView dv4    = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments());
                int      bulbul = (int)dv4[0][0];

                String sql5 = "select count(UnitName) from SchoolTable where UnitType='Guide' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource5.SelectCommand = sql5;
                DataView dv5   = (DataView)SqlDataSource5.Select(new DataSourceSelectArguments());
                int      guide = (int)dv5[0][0];

                String sql6 = "select count(UnitName) from SchoolTable where UnitType='Ranger' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource6.SelectCommand = sql6;
                DataView dv6    = (DataView)SqlDataSource6.Select(new DataSourceSelectArguments());
                int      ranger = (int)dv6[0][0];

                String sql7 = "select count(UnitName) from SchoolTable where UnitType='Bunny' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource7.SelectCommand = sql7;
                DataView dv7   = (DataView)SqlDataSource7.Select(new DataSourceSelectArguments());
                int      bunny = (int)dv7[0][0];

                int total = cub + scout + rover + bulbul + guide + ranger + bunny;

                String sql9 = "select count(StudFullName) from StudentTable where UnitType='Cub' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource9.SelectCommand = sql9;
                DataView dv9  = (DataView)SqlDataSource9.Select(new DataSourceSelectArguments());
                int      cub1 = (int)dv9[0][0];

                String sql10 = "select count(StudFullName) from StudentTable where UnitType='Scout' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource10.SelectCommand = sql10;
                DataView dv10   = (DataView)SqlDataSource10.Select(new DataSourceSelectArguments());
                int      scout1 = (int)dv10[0][0];

                String sql11 = "select count(StudFullName) from StudentTable where UnitType='Rover' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource11.SelectCommand = sql11;
                DataView dv11   = (DataView)SqlDataSource11.Select(new DataSourceSelectArguments());
                int      rover1 = (int)dv11[0][0];

                String sql12 = "select count(StudFullName) from StudentTable where UnitType='Bulbul' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource12.SelectCommand = sql12;
                DataView dv12    = (DataView)SqlDataSource12.Select(new DataSourceSelectArguments());
                int      bulbul1 = (int)dv12[0][0];

                String sql13 = "select count(StudFullName) from StudentTable where UnitType='Guide' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource13.SelectCommand = sql13;
                DataView dv13   = (DataView)SqlDataSource13.Select(new DataSourceSelectArguments());
                int      guide1 = (int)dv13[0][0];

                String sql14 = "select count(StudFullName) from StudentTable where UnitType='Ranger' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource14.SelectCommand = sql14;
                DataView dv14    = (DataView)SqlDataSource14.Select(new DataSourceSelectArguments());
                int      ranger1 = (int)dv14[0][0];

                String sql15 = "select count(StudFullName) from StudentTable where UnitType='Bunny' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource15.SelectCommand = sql15;
                DataView dv15   = (DataView)SqlDataSource15.Select(new DataSourceSelectArguments());
                int      bunny1 = (int)dv7[0][0];

                int total1 = cub1 + scout1 + rover1 + bulbul1 + guide1 + ranger1 + bunny1;

                String sql16 = "select count(UnitName) from SchoolTable where Year='" + year + "' AND Status='Activated'";
                SqlDataSource16.SelectCommand = sql16;
                DataView dv16 = (DataView)SqlDataSource16.Select(new DataSourceSelectArguments());
                int      unit = (int)dv16[0][0];

                String sql17 = "select SUM(khTotalContri) from SchoolTable where Year='" + year + "'";
                SqlDataSource17.SelectCommand = sql17;
                DataView dv17 = (DataView)SqlDataSource17.Select(new DataSourceSelectArguments());
                int      amt;
                if (dv17[0][0] != DBNull.Value)
                {
                    amt = (int)dv17[0][0];
                }
                else
                {
                    amt = 0;
                }
                String sql18 = "select count(SchoolName) from SchoolTable where Year='" + year + "' AND Status='Activated'";
                SqlDataSource18.SelectCommand = sql18;
                DataView dv18 = (DataView)SqlDataSource18.Select(new DataSourceSelectArguments());
                int      sch  = (int)dv18[0][0];

                String sql19 = "select count(SchoolName) from SchoolTable where SchoolType='PrimarySchool' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource19.SelectCommand = sql19;
                DataView dv19 = (DataView)SqlDataSource19.Select(new DataSourceSelectArguments());
                int      sch1 = (int)dv19[0][0];

                String sql20 = "select count(SchoolName) from SchoolTable where SchoolType='SecondarySchool' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource20.SelectCommand = sql20;
                DataView dv20 = (DataView)SqlDataSource20.Select(new DataSourceSelectArguments());
                int      sch2 = (int)dv20[0][0];

                int    total3 = sch1 + sch2;
                String update = "Select * from StatisticalData where Year='" + year + "'";
                SqlDataSource21.SelectCommand = update;
                DataView dv21 = (DataView)SqlDataSource21.Select(new DataSourceSelectArguments());
                if (dv21.Count != 0)
                {
                    String query = "update StatisticalData set Cub=" + cub + ", Scout=" + scout + ", Rover=" + rover + ", Bulbul=" + bulbul + ", Guide=" + guide + ", Ranger=" + ranger + ", Bunny=" + bunny + ", Total=" + total + ", Cub1=" + cub1 + ", Scout1=" + scout1 + ", Rover1=" + rover1 + ", Bulbul1=" + bulbul1 + ", Guide1=" + guide1 + ", Ranger1=" + ranger1 + ", Bunny1=" + bunny1 + ", Total1=" + total1 + ", TotalUnits=" + unit + ", CollectedFees=" + amt + ", TotalParticipatedSchools=" + sch + ", PrimarySchool=" + sch1 + ", SecondarySchool=" + sch2 + ", TotalMembers=" + total3 + " where Year='" + year + "'";
                    SqlDataSource22.UpdateCommand = query;
                    int n = SqlDataSource22.Update();
                }
                else
                {
                    String insert1 = "insert into StatisticalData (Year, Cub, Scout, Rover, Bulbul, Guide, Ranger, Bunny, Total, Cub1, Scout1, Rover1, Bulbul1, Guide1, Ranger1, Bunny1, Total1, TotalUnits, CollectedFees, TotalParticipatedSchools, PrimarySchool, SecondarySchool, TotalMembers) Values('" + year + "'," + cub + "," + scout + "," + rover + "," + bulbul + "," + guide + "," + ranger + "," + bunny + "," + total + "," + cub1 + "," + scout1 + "," + rover1 + "," + bulbul1 + "," + guide1 + "," + ranger1 + "," + bunny1 + "," + total1 + "," + unit + "," + amt + "," + sch + "," + sch1 + "," + sch2 + "," + total3 + ")";
                    SqlDataSource8.InsertCommand = insert1;
                    int n1 = SqlDataSource8.Insert();
                }
            }
        }
        Server.Transfer("Statistical2.aspx");
    }
Esempio n. 18
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        DataView d1 = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());
        DataView d2 = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments());
        DataView d4 = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments());
        DataView d3 = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments());
        DataView d5 = (DataView)SqlDataSource5.Select(new DataSourceSelectArguments());
        DataView dv = (DataView)Sqlds.Select(new DataSourceSelectArguments());

        if (d1.Count != 0 && d2.Count == 0)
        {
            Session.Add("SchoolName", d3[0][4]);
            Session.Add("UnitName", d3[0][3]);
            Session.Add("Year", d3[0][1]);
            Session.Add("UnitType", d3[0][2]);
            Session.Add("EmailId", d3[0][5]);
            Session.Add("pwd", d3[0][6]);
            Session.Add("SchoolType", d3[0][0]);
            Server.Transfer("admission2.aspx");
        }
        else if (d2.Count != 0 && d4.Count == 0)
        {
            Session.Add("SchoolName", d3[0][4]);
            Session.Add("UnitName", d3[0][3]);
            Session.Add("Year", d3[0][1]);
            Session.Add("UnitType", d3[0][2]);
            Session.Add("EmailId", d3[0][5]);
            Session.Add("pwd", d3[0][6]);
            Server.Transfer("admission3.aspx");
        }
        else if (d4.Count != 0 && dv.Count == 0)
        {
            Server.Transfer("RegistrationFormPrint.aspx");
        }

        else if (txtUsername.Text == "admin" && txtPwd.Text == "admin")
        {
            Server.Transfer("Authentication.aspx");
        }

        else if (d5.Count == 1)
        {
            Session.Add("District", d5[0][0]);
            Server.Transfer("Admin2.aspx");
        }
        else
        {
            if (dv.Count == 1)
            {
                if (dv[0][0] != DBNull.Value)
                {
                    DataView dv1 = (DataView)SqldsYear.Select(new DataSourceSelectArguments());
                    String   y   = (String)dv1[0][0];
                    String   s1  = y.Substring(0, 4);
                    String   s   = y.Substring(4);
                    String   y1  = (String)DateTime.Today.Year.ToString();
                    String   n   = y1.Insert(4, s);
                    if (y1 != s1)
                    {
                        int      year1 = int.Parse(s1) + 1;
                        int      year  = int.Parse(y1);
                        DateTime n1    = new DateTime(year, 3, 31);
                        if (year == year1)
                        {
                            if (DateTime.Today.Month.ToString() == n1.Month.ToString() && DateTime.Today.Date.ToString() == n1.Date.ToString())
                            {
                                Response.Write("<script>alert('Login Successfully...')</script>");
                                HttpCookie c1, c2;
                                c1         = new HttpCookie("userid", txtUsername.Text);
                                c2         = new HttpCookie("pwd", txtPwd.Text);
                                c1.Expires = DateTime.Now.AddYears(1);
                                c2.Expires = DateTime.Now.AddYears(1);

                                Response.AppendCookie(c1);
                                Response.AppendCookie(c2);

                                Server.Transfer("Schooldashboard.aspx");
                                Session.Add("EmailId", txtUsername.Text);
                                Session.Add("pwd", txtPwd.Text);
                            }
                            else
                            {
                                Response.Write("<script>alert('Your EmailId or Password has been expired...please register again')</script>");
                                return;
                            }
                        }
                    }
                    else
                    {
                        if (y == n)
                        {
                            Response.Write("<script>alert('Login Successfully...')</script>");
                            HttpCookie c1, c2;
                            c1         = new HttpCookie("userid", txtUsername.Text);
                            c2         = new HttpCookie("pwd", txtPwd.Text);
                            c1.Expires = DateTime.Now.AddYears(1);
                            c2.Expires = DateTime.Now.AddYears(1);

                            Response.AppendCookie(c1);
                            Response.AppendCookie(c2);

                            Server.Transfer("Schooldashboard.aspx");
                            Session.Add("EmailId", txtUsername.Text);
                            Session.Add("pwd", txtPwd.Text);
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('Invalid Username or Password...')</script>");
                }
            }
        }
    }
Esempio n. 19
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();
    }
Esempio n. 20
0
    protected void getData()
    {
        DataView studentInfo = (DataView)sqlStudent.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in studentInfo)
        {
            DataRow row = drv.Row;
            lblName.Text    = row["Name"].ToString();
            lblSign.Text    = row["Name"].ToString();
            lblPhone.Text   = row["Contact"].ToString();
            lblEmail.Text   = row["Email"].ToString();
            lblNation.Text  = row["Nationality"].ToString();
            lblRel.Text     = row["Religion"].ToString();
            lblIC.Text      = row["IC_Passport"].ToString();
            lblDob.Text     = row["DOB"].ToString();
            lblplace.Text   = row["State_Birth"].ToString();
            lblmatric.Text  = row["Matrix_No"].ToString();
            lblMStatus.Text = row["Description"].ToString();
        }

        DataView studAdd = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in studAdd)
        {
            DataRow row = drv.Row;
            lblAdd.Text  = row["Address1"].ToString() + " " + row["Address2"].ToString() + ", " + row["Postcode"].ToString() + ", " + row["City"].ToString() + ", " + row["State"].ToString();
            lblAdd1.Text = row["Address1"].ToString() + " " + row["Address2"].ToString() + ", " + row["Postcode"].ToString() + ", " + row["City"].ToString() + ", " + row["State"].ToString();
        }


        DataView parentInfo = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in parentInfo)
        {
            DataRow row = drv.Row;

            lblguard1.Text  = row["Name"].ToString();
            lblIC1.Text     = row["IC"].ToString();
            lblNation1.Text = row["Nationality"].ToString();
            lblSalary1.Text = row["Salary"].ToString();
            lblphone1.Text  = row["Contact"].ToString();
            lblocc1.Text    = row["Occupation"].ToString();
        }

        DataView parentInfo2 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in parentInfo2)
        {
            DataRow row = drv.Row;

            lblguard2.Text  = row["Name"].ToString();
            lblIC2.Text     = row["IC"].ToString();
            lblNation2.Text = row["Nationality"].ToString();
            lblSalary2.Text = row["Salary"].ToString();
            lblphone2.Text  = row["Contact"].ToString();
            lblocc2.Text    = row["Occupation"].ToString();
        }

        DataView publish = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in publish)
        {
            DataRow row = drv.Row;

            lblpaper.Text       = row["title"].ToString();
            lblTypeAutho.Text   = row["type_authorship"].ToString();
            lblType.Text        = row["type"].ToString();
            lblimpact.Text      = row["impact_factor"].ToString();
            lblStatusPaper.Text = row["status_paper"].ToString();
            lblAuthor.Text      = row["authors"].ToString();
            lbldate.Text        = row["Date_publication"].ToString();
        }
    }