Exemple #1
0
        protected void cmdLoginUser_Click(object sender, EventArgs e)
        {
            using (PTCLEntities db = new PTCLEntities())
            {
                var password = txtPassword.Text;
                var salt     = CreateSalt();
                var hash     = HashPassword(password, salt);

                var query = db.PtclUserLogin(txtEmail.Text, Convert.ToBase64String(hash)).ToList();
                //var query = db.PtclUserLogin(txtEmail.Text, txtPassword.Text).ToList();
                if (query.Count > 0)
                {
                    Session["UserID"]    = query[0].UserID;
                    Session["FirstName"] = query[0].FirstName;
                    Session.Timeout      = 720;

                    Response.Cookies["PCS"]["UserID"]    = query[0].UserID.ToString();
                    Response.Cookies["PCS"]["FirstName"] = query[0].FirstName.ToString();
                    Response.Cookies["PCS"].Expires      = DateTime.Now.AddDays(1);

                    Response.Redirect("Home.aspx");
                }
                else
                {
                    lblMsg.Text = "Invalid Email or Password";
                }
            }
        }
        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);
                }
            }
        }
Exemple #3
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 Page_Load(object sender, EventArgs e)
        {
            HyperLink activeHyp = Master.FindControl("HypReport") as HyperLink;

            activeHyp.CssClass         += " active";
            GVAdmin.UseAccessibleHeader = true;

            if (!IsPostBack)
            {
                GridFill();
            }

            using (PTCLEntities db = new PTCLEntities())
            {
                //object create
                if (IsPostBack == true)
                {
                    return;
                }

                var MainCategory = db.GetPtclAdmins().ToList();
                ddlAdmins.DataSource     = MainCategory;
                ddlAdmins.DataTextField  = "UserName";
                ddlAdmins.DataValueField = "AdminID";
                ddlAdmins.DataBind();
                ddlAdmins.Items.Insert(0, new ListItem("--Select--", "0"));

                var SubCategory = db.spGetLocation().ToList();
                ddlLocation.DataSource     = SubCategory;
                ddlLocation.DataTextField  = "LocationName";
                ddlLocation.DataValueField = "LocationID";
                ddlLocation.DataBind();
                ddlLocation.Items.Insert(0, new ListItem("--Select--", "1"));
            }
        }
        protected void ApprovedGridView()
        {
            using (PTCLEntities db = new PTCLEntities())
            {
                var UserID = Convert.ToInt32(Session["UserID"]);

                var MyApprovedComplaintData = db.MyApprovedComplaint(UserID).ToList();
                GVApprovedComplaint.DataSource = MyApprovedComplaintData;
                GVApprovedComplaint.DataBind();
            }
        }
 protected void GV_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "delete")
     {
         int ComplaintID = Convert.ToInt32(e.CommandArgument);
         Response.Write(ComplaintID);
         using (PTCLEntities db = new PTCLEntities())
         {
             db.DeleteComplaint(ComplaintID);
         }
         PendingGridView();
     }
 }
 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;
     }
 }
