Exemple #1
0
    protected String Repostdata(String Attri, String Enti,
                                String PrimKey)
    {
        String HTMLField = "";

        System.Diagnostics.Debug.WriteLine(UserID);

        try
        {
            // Links application to database, opens SQL connection and establishs insert string
            System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand();

            SQLisConnect.SQLConnection();

            Statement = "SELECT " + Attri + " from dbo." + Enti + " WHERE " + PrimKey + "=" + UserID;
            HTMLField = SQLisConnect.DatabaseSelect(Statement);
            return(HTMLField);
        }
        catch (System.Data.SqlClient.SqlException sqlException)
        {
            // Throws any DB errors in a Message Box for user
            System.Diagnostics.Debug.WriteLine(sqlException.Message);
        }
        return(HTMLField = "Error Loading");
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Enti = (String)Session["username"];
        String HTMLField = "";

        if (!IsPostBack)
        {
            if (AppStatues.Equals("Started"))
            {
                try
                {
                    System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection();
                    sc.ConnectionString = @"Server=SILAS-PC\LOCALHOST; Database=WLS;Trusted_Connection=Yes;";
                    sc.Open();
                    System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand();
                    insert.Connection = sc;

                    insert.CommandText = "";
                    insert.CommandText = "Select * from PROFILE where USERNAME = @USERNAME;";

                    using (SqlDataReader volReader = insert.ExecuteReader())
                    {
                        while (volReader.Read())
                        {
                            PhoneNumber.Text       = volReader["PHONE"].ToString();
                            DOB.Text               = volReader["DOB"].ToString();
                            Gender.Text            = volReader["GENDER"].ToString();
                            Allergies.Text         = volReader["ALLERGIESSPECIFY"].ToString();
                            limitations.Text       = volReader["LIMITATIONSSPECIFY"].ToString();
                            MedicalConditions.Text = volReader["CONDITIONS"].ToString();
                            TeamType               = volReader["TeamType"].ToString();
                        }
                    }

                    insert.CommandText = "";
                    insert.CommandText = "Select * from EMERGENCYCONTACT where USERNAME = @USERNAME;";

                    using (SqlDataReader volReader = insert.ExecuteReader())
                    {
                        while (volReader.Read())
                        {
                            EMName.Text        = volReader["NAME"].ToString();
                            EMPhoneNumber.Text = volReader["PHONE"].ToString();
                            EMRelation.Text    = volReader["RELATIONSHIP"].ToString();
                            EMAddress.Text     = volReader["ADDRESSLINE1"].ToString();
                            EMAddress2.Text   += volReader["ADDRESSLINE2"].ToString();
                            EMCity.Text       += volReader["CITY"].ToString();
                            EMZipCode.Text    += volReader["ZIPCODE"].ToString();
                        }
                    }

                    insert.CommandText = "";
                    insert.CommandText = "Select filepath from datafiles where lastupdated = @USERNAME and Filetype = profile pic;";
                    using (SqlDataReader volReader = insert.ExecuteReader())
                    {
                        while (volReader.Read())
                        {
                            ProfileImg.ImageUrl = volReader["filepath"].ToString();
                        }
                    }
                }
                catch (System.Data.SqlClient.SqlException sqlException)
                {
                    // Throws any DB errors in a Message Box for user
                    System.Diagnostics.Debug.WriteLine(sqlException.Message);
                    HTMLField = "Error Loading";
                }

                System.Diagnostics.Debug.WriteLine(UserID);

                try
                {
                    // Links application to database, opens SQL connection and establishs insert string
                    System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand();

                    SQLisConnect.SQLConnection();

                    Statement = "SELECT filetype, filePath from dbo. datafiles WHERE LastUpdatedBy =" + UserID;
                    HTMLField = SQLisConnect.DatabaseSelect(Statement);
                }
                catch (System.Data.SqlClient.SqlException sqlException)
                {
                    // Throws any DB errors in a Message Box for user
                    System.Diagnostics.Debug.WriteLine(sqlException.Message);
                    HTMLField = "Error Loading";
                }

                try
                {
                    //UserID = (String)Session["Username"];
                    Enti    = "Users";
                    PrimKey = "USERNAME";

                    UserFirstN = Repostdata(UserFirstN, Enti, PrimKey);
                    UserLastN  = Repostdata(UserLastN, Enti, PrimKey);
                    UserEmail  = Repostdata(UserEmail, Enti, PrimKey);

                    NavUsername.Text = UserFirstN + " " + UserLastN;
                    Position.Text    = "IDK";
                    Email.Text       = UserEmail;
                }
                catch (System.Data.SqlClient.SqlException sqlException)
                {
                    // Throws database errors in a Message Box to alert the user
                    System.Diagnostics.Debug.WriteLine(sqlException.Message);
                }

                if (ProfileImg.ImageUrl == "")
                {
                    ProfileImg.ImageUrl = "http:/localhost:58532/WLS-CSHARP/images/"
                                          + "Default PP.jpg";
                }
            }

            //if (TeamType.Contains("1"))
            //{
            //    Departmentlist.Text.Concat(" Animal Care");
            //    frmAnimalCare.Visible = true;
            //}
            //if (TeamType.Contains("2"))
            //{
            //    Departmentlist.Items.Add("Other");
            //    frmFrontDesk.Visible = true;
            //}
            //if (TeamType.Contains("3"))
            //{
            //    Departmentlist.Items.Add("Outreach");
            //    frmOutreach.Visible = true;
            //}
            //if (TeamType.Contains("4"))
            //{
            //    Departmentlist.Items.Add("Transport");
            //    frmTransport.Visible = true;
            //}
            //if (TeamType.Contains("5"))
            //{
            //    Departmentlist.Items.Add("Vet");
            //    frmVet.Visible = true;
            //}
            //if (TeamType.Contains("None")||(TeamType == ""))
            //{
            //    Departmentlist.Visible = false;
            //}

            this.Page.DataBind();
        }
    }
