protected void Get_Click(object sender, EventArgs e) // // בדיקה עם המסד נתונים שהסיסמה והיוזר של המשתמש מתאימים
        {
            dbHandler dal  = new dbHandler();
            Hashtable prms = new Hashtable();

            prms.Add("UsernameOrEmail", UserName.Text);
            DataSet ds = dal.GetData("usp_getUserEmail", prms);

            if (ds != null && ds.Tables != null && ds.Tables[0].Rows.Count > 0)
            {
                //UserName or Email recognized
                if (clsMail.SendMail(ds.Tables[0].Rows[0]["Email"].ToString(), "Password Reminder", ""))
                {
                    Response.Write("<script>alert('Your Password will be send to you in a couple of minutes');</script>");
                    Response.Redirect(@"/Login.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Sending your password to your email failed. Please Make sure you have SMTP server on you server and try again');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('The value you have inserted is not an Email not UserName in our dB');</script>");
            }


            //Response.Redirect(@"/ResetPassword.aspx");
        }
Beispiel #2
0
        private void makedatatable(int WordSize, int NumOfMatches)
        {
            DataTable tbl = null;

            //Table data will be taken from Database
            dbHandler dbh  = new dbHandler();
            Hashtable prms = new Hashtable();

            prms.Add("WordSize", WordSize);
            prms.Add("NumOfMatches", NumOfMatches);

            DataSet ds = dbh.GetData("usp_GetAllSets", prms);

            if (ds != null && ds.Tables != null)
            {
                tbl = ds.Tables[0];
            }

            //dbh = null;
            GC.Collect();

            StringBuilder sb_html = new StringBuilder();

            sb_html.Append("<table class='table table - hover'>");

            //Build the column names according to the data came from dB
            sb_html.Append("<thead><tr>");
            foreach (DataColumn col in tbl.Columns)
            {
                sb_html.Append("<th>" + col.ColumnName + "</th>");
            }

            sb_html.Append("<th>Operation</th>");
            sb_html.Append("</tr></thead>");

            if (tbl != null)
            {
                //data has been found --> show table to client
                //Build the rows data according to the data came from dB
                sb_html.Append("<tbody>");
                foreach (DataRow row in tbl.Rows)
                {
                    sb_html.Append("<tr>");
                    foreach (DataColumn col in tbl.Columns)
                    {
                        if (col.ColumnName != "ViewFile")
                        {
                            sb_html.Append("<td>" + row[col.ColumnName].ToString() + "</td>");
                        }
                        else
                        {
                            string str = "onclick=\"viewFileData('" + row[col.ColumnName].ToString().Replace(@"\", "\\\\") + "');\"";
                            sb_html.Append("<td><button type='button' class='btn btn - info btn - lg' data-toggle='modal' " + str + " data -target='#myModal'>View</button></td>");
                        }
                    }
                    string deleteClick = "onclick=\"deleteSet(" + row["Set_Id"].ToString() + ");\"";
                    sb_html.Append("<td><button type='button' class='btn btn - info btn - lg'" + deleteClick + "'>Delete Set</button></td>");
                    sb_html.Append("</tr>");
                }
                sb_html.Append("</tbody>");
            }
            sb_html.Append("</table>");
            tableContainer.Text = sb_html.ToString();
        }