Exemple #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (PTCLEntities db = new PTCLEntities())
     {
         if (IsPostBack == true)
         {
             return;
         }
         var LocationData = db.spGetLocation().ToList();
         ddlLocationCode.DataSource     = LocationData;
         ddlLocationCode.DataTextField  = "LocationCode";
         ddlLocationCode.DataValueField = "LocationID";
         ddlLocationCode.DataBind();
     }
 }
 protected void GVAdmin_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "edit")
     {
         Response.Redirect("AdminSetup.aspx?AdminID=" + e.CommandArgument);
     }
     else if (e.CommandName == "delete")
     {
         int AdminID = Convert.ToInt32(e.CommandArgument);
         using (PTCLEntities db = new PTCLEntities())
         {
             db.DeletePtclAdmin(AdminID);
         }
         FillAdmin();
     }
 }
 protected void GV_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "edit")
     {
         Response.Redirect("CustomerSetup.aspx?UserID=" + e.CommandArgument);
     }
     else if (e.CommandName == "delete")
     {
         int UserID = Convert.ToInt32(e.CommandArgument);
         using (PTCLEntities db = new PTCLEntities())
         {
             db.DeletePtlcUser(UserID);
         }
         FillUsers();
     }
 }
 protected void RegeneratedGridView()
 {
     using (PTCLEntities db = new PTCLEntities())
     {
         var MyRegeneratedComplaintData = db.spGetRegeneratedComplaints().ToList();
         GVRegeneratedComplaint.DataSource = MyRegeneratedComplaintData;
         GVRegeneratedComplaint.DataBind();
         if (GVRegeneratedComplaint.Rows.Count > 0)
         {
             GVRegeneratedComplaint.HeaderRow.TableSection = TableRowSection.TableHeader;
         }
         else
         {
             lblTableRegeneratedMsg.Text = "No Record to Show";
         }
     }
 }
        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 FillAdmin()
 {
     using (PTCLEntities db = new PTCLEntities())
     {
         var Admins = db.GetPtclAdmins().ToList();
         GVAdmin.DataSource = Admins;
         GVAdmin.DataBind();
         GVAdmin.UseAccessibleHeader = true;
         if (GVAdmin.Rows.Count > 0)
         {
             GVAdmin.HeaderRow.TableSection = TableRowSection.TableHeader;
         }
         else
         {
             lblAdminmsg.Text = "No Record to Show";
         }
     }
 }
 protected void FillUsers()
 {
     using (PTCLEntities db = new PTCLEntities())
     {
         var Users = db.GetPtclUsers().ToList();
         GVCustomers.DataSource = Users;
         GVCustomers.DataBind();
         GVCustomers.UseAccessibleHeader = true;
         if (GVCustomers.Rows.Count > 0)
         {
             GVCustomers.HeaderRow.TableSection = TableRowSection.TableHeader;
         }
         else
         {
             lblCustomersMsg.Text = "No Record to Show";
         }
     }
 }
 protected void GridFill()
 {
     using (PTCLEntities db = new PTCLEntities())
     {
         var Users = db.spUserWithLocation().ToList();
         grdViewDetail.DataSource = Users;
         grdViewDetail.DataBind();
         grdViewDetail.UseAccessibleHeader = true;
         if (grdViewDetail.Rows.Count > 0)
         {
             grdViewDetail.HeaderRow.TableSection = TableRowSection.TableHeader;
         }
         else
         {
             lblCustomersMsg.Text = "No Record to Show";
         }
     }
 }
 protected void ApprovedGridView()
 {
     using (PTCLEntities db = new PTCLEntities())
     {
         var MyApprovedComplaintData = db.AdminApprovedComplaint().ToList();
         GVApprovedComplaint.DataSource = MyApprovedComplaintData;
         GVApprovedComplaint.DataBind();
         GVApprovedComplaint.UseAccessibleHeader = true;
         if (GVApprovedComplaint.Rows.Count > 0)
         {
             GVApprovedComplaint.HeaderRow.TableSection = TableRowSection.TableHeader;
         }
         else
         {
             lblTableClosedMsg.Text = "No Record to Show";
         }
     }
 }
