protected void btnVerify_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["rurl"] == "notVerifiedVendor")
     {
         verification('v');
     }
     else if (Request.QueryString["rurl"] == "notVerifiedCust")
     {
         verification('c');
     }
     else
     {
         if (access.checkEmail(email.Text, 'c'))
         {
             verification('c');
         }
         else if (access.checkEmail(email.Text, 'v'))
         {
             verification('v');
         }
         else
         {
             ErrorMessage.ForeColor = Color.Red;
             ErrorMessage.Text      = "Incorrect Email";
         }
     }
 }
Example #2
0
        protected void SignUpSuccessful(object sender, EventArgs e)
        {
            if (access.checkEmail(custEmail.Text, 'c'))
            {
                CEmailErrorMessage.Text      = "Email address not available.";
                CEmailErrorMessage.ForeColor = Color.Red;
            }
            else if (access.checkEmail(custEmail.Text, 'v'))
            {
                CEmailErrorMessage.Text      = "You have already signed as brand.";
                CEmailErrorMessage.ForeColor = Color.Red;
            }
            else
            {
                string randomVCode = access.genCode();
                Accessible.sendMsg(custEmail.Text, custName.Text, custPassword.Text, randomVCode);

                using (SqlConnection con = new SqlConnection(CS))
                {
                    con.Open();

                    SqlCommand cmd = new SqlCommand("INSERT INTO CustomerDetails(CustomerName,CustomerAddress,CustomerPhoneNo,CustomerEmailAddress,CustomerPassword,CustomerCityId,VerifiedEmail,VerificationCode) VALUES(@CustomerName,@CustomerAddress,@CustomerPhoneNo,@CustomerEmailAddress,@CustomerPassword,@CustomerCityId,@VerifiedEmail,@VerificationCode); SELECT SCOPE_IDENTITY()", con);
                    cmd.Parameters.AddWithValue("@CustomerName", custName.Text);
                    cmd.Parameters.AddWithValue("@CustomerAddress", custLocation.Text);
                    cmd.Parameters.AddWithValue("@CustomerPhoneNo", custphoneNum.Text);
                    cmd.Parameters.AddWithValue("@CustomerEmailAddress", custEmail.Text);
                    cmd.Parameters.AddWithValue("@CustomerPassword", custPassword.Text);
                    cmd.Parameters.AddWithValue("@CustomerCityId", custCity.SelectedItem.Value);
                    cmd.Parameters.AddWithValue("@VerifiedEmail", 0);
                    cmd.Parameters.AddWithValue("@VerificationCode", randomVCode);

                    cmd.ExecuteNonQuery();


                    Response.Redirect("/Activation.aspx?rurl=notVerifiedCust");
                }
            }
        }
Example #3
0
        protected void SignUpSuccessful(object sender, EventArgs e)
        {
            // Read the file and convert it to Byte Array
            string filePath    = VendorFileUpload.PostedFile.FileName;
            string filename    = Path.GetFileName(filePath);
            string ext         = Path.GetExtension(filename);
            string contenttype = String.Empty;

            //Set the contenttype based on File Extension
            switch (ext)
            {
            case ".jpg":
                contenttype = "image/jpg";
                break;

            case ".png":
                contenttype = "image/png";
                break;

            case ".gif":
                contenttype = "image/gif";
                break;

            case ".pdf":
                contenttype = "application/pdf";
                break;

            default:
            {
                VUploadError.Text      = "Invalid Image";
                VUploadError.ForeColor = Color.Red;
                break;
            }
            }



            if (access.checkEmail(vendorEmail.Text, 'v'))
            {
                VEmailErrorMessage.Text      = "Email address not available.";
                VEmailErrorMessage.ForeColor = Color.Red;
            }
            else if (access.checkEmail(vendorEmail.Text, 'c'))
            {
                VEmailErrorMessage.Text      = "You have already signed in as Customer";
                VEmailErrorMessage.ForeColor = Color.Red;
            }
            else if (access.checkBrandName(vendorName.Text))
            {
                VNameErrorMessage.Text      = "This brand name has already been registered.";
                VNameErrorMessage.ForeColor = Color.Red;
            }
            else if (contenttype != String.Empty)
            {
                Stream       fs    = VendorFileUpload.PostedFile.InputStream;
                BinaryReader br    = new BinaryReader(fs);
                Byte[]       bytes = br.ReadBytes((Int32)fs.Length);

                string randomVCode = access.genCode();
                Accessible.sendMsg(vendorEmail.Text, vendorName.Text, vendorPassword.Text, randomVCode);


                String CS = ConfigurationManager.ConnectionStrings["BrandBoxDatabaseConnectionString"].ConnectionString.ToString();
                using (SqlConnection con = new SqlConnection(CS))
                {
                    con.Open();

                    SqlCommand cmd = new SqlCommand("INSERT INTO VendorPayment(VTotalPayment,VProfit) VALUES(@VTotalPayment,@VProfit); SELECT SCOPE_IDENTITY()", con);
                    cmd.Parameters.AddWithValue("@VTotalPayment", 0);
                    cmd.Parameters.AddWithValue("@VProfit", 0);

                    int VendorPaymentFK = Convert.ToInt32(cmd.ExecuteScalar());


                    SqlCommand cmd2 = new SqlCommand("INSERT INTO Vendor(VendorEmail, VendorPassword, VendorLocation, VendorPhoneNo,VendorName,VendorDetails,VPaymentNo,ImageContentType,ImageData,VerifiedEmail,VerificationCode) VALUES(@VendorEmail,@VendorPassword,@VendorLocation,@VendorPhoneNo,@VendorName,@VendorDetails,@VPaymentNo,@ImageContentType,@ImageData,@VerifiedEmail,@VerificationCode)", con);
                    cmd2.Parameters.AddWithValue("@VendorEmail", vendorEmail.Text);
                    cmd2.Parameters.AddWithValue("@VendorPassword", vendorPassword.Text);
                    cmd2.Parameters.AddWithValue("@VendorLocation", vendorLocation.Text);
                    cmd2.Parameters.AddWithValue("@VendorPhoneNo", vendorphoneNum.Text);
                    cmd2.Parameters.AddWithValue("@VendorName", vendorName.Text);
                    cmd2.Parameters.AddWithValue("@VendorDetails", vendorDetails.Text);
                    cmd2.Parameters.AddWithValue("@VPaymentNo", VendorPaymentFK);
                    cmd2.Parameters.Add("@ImageContentType", SqlDbType.VarChar).Value = contenttype;
                    cmd2.Parameters.Add("@ImageData", SqlDbType.Binary).Value         = bytes;
                    cmd2.Parameters.AddWithValue("@VerifiedEmail", 0);
                    cmd2.Parameters.AddWithValue("@VerificationCode", randomVCode);
                    cmd2.ExecuteNonQuery();



                    Response.Redirect("/Activation.aspx?rurl=notVerifiedVendor");
                }
            }
        }