Ejemplo n.º 1
0
        protected void bt_submit_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                bool Exsict = CheackUserName();
                if (Exsict == false)
                {
                    Random random = new Random();
                    activatoncode = random.Next(1001, 9999).ToString();
                    try
                    {
                        string Encryptedpass = FormsAuthentication.HashPasswordForStoringInConfigFile(tb_password.Text, "SHA1");
                        var    dateAndTime   = DateTime.Now;
                        var    date          = dateAndTime.Date;
                        date.ToString("dd/MM/yyyy");
                        var Dblist = new List <DbListAdapter>();
                        Dblist.Add(new DbListAdapter("CityID", ddl_city.SelectedValue));
                        Dblist.Add(new DbListAdapter("NameGarga", tb_namebisance.Text));
                        Dblist.Add(new DbListAdapter("pricePerHour", pricePerHour.Text));
                        //Dblist.Add(new DbListAdapter("UserName", tb_user.Text));
                        Dblist.Add(new DbListAdapter("Password", Encryptedpass));
                        Dblist.Add(new DbListAdapter("Address", tb_Address.Text));
                        Dblist.Add(new DbListAdapter("FIRST_NAME", tb_Fname.Text));
                        Dblist.Add(new DbListAdapter("LAST_NAME", tb_Lname.Text));
                        Dblist.Add(new DbListAdapter("Phone", tb_phone.Text));
                        Dblist.Add(new DbListAdapter("Email", tb_email.Text));
                        Dblist.Add(new DbListAdapter("Activecode", activatoncode));
                        //Dblist.Add(new DbListAdapter("JoinDate", date.ToString()));
                        bool garageid = Garge.create_new_garage(Dblist);
                        if (garageid)
                        {
                            sendemail();
                            //Session["user"] = tb_Fname.Text;
                            //Session["user"] = tb_user.Text;
                            Session["email"] = tb_email.Text;
                            Response.Redirect("~/emailverification.aspx?tb_email=" + tb_email.Text);
                        }
                    }
                    catch (Exception ex)
                    {
                        Lblsend.Text = ex.Message;
                    }
                    finally
                    {
                    }
                }
                else
                {
                    Lblsend.Text = "נראה שחשבון מייל זה כבר נמצא בשימוש!";
                    pricePerHour.Focus();
                }
            }

            else
            {
                Label1.Text = "חובה למלאות שדות חובה* !";
            }
        }