public ActionResult ComplaintAllotToEmp(tblComplaint oTbl)//181031 { string Trace = ""; var sMsg = new { Message = "Successfully Update ...", MsgID = 1 }; try { var Comp = (from a in db.tblComplaints where a.CompID == oTbl.CompID select a).SingleOrDefault(); if (Comp != null) { Comp.EmpID = oTbl.EmpID; Comp.cmIsPaid = oTbl.cmIsPaid; Comp.cmSrvcMode = oTbl.cmSrvcMode; Comp.TentetiveTm = oTbl.TentetiveTm; Comp.Charge = oTbl.Charge; Comp.Remark_Mgr = oTbl.Remark_Eng; db.SubmitChanges(); sMsg = new { Message = "Complaint Alloted ...", MsgID = 1 }; } } catch (Exception ex) { sMsg = new { Message = Trace + ex.Message, MsgID = 2 }; } return(new JsonResult() { Data = new { sMsg }, ContentType = "application/json; charset=utf-8", JsonRequestBehavior = JsonRequestBehavior.AllowGet, MaxJsonLength = Int32.MaxValue }); }
public ActionResult AskQuery(tblComplaint comobj) { try { if (Session["LoginType"].Equals("Worker") && Session["Id"] != null) { dbCMSEntities db = new dbCMSEntities(); var obj = (from c in db.tblComplaints where c.ComplaintId.Equals(comobj.ComplaintId) select c).FirstOrDefault(); obj.WorkerQuery = comobj.WorkerQuery; obj.CustomerReply = "Awaiting Reply"; db.SaveChanges(); return(RedirectToAction("Home", "Worker")); } else { return(RedirectToAction("Login", "Login")); } } catch (Exception) { return(RedirectToAction("Error", "Home")); } }
public ActionResult NewComplaint(tblComplaint compobj) { try { if (Session["LoginType"].Equals("Customer") && Session["Id"] != null) { dbCMSEntities db = new dbCMSEntities(); compobj.CustomerId = int.Parse(Session["Id"].ToString()); compobj.ComplaintStatus = "Not Assigned"; compobj.WorkerQuery = "NA"; compobj.CustomerReply = "NA"; compobj.Feedback = "NA"; compobj.ComplaintDate = DateTime.Now; db.tblComplaints.Add(compobj); db.SaveChanges(); return(RedirectToAction("Home", "Customer")); } else { return(RedirectToAction("Login", "Login")); } } catch (Exception) { return(RedirectToAction("Error", "Home")); } }
public ActionResult Feedback(tblComplaint comobj) { dbCMSEntities db = new dbCMSEntities(); try { if (Session["LoginType"].Equals("Customer") && Session["Id"] != null) { var obj = (from c in db.tblComplaints where c.ComplaintId.Equals(comobj.ComplaintId) select c).FirstOrDefault(); obj.ComplaintStatus = "Feedback Provided"; obj.Feedback = comobj.Feedback; db.SaveChanges(); return(RedirectToAction("Home", "Customer")); } else { return(RedirectToAction("Login", "Login")); } } catch (Exception) { return(RedirectToAction("Error", "Home")); } }
protected void btnResolve_Click(object sender, EventArgs e) { using (PTCLEntities db = new PTCLEntities()) { int ComplaintID = Convert.ToInt32(Request.QueryString["ComplaintID"]); tblComplaint a = db.tblComplaints.FirstOrDefault(b => b.ComplaintID == ComplaintID); var userid = a.UserID; tblPtclUser u = db.tblPtclUsers.FirstOrDefault(c => c.UserID == userid); var AdminID = a.AdminID; //tblAdmin z = db.tblAdmins.FirstOrDefault(y => y.AdminID == AdminID); // z.ComplaintsResolved = z.ComplaintsResolved + 1; a.AdminID = Convert.ToInt32(Session["AdminID"]); a.ComplaintStatus = bool.Parse("true"); db.SaveChanges(); var message = "Dear Custmer, Your PTCL complaint ( " + a.ComplaintTitle + " ) is Resovled by our team. Please check and let as know. Say hello to the future "; //btnResolve.SendEmail("*****@*****.**", "asdasd", "asdasdasd"); if (Email.SendEmail(u.EmailAddress, "Dear Customer Your Issue has been Resolved", message)) { var linkUrl = "~/Complaints/Admin/AdminComplaintDetails.aspx?ComplaintID=" + ComplaintID + "&Email=1"; Response.Redirect(linkUrl); } else { var linkUrl = "~/Complaints/Admin/AdminComplaintDetails.aspx?ComplaintID=" + ComplaintID + "&Email=0"; Response.Redirect(linkUrl); } } }
// On clicking the submit button of complaint. protected void btnsubmit_Click(object sender, EventArgs e) { Utilities.clearAllPlaceHolders(viewComplaints); using (DatabaseDataContext con = new DatabaseDataContext()) { try { #region checks if (SessionManager.UserID == 0) { showError("You must be logged in to submit a complaint!"); clearAllViews(); return; } string EncodedResponse = Request.Form["g-Recaptcha-Response"]; bool IsCaptchaValid = (ReCaptcha.Validate(EncodedResponse) == "true" ? true : false); if (!IsCaptchaValid) { showError("Prove that you are not a robot!", 0); return; } if (string.IsNullOrEmpty(txtTitle.Text) || string.IsNullOrEmpty(txtdescription.Text)) { showError("Fill in all text boxes!"); return; } #endregion tblComplaint complaint = new tblComplaint() { ComplaintDate = DateTime.Now, ComplaintTitle = txtTitle.Text, ComplaintDescription = txtdescription.Text, CategoryID = Convert.ToInt32(ddlcategory.SelectedValue), UserID = SessionManager.UserID, ComplaintStatus = "Unresolved", IsSeen = false }; con.tblComplaints.InsertOnSubmit(complaint); con.SubmitChanges(); showSuccess("Complaint submitted! Your complaint ID is: <b>" + complaint.ComplaintID + "</b>"); clearAllViews(); NotificationManager.complaintSent(); } catch (Exception ex) { showError("Error: " + ex); clearAllViews(); } } }
public ActionResult Detail(int id) { tblComplaint com = dc.tblComplaints.SingleOrDefault(ob => ob.ComplaintId == id); ViewBag.Name = (from ob in dc.tblUsers where ob.UserId == com.UserId select ob).Take(1).SingleOrDefault().FirstName; ViewBag.Company = (from ob in dc.tblTransportCompanies where ob.CompanyId == com.CompanyId select ob).Take(1).SingleOrDefault().CompanyName; string User = ViewBag.Name; string Name = ViewBag.Company; return(View(com)); }
/* Polls */ /* Complaints */ public object AddComplaint(string ComplaintType, string Subject, string Description, int Priority) { var DC = new DataClassesDataContext(); tblComplaint ComplaintObj = new tblComplaint(); ComplaintObj.ComplaintType = ComplaintType; ComplaintObj.Subject = Subject; ComplaintObj.Description = Description; ComplaintObj.Priority = Priority; ComplaintObj.CreatedOn = DateTime.Now; ComplaintObj.IsActive = true; DC.tblComplaints.InsertOnSubmit(ComplaintObj); DC.SubmitChanges(); return("True"); }
protected void cmdSubmit_Click(object sender, EventArgs e) { using (PTCLEntities db = new PTCLEntities()) { tblComplaint s = new tblComplaint(); s.ComplaintTitle = txtComplaintTitle.Text; s.ComplaintTypeID = Convert.ToInt32(ddlComplaint.SelectedValue); s.ComplaintDescription = txtComplaintDescription.Text; s.ComplaintStatus = false; var UserID = Session["UserID"]; s.UserID = Convert.ToInt32(UserID); s.ComplaintCreationDate = DateTime.Now; if (FileUpload.HasFile) { FileUpload.SaveAs(Server.MapPath("../../UploadFiles/ComplaintData/" + FileUpload.FileName)); s.ComplaintImage = FileUpload.FileName; } else { s.ComplaintImage = ""; } if (Request.QueryString["ComplaintID"] != null) { s.RegeneratedID = Convert.ToInt32(Request.QueryString["ComplaintID"]); } txtComplaintDescription.Text = ""; txtComplaintTitle.Text = ""; db.tblComplaints.Add(s); db.SaveChanges(); lblMsg.Text = "Complaint Registered Successfully"; ddlComplaint.SelectedValue = "7"; if (Request.QueryString["ComplaintID"] != null) { Response.Redirect("~/Complaints/User/UserComplaint.aspx?register=1"); } } }
protected void btnDetails_Click(object sender, EventArgs e) { mvComplaints.ActiveViewIndex = 1; int hash = sender.GetHashCode(); foreach (RepeaterItem item in rComplaints.Items) { LinkButton button = item.FindControl("btnDetails") as LinkButton; if (button.GetHashCode() == hash) { TableCell tc = item.FindControl("tcComplaintID") as TableCell; int ComplaintID = Convert.ToInt32(tc.Text); using (DatabaseDataContext db = new DatabaseDataContext()) { tblComplaint complaint = db.tblComplaints.Where(x => x.ComplaintID == ComplaintID).FirstOrDefault(); tblCategory category = db.tblCategories.Where(x => x.CategoryID == complaint.CategoryID).FirstOrDefault(); tblUser user = db.tblUsers.Where(x => x.UserID == complaint.UserID).FirstOrDefault(); lblComplaintID.Text = complaint.ComplaintID.ToString(); lblUserID.Text = user.UserID.ToString(); lblComplaintTitle.Text = complaint.ComplaintTitle; lblUserName.Text = user.UserFName + " " + user.UserLName; lblComplaintCategory.Text = category.CategoryName; lblUserAddress.Text = user.UserAddress; txtComplaintDescription.Text = complaint.ComplaintDescription; lblUserContact.Text = user.UserContact + "<br />" + user.UserEmail; ddlStatus.SelectedValue = complaint.ComplaintStatus; complaint.IsSeen = true; db.SubmitChanges(); } } } }
// Check the current status of a complaint from tracker view[1] protected void btnCheck_Click(object sender, EventArgs e) { Utilities.clearAllPlaceHolders(viewTracker); #region checks if (string.IsNullOrEmpty(txtCheckComplaintID.Text)) { showError("Please fill in the text box!", 1); return; } if (SessionManager.UserID == 0) { showError("You must be logged in to use this feature!", 1); clearAllViews(); return; } #endregion using (DatabaseDataContext db = new DatabaseDataContext()) { try { tblComplaint complaint = db.tblComplaints.Where(x => x.ComplaintID == Convert.ToInt32(txtCheckComplaintID.Text)).FirstOrDefault(); txtDetTitle.Text = complaint.ComplaintTitle.ToString(); txtDetCategory.Text = complaint.tblCategory.CategoryName.ToString(); txtDetDescription.Text = complaint.ComplaintDescription.ToString(); txtDetDate.Text = complaint.ComplaintDate.ToString(); txtDetStatus.Text = complaint.ComplaintStatus.ToString(); // Go to detail of a specific complaint. mvComplaint.ActiveViewIndex = 2; } catch (NullReferenceException) { showError("No record found!", 1); clearAllViews(); return; } } }
protected void btnBack_Click(object sender, EventArgs e) { //SHOW TOAST MESSAGE int ComplaintID = Convert.ToInt32(lblComplaintID.Text); using (DatabaseDataContext db = new DatabaseDataContext()) { tblComplaint complaint = db.tblComplaints.Where(x => x.ComplaintID == ComplaintID).FirstOrDefault(); complaint.ComplaintStatus = ddlStatus.SelectedValue; db.SubmitChanges(); List <tblComplaint> complaints = db.tblComplaints.SortBy("ComplaintDate").ToList(); // Populates the Panels ControlManager.populateControl(complaints, rComplaints); } //Resets the DropDownList ddlStatus.SelectedIndex = 0; mvComplaints.ActiveViewIndex = 0; }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["Last"] == "1") { HypCancel.NavigateUrl = "~/Complaints/User/UserComplaint.aspx?closed=1"; } if (Request.QueryString["start"] == "1") { PanelRegenerate.CssClass = " d-none"; HypCancel.NavigateUrl = "~/Complaints/User/UserComplaint.aspx?Active=1"; } using (PTCLEntities db = new PTCLEntities()) { if (IsPostBack == true) { return; } if (Request.QueryString["ComplaintID"] != null) { int ComplaintID = Convert.ToInt32(Request.QueryString["ComplaintID"]); //HypRegenerate.NavigateUrl = "~/Complaints/User/UserComplaintDetails.aspx?ComplaintID=" + ComplaintID; tblComplaint s = db.tblComplaints.FirstOrDefault(v => v.ComplaintID == ComplaintID); //Response.Write(ComplaintID); txtComplaintID.Text = s.ComplaintID.ToString(); txtComplaintTitle.Text = s.ComplaintTitle; txtComplaintDescription.Text = s.ComplaintDescription; txtComplaintUserID.Text = s.UserID.ToString(); txtDateTime.Text = s.ComplaintCreationDate.ToString(); if (s.RegeneratedID.ToString() == "0") { txtComplaintRegenerated.Text = "No Regenerated"; } else if (s.RegeneratedID.ToString() != "") { txtComplaintRegenerated.Text = "Yes Regenerated (" + s.RegeneratedID.ToString() + ")"; HypRegeneratedComplaint.Text = "Goto Parent Complaint"; HypRegeneratedComplaint.NavigateUrl = "~/Complaints/User/UserComplaintDetails.aspx?ComplaintID=" + s.RegeneratedID.ToString(); } else { txtComplaintRegenerated.Text = "No Regenerated"; } //Response.Write(s.Status); if (Convert.ToInt32(s.ComplaintStatus) == 1) { ddlComplaintStatus.SelectedValue = "1"; } else { ddlComplaintStatus.SelectedValue = "0"; } if (s.ComplaintImage != "") { HypDownloadUpload.NavigateUrl = "../../UploadFiles/ComplaintData/" + s.ComplaintImage; } else { HypDownloadUpload.NavigateUrl = ""; HypDownloadUpload.Text = "NO FILE TO DOWNLOAD"; } if (s.ComplaintStatus.ToString() == "0") { } } } }
public ActionResult Complaint(clsComplaint oTbl) { string sLine = ""; var sMsg = new { Message = "Successfully Saved ...", MsgID = 1, ComplaintNo = "0" }; try { string CompNo = DateTime.Now.Date.Date.ToString("yy") + DateTime.Now.Date.Date.ToString("MM") + DateTime.Now.Date.Date.ToString("dd"); int iCustID = 0; tblComplaint oComp = new tblComplaint(); oComp.CustID = oTbl.CustID; if (oTbl.IsNewCust == 1) { iCustID = Convert.ToInt32(oSubmit.GetSingleData("Select isnull(max(studCode)+1,1) from studdet where studType = 68", "0", true)); studdet Cust = new studdet(); Cust.studType = 68; Cust.studCode = iCustID; Cust.studName = oTbl.studName; Cust.studadd1 = oTbl.studadd1; Cust.studadd2 = oTbl.studadd2; Cust.studcity = oTbl.studcity; Cust.studstat = oTbl.studstat; Cust.studphon = oTbl.studphon; db.studdets.InsertOnSubmit(Cust); db.SubmitChanges(); oComp.CustID = iCustID; } sLine = "1"; oComp.CompNo = CompNo + GetNo(oSubmit.GetSingleData("Select isnull(max(CompID)+1,1) from tblComplaint", "0", true).ToString()); //oComp.CompDt = oSubmit.GetDateFormat(oTbl.CompDt.ToString()); sLine = "2"; oComp.CreatedOn = DateTime.Now; oComp.StatusID = 1; oComp.UserID = SessionMaster.UserID; sLine = "3"; if (oTbl.sTentetiveTm != null && oTbl.sTentetiveTm.ToString() != "") { oComp.TentetiveTm = oSubmit.GetDate(oTbl.sTentetiveTm.ToString()); } sLine = "4"; sLine += oTbl.CompDt.ToString(); oComp.CompDt = oSubmit.GetDate(oTbl.sCompDt.ToString()); sLine = "5"; oComp.DealerID = oTbl.DealerID; oComp.CustNM = oTbl.CustNM; oComp.ModelNo = oTbl.ModelNo; oComp.SrvType = oTbl.SrvType; oComp.EmpID = oTbl.EmpID; oComp.ItemID = oTbl.ItemID; oComp.InvNo = oTbl.InvNo; oComp.Charge = oTbl.Charge; oComp.Remark_Cust = oTbl.Remark_Cust; oComp.Remark_Mgr = oTbl.Remark_Eng; //Remark_Eng to Remark_Mgr 181101 oComp.cmIsRead = 1; //181027 oComp.cmIsPaid = oTbl.IsPaid; //181027 oComp.cmSrvcMode = oTbl.IsSrvcMode; //181027 oComp.cmCategory = oTbl.Category; //181027 db.tblComplaints.InsertOnSubmit(oComp); db.SubmitChanges(); CompNo = CompNo + GetNo(oSubmit.GetSingleData("Select isnull(max(CompID)+1,1) from tblComplaint", "0", true).ToString()); sMsg = new { Message = "Complaint Successfully Registered . Your Complaint No Is " + CompNo + " .", MsgID = 1, ComplaintNo = CompNo }; } catch (Exception ex) { sMsg = new { Message = sLine + "#" + ex.Message, MsgID = 2, ComplaintNo = "0" }; } return(Json(sMsg, JsonRequestBehavior.AllowGet)); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["Email"] == "1") { lblEmailMessage.Text = "Email Send to the Customer Successfully"; } if (Request.QueryString["Email"] == "0") { lblEmailMessage.Text = "Email Send to the Customer Failed"; } hypCacnel.NavigateUrl = "~/Complaints/Admin/AdminComplaint.aspx?Active=1"; using (PTCLEntities db = new PTCLEntities()) { if (Request.QueryString["ComplaintID"] != null) { int ComplaintID = Convert.ToInt32(Request.QueryString["ComplaintID"]); tblComplaint s = db.tblComplaints.FirstOrDefault(v => v.ComplaintID == ComplaintID); Label lblCID = new Label(); lblCID.Text = "Complaint ID: " + s.ComplaintID.ToString(); PanelCID.Controls.Add(lblCID); // Download File if (s.ComplaintImage != "" && s.ComplaintImage != null) { HypDownloadUpload.NavigateUrl = "../../UploadFiles/ComplaintData/" + s.ComplaintImage; } else { HypDownloadUpload.NavigateUrl = ""; HypDownloadUpload.Text = "NO FILE TO DOWNLOAD"; } Label lbltitle = new Label(); lbltitle.Text = s.ComplaintTitle; PanelComplaintTitle.Controls.Add(lbltitle); Label lblStatusComplaint = new Label(); if (s.ComplaintStatus.ToString() == "False") { lblStatusComplaint.Text = "Not Solved"; } else { lblStatusComplaint.Text = "Solved"; PanelResolveComplaint.CssClass = " d-none"; hypCacnel.NavigateUrl = "~/Complaints/Admin/AdminComplaint.aspx?Closed=1"; } PanelStatusComplaint.Controls.Add(lblStatusComplaint); //Complaint Description Label lblComplaintDesription = new Label(); lblComplaintDesription.Text = s.ComplaintDescription; PanelComplaintDescription.Controls.Add(lblComplaintDesription); //Date Label lblCreation = new Label(); lblCreation.Text = s.ComplaintCreationDate.ToString(); PanelCreation.Controls.Add(lblCreation); //User Data var userid = s.UserID; tblPtclUser a = db.tblPtclUsers.FirstOrDefault(b => b.UserID == userid); //Regerate Label lblRegenerate = new Label(); if (s.RegeneratedID == 0 || s.RegeneratedID == null) { lblRegenerate.Text = "Nooo"; } else { lblRegenerate.Text = "Yess"; HypParentComplaint.Visible = true; HypParentComplaint.Text = "Goto Parent"; HypParentComplaint.NavigateUrl = "~/Complaints/Admin/AdminComplaintDetails.aspx?ComplaintID=" + s.RegeneratedID; } PanelRegenerate.Controls.Add(lblRegenerate); //FullName Label lblFullName = new Label(); lblFullName.Text = a.FirstName + " " + a.LastName; PanelFullName.Controls.Add(lblFullName); Label lblFirstName = new Label(); lblFirstName.Text = a.FirstName; PanelFirstName.Controls.Add(lblFirstName); Label lblEmail = new Label(); lblEmail.Text = a.EmailAddress; PanelEmail.Controls.Add(lblEmail); Label LblPhone = new Label(); LblPhone.Text = a.Phone; PanelPhone.Controls.Add(LblPhone); if (a.CustomerDP != "" && a.CustomerDP != null) { CustomerPic.ImageUrl = "../../UploadFiles/CustomerProfile/" + a.CustomerDP; } else { } HypEmailIcon.NavigateUrl = "mailto:" + a.EmailAddress; HypCustomerProfile.NavigateUrl = "~/ManageAccounts/Admin/AdminCustomersProfile.aspx?UserID=" + userid + "&ComplaintID=" + ComplaintID; var complaintTypeID = s.ComplaintTypeID; tblComplaintType c = db.tblComplaintTypes.FirstOrDefault(d => d.ComplaintTypeID == complaintTypeID); Label lblcomplaintTypeID = new Label(); lblcomplaintTypeID.Text = c.ComplaintTypeName; PanelComplaintType.Controls.Add(lblcomplaintTypeID); } } }