Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["UserID"] != null)
            {
                using (PTCLEntities db = new PTCLEntities())
                {
                    if (IsPostBack == true)
                    {
                        return;
                    }
                    ddMonthList.SelectedValue = "0";
                    int         UserID = Convert.ToInt32(Request.QueryString["UserID"]);
                    tblPtclUser s      = db.tblPtclUsers.FirstOrDefault(v => v.UserID == UserID);
                    lblBillName.Text = s.FirstName + " " + s.LastName;
                    lbluserID.Text   = s.UserID.ToString();

                    DateTime dateAndTime = DateTime.Now.AddDays(10);
                    lblDueDate.Text = "Due Date: " + dateAndTime.ToString("dd/MM/yyyy");

                    tblLandline.Text = s.landline;

                    //location
                    tblUserLocation l = db.tblUserLocations.FirstOrDefault(x => x.LocationID == s.LocationID);
                    if (l.LocationName.ToString() == "")
                    {
                        lblLocation.Text = "No location";
                    }
                    else
                    {
                        lblLocation.Text = l.LocationName;
                    }
                    FillList();
                }
            }
        }
        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);
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["UserID"] == null)
     {
         Response.Redirect("~/UserLogin.aspx");
     }
     using (PTCLEntities db = new PTCLEntities())
     {
         int         UserID = Convert.ToInt32(Session["UserID"]);
         tblPtclUser s      = db.tblPtclUsers.FirstOrDefault(v => v.UserID == UserID);
         //lblName.Text = s.UserName;
         lblName.Text = "Login as: " + s.FirstName;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            txtPassword.Attributes["type"]        = "password";
            txtConfirmPassword.Attributes["type"] = "password";

            using (PTCLEntities db = new PTCLEntities())
            {
                if (IsPostBack == true)
                {
                    return;
                }
                if (Request.QueryString["UserID"] != null)
                {
                    int         UserID = Convert.ToInt32(Request.QueryString["UserID"]);
                    tblPtclUser s      = db.tblPtclUsers.FirstOrDefault(v => v.UserID == UserID);
                    txtFirstName.Text = s.FirstName;
                    txtLastName.Text  = s.LastName;
                    txtEmail.Text     = s.EmailAddress;
                    txtPhone.Text     = s.Phone;
                    //txtStatus.Text = s.Status.ToString();
                    txtCnic.Text            = s.Cnic;
                    txtPassword.Text        = s.Password;
                    txtConfirmPassword.Text = s.Password;
                    lblCustomer.Text        = "Manage " + s.FirstName;

                    //Response.Write(s.Status);
                    if (Convert.ToInt32(s.Status) == 1)
                    {
                        ddlStatus.SelectedValue = "1";
                    }
                    else
                    {
                        ddlStatus.SelectedValue = "0";
                    }
                    if (Request.QueryString["back"] == "1")
                    {
                        HypGoBack.NavigateUrl = "~/ManageAccounts/Admin/AdminCustomersProfile.aspx?UserID=" + UserID + "&ComplaintID=" + Request.QueryString["ComplaintID"];
                    }
                    else
                    {
                        HypGoBack.NavigateUrl = "~/ManageCustomers/Admin/AdminManageCustomers.aspx";
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            HyperLink activeHyp = Master.FindControl("HypProfile") as HyperLink;

            activeHyp.CssClass += " active";

            txtPassword.Attributes["type"]        = "password";
            txtConfirmPassword.Attributes["type"] = "password";

            using (PTCLEntities db = new PTCLEntities())
            {
                if (IsPostBack == true)
                {
                    return;
                }
                var DataLocation = db.spGetLocation().ToList();
                ddlLocationCode.DataSource     = DataLocation;
                ddlLocationCode.DataTextField  = "LocationCode";
                ddlLocationCode.DataValueField = "LocationID";
                ddlLocationCode.DataBind();

                if (Session["UserID"] != null)
                {
                    int         UserID = Convert.ToInt32(Session["UserID"]);
                    tblPtclUser s      = db.tblPtclUsers.FirstOrDefault(v => v.UserID == UserID);
                    txtMyName.Text          = s.FirstName;
                    txtLastName.Text        = s.LastName;
                    txtEmail.Text           = s.EmailAddress;
                    txtPhone.Text           = s.Phone;
                    txtCnic.Text            = s.Cnic;
                    txtPassword.Text        = s.Password;
                    txtConfirmPassword.Text = s.Password;
                    txtStatus.Text          = s.Status.ToString();
                    //txtLocation.Text = s.CustomerLocation;
                    lblUpload.Text                = s.CustomerDP;
                    txtLandLineNumber.Text        = s.landline;
                    ddlLocationCode.SelectedValue = s.LocationID.ToString();
                }
            }
        }
        protected void cmdSubmit_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["UserID"] != null)
            {
                using (PTCLEntities db = new PTCLEntities())
                {
                    int         UserID = Convert.ToInt32(Request.QueryString["UserID"]);
                    tblPtclUser s      = db.tblPtclUsers.FirstOrDefault(v => v.UserID == UserID);
                    s.FirstName    = txtFirstName.Text;
                    s.LastName     = txtLastName.Text;
                    s.EmailAddress = txtEmail.Text;
                    s.Phone        = txtPhone.Text;
                    //s.Status = bool.Parse(txtStatus.Text);
                    s.Status = bool.Parse(ddlStatus.SelectedItem.Text);
                    //s.Status = ddlStatus.SelectedValue.ToString();

                    s.Cnic     = txtCnic.Text;
                    s.Password = txtPassword.Text;
                    s.Password = txtConfirmPassword.Text;
                    db.SaveChanges();
                    lblMsg.Text = "Customer Updated Successfully";
                }
            }
        }
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            using (PTCLEntities db = new PTCLEntities())
            {
                if (Session["UserID"] != null)
                {
                    int         UserID = Convert.ToInt32(Session["UserID"]);
                    tblPtclUser u      = db.tblPtclUsers.FirstOrDefault(v => v.UserID == UserID);
                    u.FirstName    = txtMyName.Text;
                    u.LastName     = txtLastName.Text;
                    u.EmailAddress = txtEmail.Text;
                    u.Phone        = txtPhone.Text;
                    u.Cnic         = txtCnic.Text;
                    //u.Password = txtPassword.Text;
                    u.landline = txtLandLineNumber.Text;

                    var password = txtPassword.Text;
                    var salt     = CreateSalt();
                    var hash     = HashPassword(password, salt);

                    u.LocationID = Convert.ToInt32(ddlLocationCode.SelectedValue);
                    u.Password   = (Convert.ToBase64String(hash));

                    if (FileUpload.HasFile)
                    {
                        FileUpload.SaveAs(Server.MapPath("../../UploadFiles/CustomerProfile/" + FileUpload.FileName));
                        u.CustomerDP = FileUpload.FileName;
                    }
                    else
                    {
                        u.CustomerDP = "";
                    }

                    var check  = db.uniqueEmail(txtEmail.Text).ToList();
                    var check1 = db.spUniqueLandline(txtLandLineNumber.Text).ToList();
                    if (check.Count == 1)
                    {
                        if (check1.Count == 1)
                        {
                            db.tblPtclUsers.Add(u);
                            db.SaveChanges();
                            lblMsg.Text = "Registration Completed Succcessfully";
                        }
                        else
                        {
                            lblMsg.Text = "LandLine Already Takken";
                        }
                    }
                    else
                    {
                        lblMsg.Text = "Email Already Takken";
                    }
                }

                /*var check = db.uniqueEmail(txtEmail.Text).ToList();
                 * var check1 = db.spUniqueLandline(txtLandLineNumber.Text).ToList();
                 *
                 * if (u.landline == txtLandLineNumber.Text || u.EmailAddress == txtEmail.Text)
                 * {
                 *  db.SaveChanges();
                 *  lblMsg.Text = "Registration Completed Succcessfully";
                 * }
                 * else if (check.Count == 0)
                 * {
                 *  if (check1.Count == 0)
                 *  {
                 *      db.SaveChanges();
                 *      lblMsg.Text = "Registration Completed Succcessfully";
                 *  }
                 *  else
                 *  {
                 *      lblMsg.Text = "LandLine Already Takken";
                 *  }
                 * }
                 * else
                 *  lblMsg.Text = "Email Already Takken";
                 * }*/
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            HyperLink activeHyp = Master.FindControl("HypProfile") as HyperLink;

            activeHyp.CssClass += " active";

            using (PTCLEntities db = new PTCLEntities())
            {
                if (IsPostBack == true)
                {
                    return;
                }
                //User Session
                if (Session["UserID"] != null)
                {
                    int         UserID = Convert.ToInt32(Session["UserID"]);
                    tblPtclUser s      = db.tblPtclUsers.FirstOrDefault(v => v.UserID == UserID);

                    tblUserLocation l = db.tblUserLocations.FirstOrDefault(x => x.LocationID == s.LocationID);

                    Label lblFirstName = new Label();
                    lblFirstName.Text = s.FirstName;
                    PanelFirstName.Controls.Add(lblFirstName);

                    Label lblLocation = new Label();
                    if (l.LocationName.ToString() == "")
                    {
                        lblLocation.Text = "No location";
                    }
                    else
                    {
                        lblLocation.Text = l.LocationName;
                    }
                    PanelLocationName.Controls.Add(lblLocation);

                    Label lblLandline = new Label();
                    lblLandline.Text = "Landline:  " + s.landline;
                    PanelLandline.Controls.Add(lblLandline);

                    Label LblFullName = new Label();
                    LblFullName.Text = s.FirstName + " " + s.LastName;
                    PanelFullName.Controls.Add(LblFullName);

                    Label lblEmail = new Label();
                    lblEmail.Text = s.EmailAddress;
                    PanelEmail.Controls.Add(lblEmail);

                    Label lblCnic = new Label();
                    lblCnic.Text = s.Cnic;
                    PanelCnic.Controls.Add(lblCnic);

                    Label lblPhone = new Label();
                    lblPhone.Text = s.Phone;
                    PanelPhone.Controls.Add(lblPhone);

                    Label lblStatus = new Label();
                    if (s.Status.ToString() == "True")
                    {
                        lblStatus.Text = "Active";
                    }
                    else
                    {
                        lblStatus.Text = "Inactive";
                    }
                    PanelStatus.Controls.Add(lblStatus);

                    if (s.CustomerDP != "" && s.CustomerDP != null)
                    {
                        userPic.ImageUrl = "../../UploadFiles/CustomerProfile/" + s.CustomerDP;
                    }
                    else
                    {
                        userPic.ImageUrl = "../../assets/img/avatar.png";
                    }
                }
            }
        }
Exemple #9
0
        //Hashing End8 */

        protected void cmdRegister_Click(object sender, EventArgs e)
        {
            using (PTCLEntities db = new PTCLEntities())
            {
                tblPtclUser u = new tblPtclUser();
                u.FirstName    = txtFirstName.Text;
                u.LastName     = txtLastName.Text;
                u.EmailAddress = txtEmail.Text;
                u.Cnic         = txtCnic.Text;
                u.Phone        = txtPhone.Text;
                u.Status       = true;

                u.landline = txtLandLineNumber.Text;

                //Location Code
                u.LocationID = Convert.ToInt32(ddlLocationCode.SelectedValue);

                if (FileUpload.HasFile)
                {
                    FileUpload.SaveAs(Server.MapPath("UploadFiles/CustomerProfile/" + FileUpload.FileName));
                    u.CustomerDP = FileUpload.FileName;
                }
                else
                {
                    u.CustomerDP = "";
                }

                //u.Password = txtPassword.Text;

                //hashing password start
                var password = txtPassword.Text;
                var salt     = CreateSalt();
                var hash     = HashPassword(password, salt);
                //Response.Write(Convert.ToBase64String(hash));
                u.Password = (Convert.ToBase64String(hash));

                //hashing password end

                var check  = db.uniqueEmail(txtEmail.Text).ToList();
                var check1 = db.spUniqueLandline(txtLandLineNumber.Text).ToList();
                //Response.Write(check.Count);

                if (check.Count == 0)
                {
                    if (check1.Count == 0)
                    {
                        db.tblPtclUsers.Add(u);
                        db.SaveChanges();
                        lblMsg.Text = "Registration Completed Succcessfully";
                    }
                    else
                    {
                        lblMsg.Text = "LandLine Already Takken";
                    }
                }
                else
                {
                    lblMsg.Text = "Email Already Takken";
                }
            }
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["UserID"] != null)
            {
                using (PTCLEntities db = new PTCLEntities())
                {
                    int         UserID = Convert.ToInt32(Request.QueryString["UserID"]);
                    tblPtclUser a      = db.tblPtclUsers.FirstOrDefault(b => b.UserID == UserID);

                    //Total Comapints
                    var GetMyComplaints = db.GetMyComplaints(UserID).ToList();
                    int countTotalCom   = GetMyComplaints.Count;
                    //Response.Write(countTotalCom);
                    Label lblTotalC = new Label();
                    lblTotalC.Text = countTotalCom.ToString();
                    PanelTotalC.Controls.Add(lblTotalC);

                    //Active Comapints
                    var ActiveComplaints = db.GetCustomerActiveComplaint(UserID).ToList();
                    int countActiveCom   = ActiveComplaints.Count;
                    //Response.Write(countTotalCom);
                    Label lblActiveC = new Label();
                    lblActiveC.Text = countActiveCom.ToString();
                    PanelActiveC.Controls.Add(lblActiveC);

                    Label lblFirstName = new Label();
                    lblFirstName.Text = a.FirstName;
                    PanelFirstName.Controls.Add(lblFirstName);


                    Label LblFullName = new Label();
                    LblFullName.Text = a.FirstName + " " + a.LastName;
                    PanelFullName.Controls.Add(LblFullName);

                    Label lblEmail = new Label();
                    lblEmail.Text = a.EmailAddress;
                    PanelEmail.Controls.Add(lblEmail);

                    Label lblCnic = new Label();
                    lblCnic.Text = a.Cnic;
                    PanelCnic.Controls.Add(lblCnic);

                    Label lblPhone = new Label();
                    lblPhone.Text = a.Phone;
                    PanelPhone.Controls.Add(lblPhone);

                    Label lblStatus = new Label();
                    if (a.Status.ToString() == "True")
                    {
                        lblStatus.Text = "Status (Active)";
                    }
                    else
                    {
                        lblStatus.Text = "Status (Inactive)";
                    }
                    PanelStatus.Controls.Add(lblStatus);

                    if (a.CustomerDP != "" && a.CustomerDP != null)
                    {
                        userPic.ImageUrl = "../../UploadFiles/CustomerProfile/" + a.CustomerDP;
                    }
                    else
                    {
                        userPic.ImageUrl = "../../assets/img/avatar.png";
                    }

                    if (Request.QueryString["ComplaintID"] != null)
                    {
                        int ComplaintID = Convert.ToInt32(Request.QueryString["ComplaintID"]);
                        HypEditProfile.NavigateUrl = "~/ManageCustomers/Admin/CustomerSetup.aspx?UserID=" + UserID + "&back=1" + "&ComplaintID=" + ComplaintID;
                        HypBack.NavigateUrl        = "~/Complaints/Admin/AdminComplaintDetails.aspx?ComplaintID=" + ComplaintID;
                    }
                }
            }
        }
        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);
                }
            }
        }