Exemple #3
0
    protected void saveForLater(object sender, EventArgs e)
    {
        System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand();

        SQLisConnect.SQLConnection();

        String   Stringdate  = DOB.Text;
        DateTime?dOB         = datestoNull(Stringdate);
        String   gender      = Gender.Text;
        String   address1    = Address1.Text;
        String   address2    = Address2.Text;
        String   city        = City.Text;
        String   state       = State.Text;
        String   zipCode     = ZipCode.Text;
        String   phoneNumber = (PhoneNumber.Text);
        String   eMName      = EMName.Text;
        String   eMRelation  = EMRelation.Text;
        String   eMAddress1  = EMAddress.Text;
        String   eMAddress2  = EMAddress2.Text;

        String eMcity            = EMCity.Text;
        String eMstate           = EMState.Text;
        String eMzipCode         = EMZipCode.Text;
        String eMPhoneNumber     = (EMPhoneNumber.Text);
        String vacinationdoc     = VaccinatedRadio.SelectedValue;
        String rehabpermit       = RehabpermitRadio.SelectedValue;
        String allergies         = Allergies.Text;
        String medicalCondition  = MedicalConditions.Text;
        String limitation        = limitations.Text;
        String distance          = Distance.Text;
        String specieslimitation = Specieslimitation.Text;

        string[,] Aval = { { "Monday",    Day1St.Text.ToString(), Day1f.Text.ToString() },
                           { "Tuesday",   Day2St.Text.ToString(), Day2f.Text.ToString() },
                           { "Wednesday", Day3St.Text.ToString(), Day3f.Text.ToString() },
                           { "Thursday",  Day4St.Text.ToString(), Day4f.Text.ToString() },
                           { "Friday",    Day5St.Text.ToString(), Day5f.Text.ToString() } };

        for (int i = 0; i < 5; i++)
        {
            String Dayofweek = Aval[i, 0];
            String StartTime = Aval[i, 1];
            String EndTime   = Aval[i, 2];
            saved = SavingFiles.SaveAvailibility(Dayofweek, StartTime, EndTime, UserID);
        }



        /*Insert stamtement order for application
         *
         * [PROFILEID] [int] NOT NULL,
         * [USERNAME] [varchar](50) NOT NULL,
         * [PHONE] [varchar](25) NOT NULL,
         * [DOB] [date] NOT NULL,
         * [GENDER] [varchar](25) NOT NULL,
         * [PROFSTATUS] [varchar](50) NOT NULL,
         * [USERTYPE] [varchar](50) NOT NULL,
         * [ALLERGIES] [bit] NOT NULL,
         * [ALLERGIESSPECIFY] [varchar](50) NULL,
         * [LIMITATIONS] [bit] NOT NULL,
         * [LIMITATIONSSPECIFY] [varchar](50) NULL,
         * [MEDICALCONDITIONS] [varchar](50) NULL,
         * [RABVACCINEFLAG] [bit] NOT NULL,
         * [RABATTACH] [varbinary](max) NULL,
         * [VALIDPERMITFLAG] [bit] NOT NULL,
         * [VALIDPERMITATTACH] [varbinary](max) NULL,
         * [PERMITCATEGORY] [int] NULL,
         * [RESUMEATTACH] [varbinary](max) NULL,
         * [LETTEROFRECOM] [varbinary](max) NULL,
         * [LASTUPDATED] [datetime] NOT NULL,
         * [LASTUPDATEDBY] [varchar](50) NOT NULL,
         *
         */

        insert.CommandText = "insert into [dbo].[APPLICANT]"
                             + "([PROFILEID],[USERID],[PHONE],[DOB],[GENDER],[PROFSTATUS],[USERTYPE],[ALLERGIES],[ALLERGIESSPECIFY],"
                             + "[LIMITATIONS],[LIMITATIONSSPECIFY],[MEDICALCONDITIONS],[RABVACCINEFLAG],[RABATTACH],[VALIDPERMITFLAG],[VALIDPERMITATTACH],"
                             + "[PERMITCATEGORY],[RESUMEATTACH],[LETTEROFRECOM],[LASTUPDATED],[LASTUPDATEDBY])";

        insert.CommandText += " values (@PROFILEID,@USERID,@PHONE,@DOB,@GENDER,@PROFSTATUS,@USERTYPE,@ALLERGIES,@ALLERGIESSPECIFY,"
                              + "@LIMITATIONS,@LIMITATIONSSPECIFY,@MEDICALCONDITIONS,@RABVACCINEFLAG,@RABATTACH,@VALIDPERMITFLAG,@VALIDPERMITATTACH,"
                              + " @PERMITCATEGORY,@RESUMEATTACH,@LETTEROFRECOM,@LASTUPDATED,@LASTUPDATEDBY";

        insert.Parameters.AddWithValue("@USERID", UserID);
        insert.Parameters.AddWithValue("@PHONE", phoneNumber);
        insert.Parameters.AddWithValue("@DOB", dOB);
        insert.Parameters.AddWithValue("@GENDER", gender);
        insert.Parameters.AddWithValue("@PROFSTATUS", AppStatues);
        insert.Parameters.AddWithValue("@USERTYPE", UserID);
        insert.Parameters.AddWithValue("@ALLERGIES", 1);
        insert.Parameters.AddWithValue("@ALLERGIESSPECIFY", allergies);
        insert.Parameters.AddWithValue("@LIMITATIONS", 1);
        insert.Parameters.AddWithValue("@LIMITATIONSSPECIFY", limitation);
        insert.Parameters.AddWithValue("@MEDICALCONDITIONS", medicalCondition);
        insert.Parameters.AddWithValue("@RABVACCINEFLAG", 1);
        insert.Parameters.AddWithValue("@RABATTACH", "");
        insert.Parameters.AddWithValue("@VALIDPERMITFLAG", 1);
        insert.Parameters.AddWithValue("@VALIDPERMITATTACH", "");
        insert.Parameters.AddWithValue("@PERMITCATEGORY", "");
        insert.Parameters.AddWithValue("@RESUMEATTACH", "");
        insert.Parameters.AddWithValue("@LETTEROFRECOM", "");
        insert.Parameters.AddWithValue("@LASTUPDATED", UserID);
        insert.Parameters.AddWithValue("@LASTUPDATEDBY", DateTime.Now);

        insert.ExecuteNonQuery();

        if (saved)
        {
            AppStatues = "Started";
            saved      = SavingFiles.ApplicationStatus(AppStatues, UserID);
        }

        if (saved)
        {
        }
    }