Beispiel #1
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        objloginbal.UserName         = txtusername.Text;
        objloginbal.SecurityQuestion = txtsecurityquestion.Text;
        objloginbal.SecureAnswer     = txtsecureanswer.Text;
        objloginbal.UserRole         = drpuserrole.SelectedValue;
        objloginbal.CreateDate       = Convert.ToDateTime(txtcreatedate.Text);
        objloginbal.AccountStatus    = drpaccountstatus.SelectedValue;

        if (btnsubmit.Text == "Submit")
        {
            objloginbal.Password = txtpassword.Text;

            objlogindal.insertLogin(objloginbal);
            Response.Write("<script>alert('Record inseted');</script>");
        }
        else
        {
            objloginbal.LoginID = Convert.ToInt32(GridView1.SelectedRow.Cells[3].Text);
            if (txtpassword.Text == "")
            {
                objlogindal.updateLoginWithoutPassword(objloginbal);
                Response.Write("<script>alert('Record updated');</script>");
            }
            else
            {
                objlogindal.updateLoginWithPassword(objloginbal);
                Response.Write("<script>alert('Record updated');</script>");
            }
        }
        bindgrid();
        resetconrol();
        MultiView1.ActiveViewIndex = 0;
    }
Beispiel #2
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        string filename;
        string filepath;

        string servicefilename;
        string servicefilepath;


        if (fuimagefile.HasFile && fuservicedetailfile.HasFile)
        {
            filename = fuimagefile.FileName;
            filepath = Server.MapPath("images/ServiceProvider/");

            fuimagefile.SaveAs(filepath + filename);

            servicefilename = fuservicedetailfile.FileName;
            servicefilepath = Server.MapPath("images/ServiceDetailFile/");

            fuservicedetailfile.SaveAs(servicefilepath + servicefilename);

            objloginbal.UserName         = txtusername.Text;
            objloginbal.Password         = txtpassword.Text;
            objloginbal.SecurityQuestion = txtsecurityquestion.Text;
            objloginbal.SecureAnswer     = txtsecureanswer.Text;
            objloginbal.UserRole         = "ServiceProvider";
            objloginbal.AccountStatus    = "Pending";
            objloginbal.CreateDate       = System.DateTime.Now;

            objlogindal.insertLogin(objloginbal);

            DataSet ds = new DataSet();
            ds = objlogindal.getMaxLoginID();

            objserviceproviderbal.ServiceProviderName = txtserviceprovidername.Text;
            objserviceproviderbal.Address             = txtaddress.Text;
            objserviceproviderbal.CityID  = Convert.ToInt32(drpcity.SelectedValue);
            objserviceproviderbal.Pincode = txtpincode.Text;
            objserviceproviderbal.Mobile  = txtmobile.Text;
            objserviceproviderbal.Email   = txtemail.Text;
            objserviceproviderbal.Website = txtwebsite.Text;
            objserviceproviderbal.AboutServiceProvider  = txtaboutserviceprovider.Text;
            objserviceproviderbal.ServiceProviderTypeID = Convert.ToInt32(drpserviceprovidertype.SelectedValue);
            objserviceproviderbal.ServiceProviderImage  = filename;
            objserviceproviderbal.LoginID           = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
            objserviceproviderbal.ServiceDetailFile = servicefilename;

            objserviceproviderdal.insertServiceProvider(objserviceproviderbal);
            resetcontrol();

            try
            {
                string smtpAddress = "smtp.mail.yahoo.com";
                int    portNumber  = 587;
                bool   enableSSL   = true;

                string emailFrom = "*****@*****.**";
                string password  = "******";
                string emailTo   = txtemail.Text;
                string subject   = "E-Catering Event: Account registring";
                string body      = "Thank you for registering with <b>E-Catering Event Management System</b><br/>Your account will activated shortly.<br/>You will receive an email regaring your account activation.<br/>If your account takes too much time for activation, contact us";
                using (MailMessage mail = new MailMessage())
                {
                    mail.From = new MailAddress(emailFrom);
                    mail.To.Add(emailTo);
                    mail.Subject    = subject;
                    mail.Body       = body;
                    mail.IsBodyHtml = false;
                    // Can set to false, if you are sending pure text.

                    using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                    {
                        smtp.Credentials = new NetworkCredential(emailFrom, password);
                        smtp.EnableSsl   = enableSSL;
                        smtp.Send(mail);
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            Response.Redirect("Login.aspx");
        }
        else
        {
            Response.Write("<script>alert('Please select image');</script>");
        }
    }
Beispiel #3
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        objloginbal.UserName         = txtusername.Text;
        objloginbal.Password         = txtpassword.Text;
        objloginbal.SecurityQuestion = txtsecurityquestion.Text;
        objloginbal.SecureAnswer     = txtsecureanswer.Text;
        objloginbal.UserRole         = "Customer";
        objloginbal.AccountStatus    = "Active";
        objloginbal.CreateDate       = System.DateTime.Now;

        objlogindal.insertLogin(objloginbal);

        DataSet ds = new DataSet();

        ds = objlogindal.getMaxLoginID();

        objcustomerbal.FirstName = txtfirstname.Text;
        objcustomerbal.LastName  = txtlastname.Text;
        objcustomerbal.Address   = txtaddress.Text;
        objcustomerbal.CityID    = Convert.ToInt32(drpcity.SelectedValue);
        objcustomerbal.Pincode   = txtpincode.Text;
        objcustomerbal.Mobile    = txtmobile.Text;
        objcustomerbal.Email     = txtemail.Text;
        objcustomerbal.Gender    = drpgender.SelectedValue;
        objcustomerbal.Dob       = Convert.ToDateTime(txtdob.Text);
        objcustomerbal.LoginID   = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
        objcustomerdal.insertCustomer(objcustomerbal);
        resetcontrol();

        try
        {
            string smtpAddress = "smtp.mail.yahoo.com";
            int    portNumber  = 587;
            bool   enableSSL   = true;

            string emailFrom = "*****@*****.**";
            string password  = "******";
            string emailTo   = txtemail.Text;
            string subject   = "E-Catering Event: Account registring";
            string body      = "Thank you for registering with <b>E-Catering Event Management System</b><br/>If have any query, please letus know.";
            using (MailMessage mail = new MailMessage())
            {
                mail.From = new MailAddress(emailFrom);
                mail.To.Add(emailTo);
                mail.Subject    = subject;
                mail.Body       = body;
                mail.IsBodyHtml = false;
                // Can set to false, if you are sending pure text.

                using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                {
                    smtp.Credentials = new NetworkCredential(emailFrom, password);
                    smtp.EnableSsl   = enableSSL;
                    smtp.Send(mail);
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        Response.Redirect("Login.aspx");
    }