Esempio n. 1
0
 public static string UserActiveDeActive(string eid, string uid)
 {
     try
     {
         DBConnectionClass con = new DBConnectionClass();
         bool i;
         if (eid.ToString() == "0")
         {
             i = con.boolInsertData("update LAS_login set active_flag=0 where login_id='" + uid.ToString().Trim() + "'");
         }
         else
         {
             i = con.boolInsertData("update LAS_login set active_flag=1 where login_id='" + uid.ToString().Trim() + "'");
         }
         if (i == true)
         {
             return("true");
         }
         else
         {
             return("false");
         }
     }
     catch (Exception)
     {
         return("false");
     }
 }
    protected void txtCountry_TextChanged(object sender, EventArgs e)
    {
        int i = 0;
        DBConnectionClass   conD = new DBConnectionClass("CheckDuplicateData");
        List <SqlParameter> sqlp = new List <SqlParameter>();

        sqlp.Clear();
        sqlp.Add(new SqlParameter("@TableName", "LAS_country"));
        sqlp.Add(new SqlParameter("@FieldName", "country_name"));
        sqlp.Add(new SqlParameter("@FieldValue", txtCountry.Text.ToString().Trim()));
        i = conD.CheckDuplicate(sqlp);
        if (i >= 1)
        {
            if (btnSubmit.Text == "Update" && txtCountry.Text.ToUpper().Trim() != ViewState["description"].ToString().ToUpper().Trim())
            {
                lblDErrorMsg.Text = "* This country exist.";
            }
            else
            {
                lblDErrorMsg.Text = "";
            }
            if (btnSubmit.Text == "Save")
            {
                lblDErrorMsg.Text = "* This country exist.";
            }
        }
        else
        {
            lblDErrorMsg.Text = "";
        }
    }
Esempio n. 3
0
    protected void txttitle_TextChanged(object sender, EventArgs e)
    {
        int i = 0;
        DBConnectionClass   conD = new DBConnectionClass("CheckDuplicateData");
        List <SqlParameter> sqlp = new List <SqlParameter>();

        sqlp.Clear();
        sqlp.Add(new SqlParameter("@TableName", "service"));
        sqlp.Add(new SqlParameter("@FieldName", "sname"));
        sqlp.Add(new SqlParameter("@FieldValue", txttitle.Text.ToString().Trim()));
        i = conD.CheckDuplicate(sqlp);
        if (i >= 1)
        {
            if (btnSubmit.Text == "Update" && txtDescription.Text.ToUpper().Trim() != ViewState["description"].ToString().ToUpper().Trim())
            {
                lblDErrorMsg.Text    = "* This service exist.";
                lblDErrorMsg.Visible = true;
            }
            else
            {
                lblDErrorMsg.Text    = "";
                lblDErrorMsg.Visible = false;
            }
            if (btnSubmit.Text == "Submit")
            {
                lblDErrorMsg.Text    = "* This service exist.";
                lblDErrorMsg.Visible = true;
            }
        }
        else
        {
            lblDErrorMsg.Text    = "";
            lblDErrorMsg.Visible = false;
        }
    }
Esempio n. 4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (lblDErrorMsg.Text != "")
        {
        }
        else
        {
            Byte[] bytes = null;
            String ext   = imgCategoryImage.PostedFile.ContentType;

            try
            {
                if (ext.ToLower() == "image/jpeg" || ext.ToLower() == "image/jpg" || ext.ToLower() == "image/png")
                {
                    if (imgCategoryImage.PostedFile.ContentLength > 0)
                    {
                        Stream       fs = imgCategoryImage.PostedFile.InputStream;
                        BinaryReader br = new BinaryReader(fs);
                        bytes = br.ReadBytes((Int32)fs.Length);
                    }
                }
                else
                if (Session["imageupdate"] != null)
                {
                    bytes = (Byte[])Session["imageupdate"];
                }
                else
                {
                    bytes = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
                }

                List <SqlParameter> sqlp = new List <SqlParameter>();
                sqlp.Add(new SqlParameter("@photo_src", bytes));
                sqlp.Add(new SqlParameter("@item_name", txtItem.Text.ToString().Trim()));
                sqlp.Add(new SqlParameter("@item_type", cmbItemtype.SelectedValue.ToString()));
                sqlp.Add(new SqlParameter("@price", txtPrice.Text.ToString().Trim()));
                sqlp.Add(new SqlParameter("@description", txtDescription.Text.ToString().Trim()));

                if (btnSubmit.Text == "Submit")
                {
                    DBConnectionClass dbSp = new DBConnectionClass("insertItem");

                    if (dbSp.SaveData(sqlp) == true)
                    {
                        Response.Redirect("item.aspx");
                    }
                }
                else
                {
                    DBConnectionClass dbSp = new DBConnectionClass("updateItem");
                    sqlp.Add(new SqlParameter("@item_id", ViewState["id"].ToString()));
                    if (dbSp.SaveData(sqlp) == true)
                    {
                        Response.Redirect("item.aspx");
                    }
                }
            }
            catch (Exception) { }
        }
    }
        protected void btnchangepwd_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                OldPassword_Match();
                if (ViewState["OldPass"].ToString().Equals("True"))
                {
                    try
                    {
                        DBConnectionClass   conPassUpdate  = new DBConnectionClass();
                        List <SqlParameter> sqlpPassUpdate = new List <SqlParameter>();
                        sqlpPassUpdate.Add(new SqlParameter("@UserId", Session["LoginUserId"].ToString()));
                        sqlpPassUpdate.Add(new SqlParameter("@OldUserPassword", conPassUpdate.HashPassword(txtoldpwd.Text.ToString())));
                        sqlpPassUpdate.Add(new SqlParameter("@NewUserPassword", conPassUpdate.HashPassword(txtnewpwd.Text.ToString())));

                        bool i = conPassUpdate.SaveData(sqlpPassUpdate, "UpdatePassword");

                        if (i == true)
                        {
                            this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "swal('Successful!',' Password Update Successfully.', 'success');", true);
                            ViewState["OldPass"] = null;
                        }
                    }
                    catch (Exception) { ViewState["OldPass"] = null; }
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "swal('Warning!',' Password Not Updated.', 'warning');", true);

                    ViewState["OldPass"] = null;
                }
            }
        }
