protected void FetchAndTransferChat() { qry = "SELECT * FROM tblChat WHERE ReqId=" + Request.QueryString["id"]; SqlDataReader dr = ClassHome.getRecords(qry); if (dr.Read()) { reqid = dr.GetValue(1).ToString(); sender = dr.GetValue(2).ToString(); chatMsg = dr.GetValue(3).ToString(); customeremail = dr.GetValue(4).ToString(); provideremail = dr.GetValue(5).ToString(); } else { } qry = "INSERT INTO tblEndedChats (EReqId,ESender,EChatMsg,ECustomerEmail,EProviderEmail) VALUES ('" + reqid + "', '" + sender + "', '" + chatMsg + "', '" + customeremail + "','" + provideremail + "')"; int i = ClassHome.setRecords(qry); qry = "DELETE FROM tblChat WHERE ReqId='" + reqid + "'"; int p = ClassHome.setRecords(qry); qry = "DELETE FROM tblCustomerRequest WHERE ReqId = '" + reqid + "'"; int r = ClassHome.setRecords(qry); }
protected void btnRating_Click(object sender, EventArgs e) { FetchDetails(); SqlConnection con = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\HomeSol.mdf;Integrated Security=True"); qry = "INSERT INTO tblrating (rating, review, StoreName, CustomerName) VALUES (@ratingvalue, @review,@provideremail,@custemail )"; SqlCommand cmd = new SqlCommand(qry); SqlDataAdapter sda = new SqlDataAdapter(); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@ratingvalue", Rating1.CurrentRating.ToString()); cmd.Parameters.AddWithValue("@review", txtreview.Text); cmd.Parameters.AddWithValue("@provideremail", provideremail); cmd.Parameters.AddWithValue("@custemail", customeremail); cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); qry = "INSERT INTO tblCustomerCompletion (ProviderStore,CustomerName,ProviderPhone,CustomerQuery,QuoteAmount) VALUES ('" + providerstore + "','" + customername + "','" + providerphone + "','" + customerquery + "','" + quote + "')"; int i = ClassHome.setRecords(qry); Label lbl6 = DataList1.Items[0].FindControl("lblId") as Label; string id = lbl6.Text; qry = "DELETE FROM tblComplete WHERE Id=" + id; int p = ClassHome.setRecords(qry); Response.Redirect("Dashboard.aspx"); }
protected void btnDelete_Click(object sender, EventArgs e) { qry = "DELETE FROM tblCustomer WHERE CustomerId='" + GridView1.SelectedRow.Cells[1].Text + "'"; int i = ClassHome.setRecords(qry); AllClear(); lblMsg.Text = "Record DELETED successfully."; }
/*public void FillGrid() * { * Label lbl = DataList1.Items[0].FindControl("lblReqId") as Label; * string lblreqid = lbl.Text; * SqlConnection con = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\HomeSol.mdf;Integrated Security=True"); * qry = "SELECT * FROM tblChat WHERE ReqId=" + lblreqid; * SqlDataReader dr = ClassHome.getRecords(qry); * GridView1.DataSource = dr; * GridView1.DataBind(); * } */ protected void sendEMail_Click(object sender, EventArgs e) { Label lbl = DataList1.Items[0].FindControl("lblReqId") as Label; string lblreqid = lbl.Text; qry = "INSERT INTO tblChat (ReqId,Sender,ChatMsg,CustomerEmail,ProviderEmail) VALUES ('" + lblreqid + "','" + providername + "','" + txtContent.Text + "','" + customeremail + "', '" + provideremail + "')"; int i = ClassHome.setRecords(qry); }
protected void btnLogin_Click(object sender, EventArgs e) { qry = "INSERT INTO tblPreServiceProvider (PreSPStoreName ,PreSPName,PreSPPhone,PreSPAddress,PreSPEmail,SPTypeId, PreSPLic, PreDriverLic, PreReferences) VALUES ('" + txtStore.Text + "', '" + txtName.Text + "','" + txtPhone.Text + "','" + txtAddress.Text + "','" + txtEmail.Text + "','" + ddlProviderType.SelectedValue + "','" + txtLic.Text + "','" + txtDriverLic.Text + "','" + txtReferences.Text + "')"; int i = ClassHome.setRecords(qry); AllClear(); lblMsg.ForeColor = System.Drawing.Color.White; Response.Redirect("AfterSubmit.aspx"); }
protected void btnLogin_Click(object sender, EventArgs e) { string password = txtPassword.Text; string enc = encryption(password); qry = "INSERT INTO tblCustomer (CustomerName ,CustomerUName,CustomerPass,CustomerEmail,CustomerPhone,CustomerAddress) VALUES ('" + txtName.Text + "', '" + txtUserName.Text + "','" + enc + "','" + txtEmail.Text + "','" + txtPhone.Text + "','" + txtAddress.Text + "')"; int i = ClassHome.setRecords(qry); Response.Redirect("CustomerLogin.aspx"); }
protected void btnAbort_Click(object sender, EventArgs e) { FetchEmails(); qry = "INSERT INTO tblEndedChats (EReqId,ESender,EChatMsg,ECustomerEmail,EProviderEmail) VALUES ('" + reqid + "', '" + sender1 + "', '" + chatMsg + "', '" + customeremail + "','" + provideremail + "')"; int i = ClassHome.setRecords(qry); qry = "DELETE FROM tblChat WHERE ReqId='" + reqid + "'"; int p = ClassHome.setRecords(qry); qry = "DELETE FROM tblCustomerRequest WHERE ReqId = '" + reqid + "'"; int r = ClassHome.setRecords(qry); Response.Redirect("ServiceProviderDash.aspx"); }
protected void btnNo_Click(object sender, EventArgs e) { FetchEmails(); string flag = "No"; qry = "DELETE FROM tblConfirmation WHERE ReqId='" + reqid + "'"; int i = ClassHome.setRecords(qry); qry = "INSERT INTO tblConfirmation (Confirmation,ReqId) VALUES ('" + flag + "','" + reqid + "')"; int p = ClassHome.setRecords(qry); Panel1.Visible = true; Panel3.Visible = false; lblQuote.Visible = false; }
protected void btnSubmit_Click(object sender, EventArgs e) { if (btnSubmit.Text == "Submit") { qry = "INSERT INTO tblEmployee (EmpName,EmpPhone,EmpUserName,EmpPassword,EmpAddress,EmpEmail,EmpTypeID) VALUES ('" + txtName.Text + "','" + txtPhone.Text + "','" + txtUserName.Text + "','" + txtPassword.Text + "','" + txtAddress.Text + "','" + txtEmail.Text + "','" + ddlEmpType.SelectedValue + "')"; } else { qry = "UPDATE tblEmployee SET EmpName='" + txtName.Text + "', EmpPhone='" + txtPhone.Text + "', EmpUserName='******', EmpPassword='******', EmpAddress='" + txtAddress.Text + "', EmpEmail='" + txtEmail.Text + "', EmpTypeID='" + ddlEmpType.SelectedValue + "' WHERE EmpID='" + GridView1.SelectedRow.Cells[1].Text + "'"; } int i = ClassHome.setRecords(qry); AllClear(); lblMsg.Text = "Record submitted successfully."; }
protected void btnYes_Click(object sender, EventArgs e) { FetchEmails(); string flag = "Yes"; qry = "DELETE FROM tblConfirmation WHERE ReqId='" + reqid + "'"; int i = ClassHome.setRecords(qry); qry = "INSERT INTO tblConfirmation (Confirmation,ReqId) VALUES ('" + flag + "','" + reqid + "')"; int p = ClassHome.setRecords(qry); Panel1.Visible = true; Panel3.Visible = false; lblQuote.Visible = false; Label3.Text = "Accept the quote and send an appointment details:"; }
public void InsertDetails() { Label lbl = DataList1.Items[0].FindControl("lblEmail") as Label; string lbltext = lbl.Text; Label lbl1 = DataList1.Items[0].FindControl("lblName") as Label; string lblname = lbl1.Text; Label lbl2 = DataList1.Items[0].FindControl("lblStoreName") as Label; string lblstore = lbl2.Text; Label lbl3 = DataList1.Items[0].FindControl("lblPhone") as Label; string lblphone = lbl3.Text; Label lbl4 = DataList1.Items[0].FindControl("lblAddress") as Label; string lbladdress = lbl4.Text; qry = "INSERT INTO tblCustomerRequest (CustName, CustPhone, CustEmail, CustAddress, RequestDetails, ProviderName, ProviderEmail, ProviderStoreName, ProviderAddress, ProviderPhone) VALUES ('" + custname + "','" + custphone + "','" + custemail + "','" + custaddress + "','" + txtContent.Text + "','" + lblname + "','" + lbltext + "','" + lblstore + "','" + lbladdress + "','" + lblphone + "')"; int i = ClassHome.setRecords(qry); }
protected void btnSubmit_Click(object sender, EventArgs e) { string password = txtPassword.Text; string enc = encryption(password); if (btnSubmit.Text == "Submit") { qry = "INSERT INTO tblCustomer (CustomerName ,CustomerUName, CustomerPass, CustomerEmail ,CustomerPhone, CustomerAddress) VALUES ('" + txtName.Text + "','" + txtUserName.Text + "','" + enc + "','" + txtEmail.Text + "','" + txtPhone.Text + "', '" + txtAddress.Text + "')"; } else { qry = "UPDATE tblCustomer SET CustomerName='" + txtName.Text + "', CustomerPhone='" + txtPhone.Text + "', CustomerUName='" + txtUserName.Text + "', CustomerPass='******', CustomerAddress='" + txtAddress.Text + "', CustomerEmail='" + txtEmail.Text + "' WHERE CustomerId='" + GridView1.SelectedRow.Cells[1].Text + "'"; } int i = ClassHome.setRecords(qry); AllClear(); lblMsg.Text = "Record submitted successfully."; }
protected void btnSubmit_Click(object sender, EventArgs e) { string password = txtPassword.Text; string enc = encryption(password); if (btnSubmit.Text == "Submit") { qry = "INSERT INTO tblServiceProvider (SPStoreName ,SPName,SPPhone,SPUserName,SPPassword,SPAddress,SPEmail,SPTypeId, SPLic) VALUES ('" + txtStore.Text + "', '" + txtName.Text + "','" + txtPhone.Text + "','" + txtUserName.Text + "','" + enc + "','" + txtAddress.Text + "','" + txtEmail.Text + "','" + ddlProviderType.SelectedValue + "','" + txtLic.Text + "')"; } else { qry = "UPDATE tblServiceProvider SET SPStoreName='" + txtStore.Text + "', SPName='" + txtName.Text + "', SPPhone='" + txtPhone.Text + "', SPUserName='******', SPPassword='******', SPAddress='" + txtAddress.Text + "', SPEmail='" + txtEmail.Text + "', SPTypeId='" + ddlProviderType.SelectedValue + "', SPLic = '" + txtLic.Text + "' WHERE SPID='" + GridView1.SelectedRow.Cells[1].Text + "'"; } int i = ClassHome.setRecords(qry); AllClear(); lblMsg.Text = "Record submitted successfully."; }
protected void sendEMail_Click1(object sender, EventArgs e) { Label lbl = DataList1.Items[0].FindControl("lblEmail") as Label; string lbltext = lbl.Text; Label lbl1 = DataList1.Items[0].FindControl("lblName") as Label; string lblname = lbl1.Text; Label lbl2 = DataList1.Items[0].FindControl("lblStoreName") as Label; string lblstore = lbl2.Text; Label lbl3 = DataList1.Items[0].FindControl("lblPhone") as Label; string lblphone = lbl3.Text; Label lbl4 = DataList1.Items[0].FindControl("lblAddress") as Label; string lbladdress = lbl4.Text; NetworkCredential loginInfo = new NetworkCredential("*****@*****.**", "homesolutions"); MailMessage msg = new MailMessage(); string text = "Hello!! " + lblname + " You got one new request from customer:\n" + txtContent.Text + @"<html> <body> <br><hr/> Thanks and Regards <br> <b>Home Solutions and Co. </b></body> </html> "; msg.From = new MailAddress("*****@*****.**"); msg.To.Add(new MailAddress(lbltext)); //the email id where you need to send email. msg.Subject = "Update on your application in Home Solutions"; msg.Body = text; msg.IsBodyHtml = true; SmtpClient client = new SmtpClient("smtp.gmail.com", 587); client.EnableSsl = true; client.UseDefaultCredentials = false; client.Credentials = loginInfo; client.Send(msg); InsertDetails(); string reqid, msg1; qry = "SELECT * FROM tblCustomerRequest WHERE CustPhone = '" + custphone + "'"; SqlDataReader dr = ClassHome.getRecords(qry); if (dr.Read()) { reqid = dr.GetValue(0).ToString(); msg1 = dr.GetValue(5).ToString(); qry = "INSERT INTO tblChat (ReqId,Sender,ChatMsg,CustomerEmail,ProviderEmail) VALUES ('" + reqid + "','" + custname + "','" + msg1 + "','" + custemail + "', '" + lbltext + "')"; int p = ClassHome.setRecords(qry); } Response.Redirect("Dashboard.aspx"); }
protected void btnApprove1_Click(object sender, EventArgs e) { string password = txtPassword.Text; string enc = encryption(password); int flag = 0; if (flag == 0) { qry = "INSERT INTO tblServiceProvider (SPStoreName ,SPName,SPPhone,SPUserName,SPPassword,SPAddress,SPEmail,SPTypeId, SPLic,SPDriverLic,SPReferences) VALUES ('" + lblStoreName.Text + "', '" + lblName.Text + "','" + lblPhone.Text + "','" + txtUserName.Text + "','" + enc + "','" + lblAddress.Text + "','" + lblEmail.Text + "','" + lblTypeID.Text + "','" + lblLic.Text + "','" + lblDriverLic.Text + "','" + lblReferences.Text + "')"; int i = ClassHome.setRecords(qry); qry1 = "DELETE FROM tblPreServiceProvider WHERE PreSPID='" + GridView1.SelectedRow.Cells[1].Text + "'"; int i1 = ClassHome.setRecords(qry1); flag = 1; } else { } if (flag == 1) { string text = "Hello!!" + lblStoreName.Text + " You have been successfully approved for the home solution signup."; string text1 = "@ <html><body><p> Congratulations on your approval.</p><p> Now customer can see your all information on their portal.</p>" + "<p> We have attached the username and password to this email </p><hr><b> Your User name is:</b></body></html>" + txtUserName.Text; string text2 = @"<html><body><b>And Your password is:</b></body></html>"; string text3 = @" <html> <body> <br><hr/><br> Thanks and Regards<br><b>Home Solutions and Co. </b></body> </html> "; NetworkCredential loginInfo = new NetworkCredential("*****@*****.**", "homesolutions"); MailMessage msg = new MailMessage(); msg.From = new MailAddress("*****@*****.**"); msg.To.Add(new MailAddress(lblEmail.Text)); //the email id where you need to send email. msg.Subject = "Your Login Credentials for Home Solutions"; msg.Body = text + text1 + text2 + txtPassword.Text + text3;; msg.IsBodyHtml = true; SmtpClient client = new SmtpClient("smtp.gmail.com", 587); client.EnableSsl = true; client.UseDefaultCredentials = false; client.Credentials = loginInfo; client.Send(msg); //for sending email ends here Response.Redirect("PendingApprovals.aspx"); } }
protected void sendEMail_Click(object sender, EventArgs e) { FetchEmails(); NetworkCredential loginInfo = new NetworkCredential("*****@*****.**", "homesolutions"); MailMessage msg = new MailMessage(); string text = "Hello!! You got one new response from customer" + custname + ":\n" + txtContent.Text + @"<html> <body> <br><hr/> Thanks and Regards <br> <b>Home Solutions and Co. </b></body> </html> "; msg.From = new MailAddress("*****@*****.**"); msg.To.Add(new MailAddress(provideremail)); //the email id where you need to send email. msg.Subject = "Update on your application in Home Solutions"; msg.Body = text; msg.IsBodyHtml = true; SmtpClient client = new SmtpClient("smtp.gmail.com", 587); client.EnableSsl = true; client.UseDefaultCredentials = false; client.Credentials = loginInfo; client.Send(msg); qry = "INSERT INTO tblChat (ReqId,Sender,ChatMsg,CustomerEmail,ProviderEmail) VALUES ('" + reqid + "','" + custname + "','" + txtContent.Text + "','" + customeremail + "', '" + provideremail + "')"; int i = ClassHome.setRecords(qry); Response.Redirect("Dashboard.aspx"); }
protected void btnConfirm_Click(object sender, EventArgs e) { string ProviderStore, CustomerName, CustomerPhone, ProviderPhone, CustomerAddress, CustomerQuery, QuoteAmount; qry = "SELECT * FROM tblAppointment WHERE ApptId=" + Request.QueryString["id"]; SqlDataReader dr = ClassHome.getRecords(qry); if (dr.Read()) { ProviderStore = dr.GetValue(1).ToString(); CustomerName = dr.GetValue(2).ToString(); CustomerPhone = dr.GetValue(3).ToString(); ProviderPhone = dr.GetValue(4).ToString(); CustomerAddress = dr.GetValue(5).ToString(); CustomerQuery = dr.GetValue(6).ToString(); QuoteAmount = dr.GetValue(7).ToString(); qry = "INSERT INTO tblComplete (ProviderStore,CustomerName,CustomerPhone,ProviderPhone,CustomerAddress,CustomerQuery,QuoteAmount) VALUES ('" + ProviderStore + "','" + CustomerName + "','" + CustomerPhone + "','" + ProviderPhone + "','" + CustomerAddress + "','" + CustomerQuery + "','" + QuoteAmount + "')"; int i = ClassHome.setRecords(qry); qry = "DELETE FROM tblAppointment WHERE ApptId=" + Request.QueryString["id"]; int p = ClassHome.setRecords(qry); } Response.Redirect("CompletedRequests.aspx"); }
protected void btnReject_Click(object sender, EventArgs e) { int flag = 0; if (flag == 0) { qry = "INSERT INTO tblRejectedSP (RejSPStoreName ,RejSPName,RejSPPhone, RejSPAddress, RejSPEmail, SPTypeId, RejSPLic, RejDriverLic, RejReferences) VALUES ('" + lblStoreName.Text + "', '" + lblName.Text + "','" + lblPhone.Text + "','" + lblAddress.Text + "','" + lblEmail.Text + "','" + lblTypeID.Text + "','" + lblLic.Text + "','" + lblDriverLic.Text + "','" + lblReferences.Text + "')"; int i = ClassHome.setRecords(qry); qry1 = "DELETE FROM tblPreServiceProvider WHERE PreSPID='" + GridView1.SelectedRow.Cells[1].Text + "'"; int i1 = ClassHome.setRecords(qry1); flag = 1; } else { } if (flag == 1) { string text = "Hello!! " + lblStoreName.Text + " You have been rejected in verification of the home solution participation please see us inperson"; string text3 = @" <html> <body> <br><hr/><br> Thanks and Regards<br><b>Home Solutions and Co. </b></body> </html> "; string text1 = @"<html><body><br><b>Your Reason for rejection is:  </b></body></html>" ; NetworkCredential loginInfo = new NetworkCredential("*****@*****.**", "homesolutions"); MailMessage msg = new MailMessage(); msg.From = new MailAddress("*****@*****.**"); msg.To.Add(new MailAddress(lblEmail.Text)); //the email id where you need to send email. msg.Subject = "Update on your application in Home Solutions"; msg.Body = text + text1 + txtReason.Text + text3; msg.IsBodyHtml = true; SmtpClient client = new SmtpClient("smtp.gmail.com", 587); client.EnableSsl = true; client.UseDefaultCredentials = false; client.Credentials = loginInfo; client.Send(msg); //for sending email ends here } Response.Redirect("PendingApprovals.aspx"); }
protected void btnSendAppt_Click(object sender, EventArgs e) { string CustomerName, CustomerPhone, ProviderName, ProviderPhone, CustomerAddress, CustomerQuery; FetchQuote(); qry = "SELECT * FROM tblCustomerRequest WHERE ReqId=" + reqid; SqlDataReader dr = ClassHome.getRecords(qry); if (dr.Read()) { CustomerName = dr.GetValue(1).ToString(); CustomerPhone = dr.GetValue(2).ToString(); ProviderName = dr.GetValue(8).ToString(); ProviderPhone = dr.GetValue(10).ToString(); CustomerAddress = dr.GetValue(4).ToString(); CustomerQuery = dr.GetValue(5).ToString(); qry = "INSERT INTO tblAppointment (ProviderStore,CustomerName,CustomerPhone,ProviderPhone,CustomerAddress,CustomerQuery,QuoteAmount,Date,TIME) VALUES('" + ProviderName + "','" + CustomerName + "','" + CustomerPhone + "','" + ProviderPhone + "','" + CustomerAddress + "','" + CustomerQuery + "','" + Label2.Text + "','" + txtApp.Text + "','" + txtApptime.Text + "')"; int i = ClassHome.setRecords(qry); } qry = "DELETE FROM tblCustomerRequest WHERE ReqId=" + reqid; int r = ClassHome.setRecords(qry); Response.Redirect("ProviderAppointmentDetails.aspx"); }
protected void sendemail() { Label lbl = DataList1.Items[0].FindControl("lblReqId") as Label; string lblreqid = lbl.Text; string tempchat; tempchat = txtContent.Text + "And Your Quote is: $" + txtQuote.Text; FetchEmails(); if (txtQuote.Text != null) { NetworkCredential loginInfo = new NetworkCredential("*****@*****.**", "homesolutions"); MailMessage msg = new MailMessage(); string text = "Hello!! You got one new response from service provider" + providername + ":\n" + txtContent.Text + @"<html><body><b><br><hr><br>The quote given from provider is: </b></body></html>" + "$ " + txtQuote.Text + @" <html> <body> <br><hr/> Thanks and Regards <br> <b>Home Solutions and Co. </b></body> </html> "; msg.From = new MailAddress("*****@*****.**"); msg.To.Add(new MailAddress(customeremail)); //the email id where you need to send email. msg.Subject = "Update on your application in Home Solutions"; msg.Body = text; msg.IsBodyHtml = true; SmtpClient client = new SmtpClient("smtp.gmail.com", 587); client.EnableSsl = true; client.UseDefaultCredentials = false; client.Credentials = loginInfo; client.Send(msg); FetchQuote(); if (Label2.Text == "Label") { qry = "INSERT INTO tblQuote (QuoteAmount,ReqId) VALUES ('" + txtQuote.Text + "','" + lblreqid + "')"; int p = ClassHome.setRecords(qry); } else { qry = "UPDATE tblQuote SET QuoteAmount='" + txtQuote.Text + "' WHERE ReqId='" + lblreqid + "'"; int p = ClassHome.setRecords(qry); } qry = "INSERT INTO tblChat (ReqId,Sender,ChatMsg,CustomerEmail,ProviderEmail) VALUES ('" + lblreqid + "','" + providername + "','" + tempchat + "','" + customeremail + "', '" + provideremail + "')"; int i = ClassHome.setRecords(qry); Response.Redirect("ServiceProviderDash.aspx"); } else { NetworkCredential loginInfo = new NetworkCredential("*****@*****.**", "homesolutions"); MailMessage msg = new MailMessage(); string text = "Hello!! You got one new response from service provider" + providername + ":\n" + txtContent.Text + @" < html> <body> <br><hr/> Thanks and Regards <br> <b>Home Solutions and Co. </b></body> </html> "; msg.From = new MailAddress("*****@*****.**"); msg.To.Add(new MailAddress(customeremail)); //the email id where you need to send email. msg.Subject = "Update on your application in Home Solutions"; msg.Body = text; msg.IsBodyHtml = true; SmtpClient client = new SmtpClient("smtp.gmail.com", 587); client.EnableSsl = true; client.UseDefaultCredentials = false; client.Credentials = loginInfo; client.Send(msg); qry = "INSERT INTO tblChat (ReqId,Sender,ChatMsg,CustomerEmail,ProviderEmail) VALUES ('" + lblreqid + "','" + providername + "','" + tempchat + "','" + customeremail + "', '" + provideremail + "')"; int i = ClassHome.setRecords(qry); Response.Redirect("ServiceProviderDash.aspx"); } }