Exemple #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HyperLink activeHyp = Master.FindControl("HypDashBoard") as HyperLink;

            activeHyp.CssClass += " active";
            using (PTCLEntities db = new PTCLEntities())
            {
                if (Session["UserID"] != null)
                {
                    //int UserID = (int)Session["UserID"];
                    int UserID     = (int)Convert.ToUInt32(Session["UserID"]);
                    var totalCount = db.GetMyComplaints(UserID).ToList();

                    int count = totalCount.Count;
                    lblActiveComplaints.Text = count.ToString();
                }
            }
        }
        protected void PendingGridView()
        {
            using (PTCLEntities db = new PTCLEntities())
            {
                var PendingComplaintsData = db.ActiveC().ToList();
                GVPendingComplaint.DataSource = PendingComplaintsData;
                GVPendingComplaint.DataBind();
                GVPendingComplaint.UseAccessibleHeader = true;

                if (GVPendingComplaint.Rows.Count > 0)
                {
                    GVPendingComplaint.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
                else
                {
                    lblTablePendingMsg.Text = "No Record to Show";
                }
            }
        }
        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["AdminID"] != null)
                {
                    int      AdminID = Convert.ToInt32(Request.QueryString["AdminID"]);
                    tblAdmin s       = db.tblAdmins.FirstOrDefault(v => v.AdminID == AdminID);
                    txtUserName.Text        = s.UserName;
                    txtPassword.Text        = s.Password;
                    txtConfirmPassword.Text = s.Password;
                    txtFullName.Text        = s.FullName;
                    txtEmailAddress.Text    = s.EmailAddress;
                    txtPhone.Text           = s.AdminPhone.ToString();
                    txtLocation.Text        = s.Location;
                    lblUpload.Text          = s.AdminDP;

                    //txtStatus.Text = s.Status;
                    //Response.Write(s.Status);

                    if (s.Status == true)
                    {
                        ddlStatus.SelectedValue = "true";
                    }
                    else
                    {
                        ddlStatus.SelectedValue = "false";
                    }
                }
                if ((Request.QueryString["profile"] == "me"))
                {
                    HypCancel.NavigateUrl = "~/ManageAccounts/Admin/AdminProfile.aspx";
                }
                ;
            }
        }
 protected void GridFill()
 {
     using (PTCLEntities db = new PTCLEntities())
     {
         var reportData = db.spReportData().ToList();
         GVAdmin.DataSource          = reportData;
         GVAdmin.UseAccessibleHeader = true;
         if (GVAdmin.Rows.Count > 0)
         {
             GVAdmin.HeaderRow.TableSection = TableRowSection.TableHeader;
             lblAdminmsg.Text = "";
         }
         else
         {
             ;
         }
         GVAdmin.DataBind();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            HyperLink activeHyp = Master.FindControl("HypComplaint") as HyperLink;

            activeHyp.CssClass += " active";
            PendingGridView();
            ApprovedGridView();
            if (Request.QueryString["register"] == "1")
            {
                if (Request.QueryString["ComplaintID"] != null)
                {
                    RegeneratedArea.CssClass = " my-3";
                    txtParentID.Text         = Request.QueryString["ComplaintID"];
                }

                lblTitle.Text = "Register Your Complaint";
                PanelRegisterComplaint.CssClass = " ";
            }
            if (Request.QueryString["Active"] == "1")
            {
                lblTitle.Text = "Active Complaints";
                PanelPendingComplaint.CssClass = " ";
            }
            if (Request.QueryString["closed"] == "1")
            {
                lblTitle.Text = "Closed Complaints";
                PanelApprovedComplaint.CssClass = " ";
            }
            using (PTCLEntities db = new PTCLEntities())
            {
                if (IsPostBack == true)
                {
                    return;
                }
                ddlComplaint.SelectedValue = "7";
                var ComplaintTypes = db.GetComplaintType().ToList();
                ddlComplaint.DataSource     = ComplaintTypes;
                ddlComplaint.DataTextField  = "ComplaintTypeName";
                ddlComplaint.DataValueField = "ComplaintTypeID";
                ddlComplaint.DataBind();
            }
        }
        protected void PendingGridView()
        {
            using (PTCLEntities db = new PTCLEntities())
            {
                var UserID = Convert.ToInt32(Session["UserID"]);
                //change bad ma
                var PendingComplaintsData = db.UserPendingComplaints(UserID).ToList();
                GVPendingComplaint.DataSource = PendingComplaintsData;
                GVPendingComplaint.DataBind();

                var totalCount = db.GetMyComplaints(UserID).ToList();
                int count      = totalCount.Count;
                if (count > 10)
                {
                    Response.Write("Limit Exceed");
                    RegisterComplaintSection.CssClass = " d-none";
                    PanelOverLimit.CssClass           = " ";
                }
            }
        }
        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 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 btnSearch_Click(object sender, EventArgs e)
        {
            if (ddlAdmins.SelectedValue == "0")
            {
                lblAdminmsg.Text = "Please Select Admins";
            }

            if (ddlLocation.SelectedValue == "1")
            {
                lblAdminmsg.Text = "Please Select Location";
            }
            using (PTCLEntities db = new PTCLEntities())
            {
                if (ddlAdmins.SelectedItem.Text == null && ddlLocation.SelectedItem.Text == null)
                {
                    lblAdminmsg.Text = "Please Select both CheckBoxes";
                }
                else
                {
                    int adminValue    = Convert.ToInt32(ddlAdmins.SelectedValue);
                    int LocationValue = Convert.ToInt32(ddlLocation.SelectedValue);

                    var reportData = db.spFilterAdminWithLocation(adminValue, LocationValue).ToList();
                    GVAdmin.DataSource = reportData;
                }

                GVAdmin.DataBind();
                GVAdmin.UseAccessibleHeader = true;
                if (GVAdmin.Rows.Count > 0)
                {
                    GVAdmin.HeaderRow.TableSection = TableRowSection.TableHeader;
                    lblAdminmsg.Text = "";
                }
                else
                {
                    lblAdminmsg.Text = "No Record to Show";
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            HyperLink activeHyp = Master.FindControl("HypDashBoard") as HyperLink;

            activeHyp.CssClass += " active";

            using (PTCLEntities db = new PTCLEntities())
            {
                if (Session["AdminID"] != null)
                {
                    var totalCustomerCount = db.GetPtclUsers().ToList();
                    int counCustomer       = totalCustomerCount.Count;
                    lblTotalCustomers.Text = counCustomer.ToString();

                    var totalAdminCount = db.GetPtclAdmins().ToList();
                    int counAdmins      = totalAdminCount.Count;
                    LblTotalAdmins.Text = counAdmins.ToString();

                    var totalComplaints   = db.GetComplaints().ToList();
                    int mytotalComplaints = totalComplaints.Count;
                    lblTotalComplaints.Text = mytotalComplaints.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";
                 * }*/
            }
        }
Exemple #29
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";
                }
            }
        }
        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";
                    }
                }
            }
        }