Esempio n. 6
0
        // Get area list
        public List <AreaList> GetAreaList(string areaOf)
        {
            List <AreaList> areaLists = new List <AreaList>();

            try
            {
                DBConnectionClass dBConnection = new DBConnectionClass
                {
                    DatabaseName = "StayInEatIn"
                };

                string Col_Area = areaOf;

                if (dBConnection.IsConnect())
                {
                    var            cmd    = new SqlCommand("SIEI_AREA_GetAreaList", dBConnection.Connection);
                    SqlDataAdapter reader = new SqlDataAdapter(cmd);
                    reader.SelectCommand.CommandType = CommandType.StoredProcedure;
                    reader.SelectCommand.Parameters.AddWithValue("@H_T", Col_Area);



                    reader.SelectCommand = cmd;
                    if (reader != null)
                    {
                        DataTable dt = new DataTable();
                        reader.Fill(dt);

                        foreach (DataRow areas in dt.Rows)
                        {
                            AreaList d = new AreaList();
                            d.Area = (string)areas["Area"];
                            areaLists.Add(d);
                        }
                        return(areaLists);
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("Empty Reader");
                    }

                    dBConnection.Close();
                    return(null);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Conn Failed");
                    return(null);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Unsuccessful Query Excution");
                throw e;
            }
            finally
            {
            }
        }
Esempio n. 7
0
        // Save hostel details
        public void SaveHostelDetails(HostelDetails hostelDetails)
        {
            try
            {
                DBConnectionClass dBConnection = new DBConnectionClass
                {
                    DatabaseName = "StayInEatIn"
                };

                string Col_Name          = hostelDetails.Name;
                string Col_Area          = hostelDetails.Area;
                string Col_Address       = hostelDetails.Address;
                string Col_City          = hostelDetails.City;
                string Col_Pin           = hostelDetails.Pin;
                string Col_Mobile1       = hostelDetails.Mobile1;
                string Col_Mobile2       = hostelDetails.Mobile2;
                string Col_RoomFor       = hostelDetails.RoomFor;
                int    Col_Type          = hostelDetails.Type;
                int    Col_Furnished     = hostelDetails.Furnished;
                string Col_StartingPrice = hostelDetails.StartingPrice;
                int    Col_FoodAvail     = hostelDetails.FoodAvail;

                if (dBConnection.IsConnect())
                {
                    var cmd = new SqlCommand("SIEI_HOST_SaveHostelDetails", dBConnection.Connection);
                    cmd.Parameters.AddWithValue("@Col_Name", Col_Name);
                    cmd.Parameters.AddWithValue("@Col_Area", Col_Area);
                    cmd.Parameters.AddWithValue("@Col_Address", Col_Address);
                    cmd.Parameters.AddWithValue("@Col_City", Col_City);
                    cmd.Parameters.AddWithValue("@Col_Pin", Col_Pin);
                    cmd.Parameters.AddWithValue("@Col_Mobile1", Col_Mobile1);
                    cmd.Parameters.AddWithValue("@Col_Mobile2", Col_Mobile2);
                    cmd.Parameters.AddWithValue("@Col_RoomFor", Col_RoomFor);
                    cmd.Parameters.AddWithValue("@Col_Furnished", Col_Furnished);
                    cmd.Parameters.AddWithValue("@Col_StartingPrice", Col_StartingPrice);
                    cmd.Parameters.AddWithValue("@Col_FoodAvail", Col_FoodAvail);

                    string value = cmd.ExecuteNonQuery().ToString();

                    dBConnection.Close();
                    //return value;
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Conn Failed");
                    //return null;
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Unsuccessful Query Excution");
                throw e;
            }
        }
Esempio n. 8
0
        protected void ClearHistory()
        {
            DBConnectionClass dbCon = new DBConnectionClass();

            dbCon.EmptyUpdateId("editId");
            dbCon.EmptyUpdateId("imageAddId");
            Response.Cookies["LoginSessionId"].Expires    = DateTime.Now.AddDays(-1);
            Response.Cookies["CookieLoginUserId"].Expires = DateTime.Now.AddDays(-1);
            Session.RemoveAll();
            Session.Clear();
            Session.Abandon();
            Response.Redirect("../User/Login.aspx");
        }
Esempio n. 9
0
        /// <summary>
        /// Authenticate user credentials.
        /// Compares the user entered credentials against
        /// the local database user table.
        /// Inherited from the IUserValidator interface
        /// ///Christopher K. Dierolf
        /// </summary>
        /// <returns>Returns true if credentials are authenticated. False if failed</returns>
        public bool AuthenticateUser(string userName, string password)
        {
            DBConnectionClass db = new DBConnectionClass();

            if (db.FindLoginData(userName, password))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
 public bool ValidateUserAccount(string email, string username)
 {
     DBConnectionClass db = new DBConnectionClass();
     {
         if (db.DoesUserExist(email, username))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        DBConnectionClass dbclass = new DBConnectionClass();

        dbclass.conn.Open();
        OracleCommand cmd = new OracleCommand();

        cmd.Connection  = dbclass.conn;
        cmd.CommandText = "select COURSE_NAME from course";
        cmd.CommandType = System.Data.CommandType.Text;
        OracleDataReader dr = cmd.ExecuteReader();

        dr.Read();
        Label1.Text = dr.GetString(0);
        dbclass.conn.Close();
    }
Esempio n. 12
0
    public void fillTable()
    {
        DBConnectionClass sp3  = new DBConnectionClass("displayData");
        string            sqlP = "select a.login_id,a.user_type,a.first_name,a.last_name,a.email_id,a.active_flag,a.mobile_no, c.description " +
                                 " from LAS_Login a, LAS_lawyer_profile b " +
                                 " Left Join LAS_specialization c On c.specialization_id = b.specialization_id " +
                                 " where a.login_id = b.login_id order by a.create_date desc   ";

        DataTable dt = new DataTable();

        dt = sp3.DisplayDataQuery(sqlP).Tables[0];
        StringBuilder html = new StringBuilder();

        foreach (DataRow dr in dt.Rows)
        {
            if (dr["user_type"].ToString() != "ADMIN")
            {
                html.Append("<tr>");
                html.Append("<td>" + dr["first_name"] + " " + dr["last_name"] + "</td>");
                html.Append("<td>" + dr["email_id"] + "</td>");
                html.Append("<td>" + dr["mobile_no"] + "</td>");
                html.Append("<td>" + dr["description"] + "</td>");
                if (dr["active_flag"].ToString() == "0")
                {
                    html.Append("<td align='center' width='4%'>Active</td>");
                }
                else
                {
                    html.Append("<td align='center' width='4%'>Deactive</td>");
                }

                if (dr["active_flag"].ToString() == "0")
                {
                    html.Append("<td align='center' width='4%'><a href='Javascript:deletefunction(1," + dr["login_id"].ToString() + ");'>Deactive</a></td>");
                }
                else
                {
                    html.Append("<td align='center' width='4%'><a href='Javascript:deletefunction(0," + dr["login_id"].ToString() + ");'>Active</a></td>");
                }
                html.Append("</tr>");
            }
        }
        displayLawyer.InnerHtml = html.ToString();
    }
Esempio n. 13
0
        public static List <string> SearchDestination(string prefixText)
        {
            DBConnectionClass dbClass   = new DBConnectionClass();
            List <string>     locations = new List <string>();
            DataTable         dt        = new DataTable();

            dt = dbClass.DisplayDataParam(" area a, city b, country c ", " " +
                                          " TOP 10 a.areaname,b.cityname,c.countryname ", " a.cityid=b.cityid and b.countryid=c.countryid " +
                                          " and (a.areaname like '%" + prefixText + "%' " +
                                          " or b.cityname like '%" + prefixText + "%' " +
                                          " or c.countryname like '%" + prefixText + "%')" +
                                          " order by a.areaname, b.cityname, c.countryname ");
            foreach (DataRow dr in dt.Rows)
            {
                locations.Add(dr["areaname"].ToString() + ", " + dr["cityname"].ToString() + ", " + dr["countryname"].ToString());
            }

            return(locations);
        }
    public void fillTable()
    {
        DBConnectionClass sp3  = new DBConnectionClass("displayData");
        string            sqlP = "select * from LAS_country ";

        DataTable dt = new DataTable();

        dt = sp3.DisplayDataQuery(sqlP).Tables[0];
        StringBuilder html = new StringBuilder();

        foreach (DataRow dr in dt.Rows)
        {
            html.Append("<tr>");
            html.Append("<td>" + dr["country_name"] + "</td>");
            html.Append("<td align='center' width='4%'><a href='country.aspx?eid=" + dr["country_id"].ToString() + "'><i class='fa fa-1x fa-pencil'></i></a></td>");
            html.Append("<td align='center' width='4%'><a href='Javascript:deletefunction(" + dr["country_id"].ToString() + ");'><i class='fa fa-1x fa-trash-o'></i></a></td>");
            html.Append("</tr>");
        }
        displayCountry.InnerHtml = html.ToString();
    }
    public static string Deletecity(string eid)
    {
        try
        {
            DBConnectionClass con = new DBConnectionClass();

            bool i = con.boolInsertData("delete from LAS_city where city_id='" + eid.ToString().Trim() + "'");
            if (i == true)
            {
                return("true");
            }
            else
            {
                return("false");
            }
        }
        catch (Exception)
        {
            return("false");
        }
    }
    public static string Deleteappointment(string eid)
    {
        try
        {
            DBConnectionClass con = new DBConnectionClass();

            bool i = con.boolInsertData("update LAS_appointment set a_status='1' where appointment_id='" + eid.ToString().Trim() + "'");
            if (i == true)
            {
                return("true");
            }
            else
            {
                return("false");
            }
        }
        catch (Exception)
        {
            return("false");
        }
    }
Esempio n. 17
0
    protected void txtService_TextChanged(object sender, EventArgs e)
    {
        int i = 0;
        DBConnectionClass conD = new DBConnectionClass("CheckDuplicateData");
        //List<SqlParameter> sqlp = new List<SqlParameter>();
        //sqlp.Clear();
        //sqlp.Add(new SqlParameter("@TableName", "LAS_service"));
        //sqlp.Add(new SqlParameter("@FieldName", "description"));
        //sqlp.Add(new SqlParameter("@FieldValue", txtService.Text.ToString().Trim()));
        string sqlStr = "";

        sqlStr = "select * from LAS_service where description='" + txtService.Text.ToString().Trim() + "' and login_id='" + Session["Slogin_id"].ToString() + "' ";

        if (btnSubmit.Text == "Update")
        {
            sqlStr = sqlStr + " and  service_id!='" + ViewState["id"].ToString() + "' ";
        }
        i = conD.CheckDuplicateByQuery(sqlStr);

        if (i >= 1)
        {
            if (btnSubmit.Text == "Update")
            {
                lblDErrorMsg.Text = "* This service exist.";
            }
            else
            {
                lblDErrorMsg.Text = "";
            }
            if (btnSubmit.Text == "Submit")
            {
                lblDErrorMsg.Text = "* This service exist.";
            }
        }
        else
        {
            lblDErrorMsg.Text = "";
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (lblEmail_V.Text == "")
        {
            DBConnectionClass   con  = new DBConnectionClass("createNewUser");
            List <SqlParameter> sqlp = new List <SqlParameter>();
            sqlp.Add(new SqlParameter("@first_name", txtFName.Text.ToString().Trim()));
            sqlp.Add(new SqlParameter("@last_name", txtLName.Text.ToString().Trim()));
            sqlp.Add(new SqlParameter("@email_id", txtEmail.Text.ToString().Trim()));
            sqlp.Add(new SqlParameter("@mobile_no", txtMobile.Text.ToString().Trim()));
            sqlp.Add(new SqlParameter("@password", con.HashId(txtPassword.Text.ToString())));
            sqlp.Add(new SqlParameter("@user_type", cmbUserType.SelectedValue.ToString()));

            if (con.SaveData(sqlp) == true)
            {
                Response.Redirect("login.aspx");
            }
            else
            {
            }
        }
    }
    public void fillTable()
    {
        DBConnectionClass sp3  = new DBConnectionClass("displayData");
        string            sqlP = "select * from LAS_office where login_id='" + Session["Slogin_id"].ToString() + "'";

        DataTable dt = new DataTable();

        dt = sp3.DisplayDataQuery(sqlP).Tables[0];
        StringBuilder html = new StringBuilder();

        foreach (DataRow dr in dt.Rows)
        {
            html.Append("<tr>");
            html.Append("<td>" + dr["office_name"] + "</td>");
            html.Append("<td>" + dr["address"] + "</td>");
            html.Append("<td>" + dr["email_id"] + "</td>");
            html.Append("<td align='center' width='4%'><a href='office_info.aspx?eid=" + dr["office_id"].ToString() + "'><i class='fa fa-1x fa-pencil'></i></a></td>");
            html.Append("<td align='center' width='4%'><a href='Javascript:deletefunction(" + dr["office_id"].ToString() + ");'><i class='fa fa-1x fa-trash-o'></i></a></td>");
            html.Append("</tr>");
        }
        displayOffice.InnerHtml = html.ToString();
    }
Esempio n. 20
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DBConnectionClass   conD = new DBConnectionClass("creteNewUserAndCompany");
        List <SqlParameter> sqlp = new List <SqlParameter>();

        sqlp.Clear();
        sqlp.Add(new SqlParameter("@company_name", txtCompanyName.Text.ToString().Trim()));
        sqlp.Add(new SqlParameter("@company_address_l1", txtCompanyAddressL1.Text.ToString().Trim()));
        sqlp.Add(new SqlParameter("@company_address_l2", txtCompanyAddressL2.Text.ToString().Trim()));
        sqlp.Add(new SqlParameter("@company_address_l3", txtCompanyAddressL3.Text.ToString().Trim()));
        sqlp.Add(new SqlParameter("@company_phone", txtCompanyPhone.Text.ToString().Trim()));
        sqlp.Add(new SqlParameter("@password", dbCommon.HashId(txtPassword.Text.ToString().Trim())));
        sqlp.Add(new SqlParameter("@fname", txtfname.Text.ToString().Trim()));
        sqlp.Add(new SqlParameter("@lname", txtlname.Text.ToString().Trim()));
        sqlp.Add(new SqlParameter("@email", txtEmail.Text.ToString().Trim()));
        sqlp.Add(new SqlParameter("@mobile", txtMobile.Text.ToString().Trim()));
        bool i = conD.SaveData(sqlp);

        if (i == true)
        {
            Response.Redirect("login.aspx");
        }
    }
Esempio n. 21
0
        // Dev Decoste
        private void btnEditMovie_Click(object sender, RoutedEventArgs e)
        {
            movie.MovieTitle  = apiTitleText.Text;
            movie.ReleaseYear = apiYearText.Text;
            movie.Actors      = apiActorstext.Text;
            movie.RunTime     = apiRunTimeText.Text;
            movie.Plot        = apiPlotText.Text;
            movie.Genre       = apiGenreText.Text;
            movie.Awards      = apiAwards.Text;
            movie.Director    = apiDirector.Text;

            DBConnectionClass db = new DBConnectionClass();

            if (db.UpdateMovie(movie) == true)
            {
                MessageBox.Show("Movie updated!");
                this.Close();
            }
            else
            {
                MessageBox.Show("Something went wrong");
            }
        }
        protected void btnchangepwd_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                OldPassword_Match();
                if (ViewState["OldPass"].ToString().Equals("True"))
                {
                    try
                    {
                        DBConnectionClass   conPassUpdate  = new DBConnectionClass();
                        List <SqlParameter> sqlpPassUpdate = new List <SqlParameter>();
                        sqlpPassUpdate.Add(new SqlParameter("@UserId", Session["LoginUserId"].ToString()));
                        sqlpPassUpdate.Add(new SqlParameter("@OldUserPassword", conPassUpdate.HashPassword(txtoldpwd.Text.ToString())));
                        sqlpPassUpdate.Add(new SqlParameter("@NewUserPassword", conPassUpdate.HashPassword(txtnewpwd.Text.ToString())));

                        bool i = conPassUpdate.SaveData(sqlpPassUpdate, "UpdatePassword");

                        if (i == true)
                        {
                            Response.Write("<script>");
                            Response.Write("alert('Password Updated Successfully.');");
                            Response.Write("</script>");
                            ViewState["OldPass"] = null;
                        }
                    }
                    catch (Exception) { ViewState["OldPass"] = null; }
                }
                else
                {
                    Response.Write("<script>");
                    Response.Write("alert('Password Not Updated;');");
                    Response.Write("</script>");
                    ViewState["OldPass"] = null;
                }
            }
        }
        protected void OldPassword_Match()
        {
            try
            {
                DBConnectionClass   conCheckDuplicate = new DBConnectionClass();
                List <SqlParameter> sqlp = new List <SqlParameter>();
                sqlp.Add(new SqlParameter("@UserId", Session["LoginUserId"].ToString()));
                sqlp.Add(new SqlParameter("@UserPassword", conCheckDuplicate.HashPassword(txtoldpwd.Text.ToString())));

                int i = conCheckDuplicate.CheckDuplicate(sqlp, "MatchOldPassword");
                if (i == 0)
                {
                    ViewState["OldPass"] = "******";
                    lblErrorMsg.Text     = "*Old Password Does Not Match.";
                    txtoldpwd.Focus();
                }
                else
                {
                    lblErrorMsg.Text     = "";
                    ViewState["OldPass"] = "******";
                }
            }
            catch (Exception) { }
        }
        // Dev Decoste
        /// <summary>
        /// Submit the movie data to the database.
        /// Requires at least a title.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DBConnectionClass db = new DBConnectionClass();

            if (txtMovieTitle == null || txtMovieTitle.Text == "")
            {
                MessageBox.Show("No movie data to add. Ensure there is at least a title.");
            }
            else
            {
                Movie movie = new Movie(txtMovieTitle.Text, txtReleaseYear.Text, txtPlot.Text, txtActors.Text, txtGenre.Text, txtRunTime.Text, txtAwards.Text, txtDirector.Text);
                if (db.AddMovie(movie))
                {
                    string message = "The movie has been added!";
                    MessageBox.Show(message);
                    this.Close();
                }
                else
                {
                    string message = "There was an error. Please try again!";
                    MessageBox.Show(message);
                }
            }
        }
Esempio n. 25
0
        // Christopher Dierolf
        // Method to refresh the movie list.
        private void RefreshMovies()
        {
            DBConnectionClass db = new DBConnectionClass();

            movies = db.GetMovies(); // Get the movies from the database.
        }
Esempio n. 26
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (lblDErrorMsg.Text != "")
        {
        }
        else
        {
            Byte[] bytes = null;
            String ext   = imgCategoryImage.PostedFile.ContentType;

            try
            {
                if (ext.ToLower() == "image/jpeg" || ext.ToLower() == "image/jpg" || ext.ToLower() == "image/png")
                {
                    if (imgCategoryImage.PostedFile.ContentLength > 0)
                    {
                        Stream       fs = imgCategoryImage.PostedFile.InputStream;
                        BinaryReader br = new BinaryReader(fs);
                        bytes = br.ReadBytes((Int32)fs.Length);
                    }
                }
                else
                if (Session["imageupdate"] != null)
                {
                    bytes = (Byte[])Session["imageupdate"];
                }
                else
                {
                    bytes = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
                }

                List <SqlParameter> sqlp = new List <SqlParameter>();
                sqlp.Add(new SqlParameter("@profile_src", bytes));
                sqlp.Add(new SqlParameter("@password", dbCommon.HashId("admin")));
                sqlp.Add(new SqlParameter("@fname", txtFName.Text.ToString().Trim()));
                sqlp.Add(new SqlParameter("@lname", txtLName.Text.ToString().Trim()));
                sqlp.Add(new SqlParameter("@email", txtEmail.Text.ToString().Trim()));
                sqlp.Add(new SqlParameter("@designation_id", cmbItemtype.SelectedValue.ToString().Trim()));
                sqlp.Add(new SqlParameter("@address", txtAddress.Text.ToString().Trim()));

                if (btnSubmit.Text == "Submit")
                {
                    DBConnectionClass dbSp = new DBConnectionClass("insertAdminUser");

                    if (dbSp.SaveData(sqlp) == true)
                    {
                        Response.Redirect("register_user.aspx");
                    }
                }
                else
                {
                    DBConnectionClass dbSp = new DBConnectionClass("updateAdminUser");
                    sqlp.Add(new SqlParameter("@login_id", ViewState["id"].ToString()));
                    if (dbSp.SaveData(sqlp) == true)
                    {
                        Response.Redirect("register_user.aspx");
                    }
                }
            }
            catch (Exception) { }
        }
    }
