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);
                }
            }
        }
コード例 #2
0
        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");
                }
            }
        }
コード例 #3
0
        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";
                }
            }
        }
コード例 #4
0
        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";
                 * }*/
            }
        }
コード例 #5
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";
                }
            }
        }
コード例 #6
0
        protected void cmdCreate_Click(object sender, EventArgs e)
        {
            using (PTCLEntities db = new PTCLEntities())
            {
                if (Request.QueryString["AdminID"] == null)
                {
                    tblAdmin s = new tblAdmin();
                    s.UserName = txtUserName.Text;
                    //s.Password = txtPassword.Text;
                    s.FullName     = txtFullName.Text;
                    s.EmailAddress = txtEmailAddress.Text;
                    s.Location     = txtLocation.Text;
                    s.AdminPhone   = txtPhone.Text;

                    if (FileUpload.HasFile)
                    {
                        FileUpload.SaveAs(Server.MapPath("../../UploadFiles/AdminProfile/" + FileUpload.FileName));
                        s.AdminDP = FileUpload.FileName;
                    }
                    else
                    {
                        s.AdminDP = "";
                    }

                    var password = txtPassword.Text;
                    var salt     = CreateSalt();
                    var hash     = HashPassword(password, salt);
                    s.Password = Convert.ToBase64String(hash);

                    //s.Status = txtStatus.Text;
                    s.Status = bool.Parse(ddlStatus.SelectedValue.ToString());
                    // s.Status = Boolean.TryParse(ddlStatus.SelectedValue.ToString);
                    var check  = db.uniqueEmail(txtEmailAddress.Text).ToList();
                    var check1 = db.uniqueUserName(txtUserName.Text).ToList();
                    if (check.Count == 0)
                    {
                        if (check1.Count == 0)
                        {
                            db.tblAdmins.Add(s);
                            db.SaveChanges();
                            lblMsg.Text = "Admin Inserted Successfully";
                        }
                        else
                        {
                            lblMsg.Text = "UserName Already Takken";
                        }
                    }
                    else
                    {
                        lblMsg.Text = "Email Already Takken";
                    }
                }
                else
                {
                    var      password = txtPassword.Text;
                    var      salt     = CreateSalt();
                    var      hash     = HashPassword(password, salt);
                    int      AdminID  = Convert.ToInt32(Request.QueryString["AdminID"]);
                    tblAdmin s        = db.tblAdmins.FirstOrDefault(v => v.AdminID == AdminID);
                    s.Password = Convert.ToBase64String(hash);
                    s.UserName = txtUserName.Text;
                    //s.Password = txtPassword.Text;
                    s.FullName     = txtFullName.Text;
                    s.EmailAddress = txtEmailAddress.Text;
                    s.Location     = txtLocation.Text;
                    s.AdminPhone   = txtPhone.Text;

                    if (FileUpload.HasFile)
                    {
                        FileUpload.SaveAs(Server.MapPath("../../UploadFiles/AdminProfile/" + FileUpload.FileName));
                        s.AdminDP = FileUpload.FileName;
                    }
                    else
                    {
                        s.AdminDP = "";
                    }

                    //s.Status = txtStatus.Text;
                    s.Status = bool.Parse(ddlStatus.SelectedValue);
                    //s.Status = bool.Parse(ddlStatus.SelectedValue.ToString());
                    //s.Status = Convert.ToBoolean(ddlStatus.SelectedValue);
                    var check  = db.uniqueEmail(txtEmailAddress.Text).ToList();
                    var check1 = db.uniqueUserName(txtUserName.Text).ToList();
                    if (check.Count == 1)
                    {
                        if (check1.Count == 1)
                        {
                            db.SaveChanges();
                            lblMsg.Text = "Admin Updated Successfully";
                        }
                        else
                        {
                            lblMsg.Text = "UserName Already Takken";
                        }
                    }
                    else
                    {
                        lblMsg.Text = "Email Already Takken";
                    }
                }
            }
        }