Esempio n. 27
0
        protected void ValidateUser()
        {
            DBConnectionClass   conLoginUser = new DBConnectionClass();
            string              ipv4 = "", ipv6 = "";
            List <SqlParameter> sqlp = new List <SqlParameter>();

            sqlp.Add(new SqlParameter("@UserLoginName", txtLoginId.Text.ToString()));
            sqlp.Add(new SqlParameter("@Password", conLoginUser.HashPassword(txtPassword.Text.ToString())));

            List <SqlParameter> sqlULogin = new List <SqlParameter>();

            string result = conLoginUser.checkUserLogin(sqlp);

            string status          = "";
            string browsertype     = Request.Browser.Type;
            string browsername     = Request.Browser.Browser;
            string browserversion  = Request.Browser.Version;
            string browserplatform = Request.Browser.Platform;

            string osname = "", osversion = "";

            try
            {
                OperatingSystem os = Environment.OSVersion;
                osname    = os.ToString();
                osversion = os.Version.ToString();
            }
            catch (Exception) { }

            try
            {
                if (Dns.GetHostAddresses(Dns.GetHostName()).Length > 0)
                {
                    ipv6 = Dns.GetHostAddresses(Dns.GetHostName())[0].ToString();
                }
                ipv4 = GetLocalIPv4(NetworkInterfaceType.Ethernet).ToString();
            }
            catch (Exception) { }

            switch (result)
            {
            case "InValidId":
                sqlULogin.Clear();
                sqlULogin.Add(new SqlParameter("@IPAddress", ipv6));
                sqlULogin.Add(new SqlParameter("@UnBrowser", browsername));
                sqlULogin.Add(new SqlParameter("@UnOS", osname));
                sqlULogin.Add(new SqlParameter("@BType", browsertype));
                sqlULogin.Add(new SqlParameter("@BVersion", browserversion));
                sqlULogin.Add(new SqlParameter("@BPlateForm", browserplatform));
                sqlULogin.Add(new SqlParameter("@OSVersion", osversion));
                sqlULogin.Add(new SqlParameter("@IUserName", txtLoginId.Text));
                sqlULogin.Add(new SqlParameter("@IPV4", ipv4));
                conLoginUser.SaveData(sqlULogin, "AddUnknownUserLogin");
                status = "Invalid User Name Or Password.";
                break;

            case "Guest":
                status = "You need to register with use to login.";
                break;

            case "InPass":
                sqlULogin.Clear();
                sqlULogin.Add(new SqlParameter("@emailid", txtLoginId.Text.ToString()));
                sqlULogin.Add(new SqlParameter("@IPAddress", ipv6));
                sqlULogin.Add(new SqlParameter("@TBrowser", browsername));
                sqlULogin.Add(new SqlParameter("@BOS", osname));
                sqlULogin.Add(new SqlParameter("@BType", browsertype));
                sqlULogin.Add(new SqlParameter("@BVersion", browserversion));
                sqlULogin.Add(new SqlParameter("@BPlateForm", browserplatform));
                sqlULogin.Add(new SqlParameter("@OSVersion", osversion));
                sqlULogin.Add(new SqlParameter("@IPV4", ipv4));
                conLoginUser.SaveData(sqlULogin, "InvalidLoginAdd");
                status = "Invalid User Name Or Password.";
                break;

            case "InActive":
                sqlULogin.Clear();
                sqlULogin.Add(new SqlParameter("@emailid", txtLoginId.Text.ToString()));
                sqlULogin.Add(new SqlParameter("@UserPassword", conLoginUser.HashPassword(txtPassword.Text.ToString())));
                DataTable dtUserIn = new DataTable();
                dtUserIn = conLoginUser.DisplayData(sqlULogin, "MstUserView").Tables[0];
                string userId = "";
                foreach (DataRow drUserIn in dtUserIn.Rows)
                {
                    userId = drUserIn["UserId"].ToString();
                    if (drUserIn["designationid"].ToString() == "4")
                    {
                        status = "Your account is De-Activate please check you email and confirm your Email-id.";
                    }
                    else
                    {
                        status = "Your account is De-Active. Contect Admin.";
                    }
                    break;
                }
                sqlULogin.Clear();
                sqlULogin.Add(new SqlParameter("@UserId", userId));
                sqlULogin.Add(new SqlParameter("@IPAddress", ipv6));
                sqlULogin.Add(new SqlParameter("@TBrowser", browsername));
                sqlULogin.Add(new SqlParameter("@BType", browsertype));
                sqlULogin.Add(new SqlParameter("@BVersion", browserversion));
                sqlULogin.Add(new SqlParameter("@BPlateForm", browserplatform));
                sqlULogin.Add(new SqlParameter("@OSVersion", osversion));
                sqlULogin.Add(new SqlParameter("@BOS", osname));
                sqlULogin.Add(new SqlParameter("@IPV4", ipv4));
                sqlULogin.Add(new SqlParameter("@LoginType", "I"));
                conLoginUser.SaveData(sqlULogin, "TraceLoginAdd");
                break;

            case "Valid":

                Configuration       config  = WebConfigurationManager.OpenWebConfiguration("~/Web.Config");
                SessionStateSection section = (SessionStateSection)config.GetSection("system.web/sessionState");
                Session.Timeout = 60 * 60;

                sqlULogin.Clear();
                sqlULogin.Add(new SqlParameter("@emailid", txtLoginId.Text.ToString()));
                sqlULogin.Add(new SqlParameter("@UserPassword", conLoginUser.HashPassword(txtPassword.Text.ToString())));
                DataTable dtUserInfo = new DataTable();
                dtUserInfo = conLoginUser.DisplayData(sqlULogin, "MstUserView").Tables[0];
                foreach (DataRow drUserInfo in dtUserInfo.Rows)
                {
                    Session["LoginUserName"]        = drUserInfo["user_fname"].ToString() + " " + drUserInfo["user_lname"].ToString();
                    Session["LoginUserId"]          = drUserInfo["UserId"].ToString();
                    Session["LoginUserRole"]        = drUserInfo["usertype"].ToString();
                    Session["LoginUserDesignation"] = drUserInfo["designationid"].ToString();

                    Response.Cookies["CookieLoginUserId"].Value   = drUserInfo["UserId"].ToString();
                    Response.Cookies["CookieLoginUserId"].Expires = DateTime.Now.AddDays(30);
                    sqlULogin.Clear();
                    sqlULogin.Add(new SqlParameter("@UserId", drUserInfo["UserId"].ToString()));
                    sqlULogin.Add(new SqlParameter("@IPAddress", ipv6));
                    sqlULogin.Add(new SqlParameter("@TBrowser", browsername));
                    sqlULogin.Add(new SqlParameter("@BType", browsertype));
                    sqlULogin.Add(new SqlParameter("@BVersion", browserversion));
                    sqlULogin.Add(new SqlParameter("@BPlateForm", browserplatform));
                    sqlULogin.Add(new SqlParameter("@OSVersion", osversion));
                    sqlULogin.Add(new SqlParameter("@BOS", osname));
                    sqlULogin.Add(new SqlParameter("@LoginType", "A"));
                    sqlULogin.Add(new SqlParameter("@IPV4", ipv4));

                    conLoginUser.SaveData(sqlULogin, "TraceLoginAdd");

                    Response.Cookies["LoginSessionId"].Value   = conLoginUser.CheckDuplicateByQuery("select MAX(TraceId) from TraceLogin where UserId='" + drUserInfo["UserId"].ToString() + "'").ToString();
                    Response.Cookies["LoginSessionId"].Expires = DateTime.Now.AddDays(30);

                    switch (Session["LoginUserRole"].ToString())
                    {
                    case "ADMIN":
                        Session["LoginUserDesignationType"] = drUserInfo["designation"].ToString();
                        Session["UserImage"] = drUserInfo["profileimg"].ToString();
                        Response.Redirect("../Admin/UserProfile.aspx");
                        break;

                    case "USER":
                        Response.Redirect("../User/HomePage.aspx");
                        break;
                    }
                }
                break;
            }
            spanDisplay.InnerHtml = status;
        }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        Byte[] bytes = null;
        String ext   = imgCategoryImage.PostedFile.ContentType;

        try
        {
            if (ext.ToLower() == "image/jpeg" || ext.ToLower() == "image/jpg" || ext.ToLower() == "image/png")
            {
                if (imgCategoryImage.PostedFile.ContentLength > 0)
                {
                    Stream       fs = imgCategoryImage.PostedFile.InputStream;
                    BinaryReader br = new BinaryReader(fs);
                    bytes = br.ReadBytes((Int32)fs.Length);
                }
            }
            else
            if (Session["imageupdate"] != null)
            {
                bytes = (Byte[])Session["imageupdate"];
            }
            else
            {
                bytes = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
            }

            List <SqlParameter> sqlp = new List <SqlParameter>();
            sqlp.Add(new SqlParameter("@profie_photo", bytes));
            sqlp.Add(new SqlParameter("@description", txtDescription.Text.ToString()));
            sqlp.Add(new SqlParameter("@speci_id", cmbSpec.SelectedValue.ToString()));
            sqlp.Add(new SqlParameter("@license_no", txtLicenseNo.Text.ToString()));
            sqlp.Add(new SqlParameter("@issued_on", DateTime.Parse(txtIssuedOn.Text.ToString()).ToString("yyyy-MM-dd")));
            sqlp.Add(new SqlParameter("@date_of_birth", DateTime.Parse(txtbirthdate.Text.ToString()).ToString("yyyy-MM-dd")));
            sqlp.Add(new SqlParameter("@address_line1", txtaddress1.Text.ToString().Trim()));
            sqlp.Add(new SqlParameter("@address_line2", txtaddress2.Text.ToString().Trim()));
            sqlp.Add(new SqlParameter("@address_line3", txtaddress3.Text.ToString().Trim()));
            sqlp.Add(new SqlParameter("@login_id", Session["Slogin_id"].ToString()));

            if (dbCommon.boolInsertData("Update LAS_login set first_name='" + txtFirstName.Text.ToString().Trim() + "', " +
                                        " last_name='" + txtLastName.Text.ToString().Trim() + "', mobile_no='" + txtMobile.Text.ToString().Trim() + "' " +
                                        " where login_id='" + Session["Slogin_id"].ToString() + "' ") == true)
            {
                if (btnsubmit.Text == "Submit")
                {
                    DBConnectionClass dbSp = new DBConnectionClass("insertLawyerProfile");
                    if (dbSp.SaveData(sqlp) == true)
                    {
                        Response.Redirect("profile.aspx");
                    }
                }
                else
                {
                    DBConnectionClass dbSp = new DBConnectionClass("updateLawyerProfile");

                    if (dbSp.SaveData(sqlp) == true)
                    {
                        Response.Redirect("profile.aspx");
                    }
                }
            }
        }
        catch (Exception) { }
    }