示例#1
0
    protected void button2_Click(object sender, EventArgs e)
    {
        InternshipProgramEntities ipe = new InternshipProgramEntities();
        Education us = new Education();

        us.InternID   = int.Parse(Request.QueryString["id"]);
        us.Supervisor = int.Parse(sup.Value);
        us.Deptmnt    = int.Parse(dp.Value);
        us.JoinDate   = DateTime.Parse(jd.Value);
        if (us.EndDate != null)
        {
            us.EndDate = DateTime.Parse(ed.Value);
        }
        us.Major = mjr.Value;
        HttpPostedFile f     = Request.Files["cv"];
        string         fpath = System.IO.Path.GetFileName(f.FileName);

        f.SaveAs(Server.MapPath(System.IO.Path.Combine("~/CVs/", fpath)));
        HttpPostedFile a     = Request.Files["dgr"];
        string         apath = System.IO.Path.GetFileName(f.FileName);

        a.SaveAs(Server.MapPath(System.IO.Path.Combine("~/Degrees/", apath)));
        HttpPostedFile c     = Request.Files["gc"];
        string         cpath = System.IO.Path.GetFileName(f.FileName);

        c.SaveAs(Server.MapPath(System.IO.Path.Combine("~/GradCerts/", cpath)));
        us.CV       = "/CVs/" + fpath;
        us.Degree   = "/Degrees/" + apath;
        us.GradCert = "/GradCerts/" + cpath;
        ipe.AddToEducations(us);
        ipe.SaveChanges();
        Response.Redirect("/index.aspx");
    }
示例#2
0
    protected void Unnamed2_Click(object sender, EventArgs e)
    {
        InternshipProgramEntities ipe = new InternshipProgramEntities();
        Intern1 inte = new Intern1();

        HttpPostedFile f     = Request.Files["photo"];
        string         fpath = System.IO.Path.GetFileName(f.FileName);

        f.SaveAs(Server.MapPath(System.IO.Path.Combine("~/images/", fpath)));
        HttpPostedFile a     = Request.Files["card"];
        string         apath = System.IO.Path.GetFileName(a.FileName);

        a.SaveAs(Server.MapPath(System.IO.Path.Combine("~/App_Data/", apath)));

        inte.adress       = res.Text;
        inte.dob          = DateTime.Parse(dob.Text);
        inte.Email        = email.Text;
        inte.FirstName    = fname.Text;
        inte.LastName     = lname.Text;
        inte.photo        = "/images/" + fpath;
        inte.Mobile       = int.Parse(pn.Text);
        inte.placeofbirth = bp.Text;
        inte.identitycard = "/App_data/" + apath;
        ipe.AddToIntern1(inte);
        ipe.SaveChanges();
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Roles.IsUserInRole("admin"))
        {
            Response.Write("<script>alert('You dont have permission')</script>");
            Response.Redirect("./index.aspx");
        }
        InternshipProgramEntities ipe = new InternshipProgramEntities();
        Education c = ipe.Educations.ToList().Where(x => x.InternID == int.Parse(Request.QueryString["id"].ToString())).FirstOrDefault();

        if (c != null)
        {
            Response.Redirect("/educate.aspx?id=" + Request.QueryString["id"]);
        }
        var users = ipe.User_Details;

        foreach (User_Details user in users)
        {
            sup.Items.Add(new ListItem(user.First_Name.ToString() + " " + user.Last_Name.ToString(), user.Id.ToString()));
        }
        var deps = ipe.Departments;

        foreach (Department dep in deps)
        {
            dp.Items.Add(new ListItem(dep.DepName.ToString(), dep.DepID.ToString()));
        }
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        InternshipProgramEntities ipe = new InternshipProgramEntities();
        var i = ipe.Intern1.ToList();

        interncount.InnerHtml = "We have " + i.Count + " total interns";

        if (Roles.IsUserInRole("admin"))
        {
            log.InnerHtml = "Admin Panel";
            log.HRef      = "/admin.aspx";
        }
    }
示例#5
0
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        Guid newuserid = Guid.Parse(Request.QueryString["userid"].ToString());
        InternshipProgramEntities ipe = new InternshipProgramEntities();
        User_Details us = new User_Details();

        us.First_Name = fname.Text;
        us.Last_Name  = lname.Text;
        us.DoB        = DateTime.Parse(dob1.Text);
        us.UserID     = newuserid;
        ipe.AddToUser_Details(us);
        ipe.SaveChanges();
        Response.Redirect("/index.aspx");
    }
示例#6
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        InternshipProgramEntities context = new InternshipProgramEntities();
        Button  button   = (Button)sender;
        string  username = button.Parent.Parent.Parent.Parent.ID;
        Intern1 c        = new Intern1()
        {
            ID = int.Parse(username)
        };

        context.Intern1.Attach(c);
        context.Intern1.DeleteObject(c);
        context.SaveChanges();

        Response.Redirect("./Interns.aspx");
    }
示例#7
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        InternshipProgramEntities ipe = new InternshipProgramEntities();
        Intern1 c = ipe.Intern1.ToList().Where(x => x.ID == int.Parse(Request.QueryString["id"].ToString())).First();

        c.FirstName    = fn.Value;
        c.LastName     = ln.Value;
        c.dob          = DateTime.Parse(ag.Value);
        c.photo        = c.photo;
        c.identitycard = c.identitycard;
        c.placeofbirth = pob.Value;
        c.Email        = em.Value;
        c.Mobile       = int.Parse(mb.Value);
        c.adress       = ad.Value;
        ipe.SaveChanges();
    }
示例#8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     /*if (!Roles.IsUserInRole("admin"))
      * {
      *  Response.Write("<script>alert('You dont have permission')</script>");
      * }*/
     {
         InternshipProgramEntities ipe = new InternshipProgramEntities();
         Intern1 c = ipe.Intern1.ToList().Where(x => x.ID == int.Parse(Request.QueryString["id"].ToString())).First();
         fn.Value  = c.FirstName.ToString();
         ln.Value  = c.LastName.ToString();
         ag.Value  = DateTime.Parse(c.dob.ToString()).ToString("yyyy-MM-dd");
         pob.Value = c.placeofbirth.ToString();
         em.Value  = c.Email.ToString();
         mb.Value  = c.Mobile.ToString();
         ad.Value  = c.adress.ToString();
     }
 }
示例#9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Roles.IsUserInRole("admin"))
        {
            Response.Write("<script>alert('You dont have permission')</script>");
            Response.Redirect("./index.aspx");
        }
        else
        {
            InternshipProgramEntities cv = new InternshipProgramEntities();
            var usersList = Membership.GetAllUsers();


            foreach (MembershipUser userwee in usersList)
            {
                HtmlTableRow  row   = new HtmlTableRow();
                HtmlTableCell cell1 = new HtmlTableCell();
                cell1.InnerHtml = userwee.ToString();
                row.Cells.Add(cell1);
                HtmlTableCell cell2 = new HtmlTableCell();
                string[]      roles = Roles.GetRolesForUser(userwee.UserName);

                foreach (string role in roles)
                {
                    cell2.InnerHtml += role;
                }
                row.Cells.Add(cell2);
                HtmlTableCell cell3  = new HtmlTableCell();
                Button        button = new Button();
                button.Text   = "Toggle Role";
                button.ID     = userwee.UserName.ToString();
                button.Click += Button1_Click;
                cell3.Controls.Add(button);
                row.Cells.Add(cell3);
                users.Rows.Add(row);
            }

            /* HtmlTableRow row = new HtmlTableRow();
             * HtmlTableCell cell1 = new HtmlTableCell();
             * cell1.InnerHtml = "blah blah blah";
             * row.Cells.Add(cell1);
             * users.Rows.Add(row);*/
        }
    }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Roles.IsUserInRole("admin"))
        {
            Response.Write("<script>alert('You dont have permission')</script>");
            Response.Redirect("./index.aspx");
        }
        InternshipProgramEntities ipe = new InternshipProgramEntities();
        Education    c   = ipe.Educations.ToList().Where(x => x.InternID == int.Parse(Request.QueryString["id"].ToString())).First();
        User_Details ud  = ipe.User_Details.ToList().Where(x => x.Id == c.Supervisor).First();
        Department   dpa = ipe.Departments.ToList().Where(x => x.DepID == c.Deptmnt).First();

        sup.InnerHtml = ud.First_Name.ToString() + ud.Last_Name.ToString();
        dp.InnerHtml  = dpa.DepName;
        jd.InnerHtml  = c.JoinDate.ToString();
        ed.InnerHtml  = c.EndDate.ToString();
        mjr.InnerHtml = c.Major.ToString();
        cv.HRef       = c.CV;
        dgr.HRef      = c.Degree;
        gc.HRef       = c.GradCert;
    }
    protected void CreateUserWizard1_CreatedUser1(object sender, EventArgs e)
    {
        MembershipUser newUser   = Membership.GetUser(CreateUserWizard1.UserName);
        Guid           newUserID = (Guid)newUser.ProviderUserKey;

        TextBox dob1  = (TextBox)CreateUserWizard1.FindControl("dob1");
        TextBox fnam  = (TextBox)CreateUserWizard1.FindControl("fname");
        TextBox lname = (TextBox)CreateUserWizard1.FindControl("lname");

        InternshipProgramEntities ipm = new InternshipProgramEntities();
        User_Details newUserDets      = new User_Details();

        Response.Redirect("./continue.aspx?userid=" + newUserID);

        /*newUserDets.DoB = Convert.ToDateTime("1996-1-1");
         * newUserDets.First_Name = fnam.Text;
         * newUserDets.Last_Name = lname.Text;
         * System.Diagnostics.Debug.WriteLine(newUserID);
         * newUserDets.UserID = newUserID;
         * ipm.User_Details.Add(newUserDets);
         * ipm.SaveChanges();
         * //Response.Write("<script>alert('" + newUserID.ToString() + "')</script>");
         * Response.Write("<script>alert('hi')</script>");*/
    }
示例#12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        InternshipProgramEntities context = new InternshipProgramEntities();
        bool val1 = (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated;
        var  deps = context.Departments;

        foreach (Department dep in deps)
        {
            ddl.Items.Add(new System.Web.UI.WebControls.ListItem(dep.DepName.ToString(), dep.DepID.ToString()));
        }
        if (val1)
        {
            log.InnerHtml = "Welcome " + User.Identity.Name;
        }
        if (Roles.IsUserInRole("admin"))
        {
            log.InnerHtml += " Add Intern";
            log.HRef       = "./newIntern.aspx";
        }
        else if (Roles.IsUserInRole("employee"))
        {
            log.InnerHtml += "";
            log.HRef       = "";
        }
        else
        {
            log.InnerHtml = "Login/Register";
            log.HRef      = "./Login.aspx";
        }
        if (Request.QueryString.Count == 0)
        {
            var candids = context.Intern1;
            foreach (Intern1 i in candids)
            {
                HtmlGenericControl NewControl = new HtmlGenericControl("div");
                NewControl.ID = i.ID.ToString();
                HtmlTable tbl = new HtmlTable();
                //HtmlTableRow cell1 = new HtmlTableRow();
                //HtmlTableCell cll1 = new HtmlTableCell();
                //cll1.InnerHtml = string.Format("<a href='/intern.aspx?id=" + i.ID + "'><img src='" + i.photo + "' width='25%' height='25%' align='center'/></a>");
                //cell1.Cells.Add(cll1);
                HtmlTableRow  cell2 = new HtmlTableRow();
                HtmlTableCell cll2  = new HtmlTableCell();
                cll2.InnerHtml = string.Format("<a href='/intern.aspx?id=" + i.ID + "'>" + i.FirstName + " " + i.LastName + "</a>");
                cell2.Cells.Add(cll2);
                HtmlTableRow  cell3 = new HtmlTableRow();
                HtmlTableCell cll3  = new HtmlTableCell();
                cll3.InnerHtml = i.Mobile.ToString();
                cell3.Cells.Add(cll3);
                HtmlTableRow  cell4 = new HtmlTableRow();
                HtmlTableCell cll4  = new HtmlTableCell();
                cll4.InnerHtml = i.Email;
                cell4.Cells.Add(cll4);
                HtmlTableRow  cell5   = new HtmlTableRow();
                HtmlTableCell cll5    = new HtmlTableCell();
                Button        button2 = new Button();
                button2.Text     = "Delete";
                button2.CssClass = i.ID.ToString();
                button2.Click   += Button2_Click;
                button2.Attributes.Add("runat", "server");
                //cll5.Controls.Add(button2);
                cell5.Cells.Add(cll5);
                //tbl.Rows.Add(cell1);
                tbl.Rows.Add(cell2);
                tbl.Rows.Add(cell3);
                tbl.Rows.Add(cell4);
                tbl.Rows.Add(cell5);
                tbl.Style.Add("align", "center");
                NewControl.Controls.Add(tbl);
                NewControl.Style.Add("float", "left");
                NewControl.Style.Add("width", "33%");
                NewControl.Attributes.Add("align", "center");
                NewControl.Style.Add("text-align", "center");
                NewControl.Attributes["class"] = "interns col-4";
                NewControl.ID = i.ID.ToString();
                interns.Controls.Add(NewControl);
            }
        }
        else
        {
            if (Request.QueryString["Name"] != null)
            {
                var candids = context.Intern1.ToList().Where(n => n.FirstName.Contains(Request.QueryString["Name"].ToString()));
                foreach (Intern1 i in candids)
                {
                    HtmlGenericControl NewControl = new HtmlGenericControl("div");
                    NewControl.ID = i.ID.ToString();
                    HtmlTable tbl = new HtmlTable();
                    //HtmlTableRow cell1 = new HtmlTableRow();
                    //HtmlTableCell cll1 = new HtmlTableCell();
                    //cll1.InnerHtml = string.Format("<a href='/intern.aspx?id=" + i.ID + "'><img src='" + i.photo + "' width='25%' height='25%' align='center'/></a>");
                    //cell1.Cells.Add(cll1);
                    HtmlTableRow  cell2 = new HtmlTableRow();
                    HtmlTableCell cll2  = new HtmlTableCell();
                    cll2.InnerHtml = string.Format("<a href='/intern.aspx?id=" + i.ID + "'>" + i.FirstName + " " + i.LastName + "</a>");
                    cell2.Cells.Add(cll2);
                    HtmlTableRow  cell3 = new HtmlTableRow();
                    HtmlTableCell cll3  = new HtmlTableCell();
                    cll3.InnerHtml = i.Mobile.ToString();
                    cell3.Cells.Add(cll3);
                    HtmlTableRow  cell4 = new HtmlTableRow();
                    HtmlTableCell cll4  = new HtmlTableCell();
                    cll4.InnerHtml = i.Email;
                    cell4.Cells.Add(cll4);
                    HtmlTableRow  cell5   = new HtmlTableRow();
                    HtmlTableCell cll5    = new HtmlTableCell();
                    Button        button2 = new Button();
                    button2.Text     = "Delete";
                    button2.CssClass = i.ID.ToString();
                    button2.Click   += Button2_Click;
                    button2.Attributes.Add("runat", "server");
                    //cll5.Controls.Add(button2);
                    cell5.Cells.Add(cll5);
                    //tbl.Rows.Add(cell1);
                    tbl.Rows.Add(cell2);
                    tbl.Rows.Add(cell3);
                    tbl.Rows.Add(cell4);
                    tbl.Rows.Add(cell5);
                    tbl.Style.Add("align", "center");
                    NewControl.Controls.Add(tbl);
                    NewControl.Style.Add("float", "left");
                    NewControl.Style.Add("width", "33%");
                    NewControl.Attributes.Add("align", "center");
                    NewControl.Style.Add("text-align", "center");
                    NewControl.Attributes["class"] = "interns col-4";
                    NewControl.ID = i.ID.ToString();
                    interns.Controls.Add(NewControl);
                }
            }
            else if (Request.QueryString["Dep"] != null)
            {
                var eds = context.Educations.ToList().Where(x => x.Deptmnt == int.Parse(Request.QueryString["Dep"].ToString()));

                foreach (Education ed in eds)
                {
                    Intern1 i = new Intern1();
                    var     t = context.Intern1.ToList().Where(XPath => XPath.ID == ed.InternID).First();
                    i = t;
                    HtmlGenericControl NewControl = new HtmlGenericControl("div");
                    NewControl.ID = i.ID.ToString();
                    HtmlTable tbl = new HtmlTable();
                    //HtmlTableRow cell1 = new HtmlTableRow();
                    //HtmlTableCell cll1 = new HtmlTableCell();
                    //cll1.InnerHtml = string.Format("<a href='/intern.aspx?id=" + i.ID + "'><img src='" + i.photo + "' width='25%' height='25%' align='center'/></a>");
                    //cell1.Cells.Add(cll1);
                    HtmlTableRow  cell2 = new HtmlTableRow();
                    HtmlTableCell cll2  = new HtmlTableCell();
                    cll2.InnerHtml = string.Format("<a href='/intern.aspx?id=" + i.ID + "'>" + i.FirstName + " " + i.LastName + "</a>");
                    cell2.Cells.Add(cll2);
                    HtmlTableRow  cell3 = new HtmlTableRow();
                    HtmlTableCell cll3  = new HtmlTableCell();
                    cll3.InnerHtml = i.Mobile.ToString();
                    cell3.Cells.Add(cll3);
                    HtmlTableRow  cell4 = new HtmlTableRow();
                    HtmlTableCell cll4  = new HtmlTableCell();
                    cll4.InnerHtml = i.Email;
                    cell4.Cells.Add(cll4);
                    HtmlTableRow  cell5   = new HtmlTableRow();
                    HtmlTableCell cll5    = new HtmlTableCell();
                    Button        button2 = new Button();
                    button2.Text     = "Delete";
                    button2.CssClass = i.ID.ToString();
                    button2.Click   += Button2_Click;
                    button2.Attributes.Add("runat", "server");
                    //cll5.Controls.Add(button2);
                    cell5.Cells.Add(cll5);
                    //tbl.Rows.Add(cell1);
                    tbl.Rows.Add(cell2);
                    tbl.Rows.Add(cell3);
                    tbl.Rows.Add(cell4);
                    tbl.Rows.Add(cell5);
                    tbl.Style.Add("align", "center");
                    NewControl.Controls.Add(tbl);
                    NewControl.Style.Add("float", "left");
                    NewControl.Style.Add("width", "33%");
                    NewControl.Attributes.Add("align", "center");
                    NewControl.Style.Add("text-align", "center");
                    NewControl.Attributes["class"] = "interns col-4";
                    NewControl.ID = i.ID.ToString();
                    interns.Controls.Add(NewControl);
                }
            }
            else if (Request.QueryString["End"] != null)
            {
                var eds = context.Educations.ToList().Where(x => x.EndDate == null);

                foreach (Education ed in eds)
                {
                    Intern1 i = new Intern1();
                    var     t = context.Intern1.ToList().Where(XPath => XPath.ID == ed.InternID).First();
                    i = t;
                    HtmlGenericControl NewControl = new HtmlGenericControl("div");
                    NewControl.ID = i.ID.ToString();
                    HtmlTable tbl = new HtmlTable();
                    //HtmlTableRow cell1 = new HtmlTableRow();
                    //HtmlTableCell cll1 = new HtmlTableCell();
                    //cll1.InnerHtml = string.Format("<a href='/intern.aspx?id=" + i.ID + "'><img src='" + i.photo + "' width='25%' height='25%' align='center'/></a>");
                    //cell1.Cells.Add(cll1);
                    HtmlTableRow  cell2 = new HtmlTableRow();
                    HtmlTableCell cll2  = new HtmlTableCell();
                    cll2.InnerHtml = string.Format("<a href='/intern.aspx?id=" + i.ID + "'>" + i.FirstName + " " + i.LastName + "</a>");
                    cell2.Cells.Add(cll2);
                    HtmlTableRow  cell3 = new HtmlTableRow();
                    HtmlTableCell cll3  = new HtmlTableCell();
                    cll3.InnerHtml = i.Mobile.ToString();
                    cell3.Cells.Add(cll3);
                    HtmlTableRow  cell4 = new HtmlTableRow();
                    HtmlTableCell cll4  = new HtmlTableCell();
                    cll4.InnerHtml = i.Email;
                    cell4.Cells.Add(cll4);
                    HtmlTableRow  cell5   = new HtmlTableRow();
                    HtmlTableCell cll5    = new HtmlTableCell();
                    Button        button2 = new Button();
                    button2.Text     = "Delete";
                    button2.CssClass = i.ID.ToString();
                    button2.Click   += Button2_Click;
                    button2.Attributes.Add("runat", "server");
                    //cll5.Controls.Add(button2);
                    cell5.Cells.Add(cll5);
                    //tbl.Rows.Add(cell1);
                    tbl.Rows.Add(cell2);
                    tbl.Rows.Add(cell3);
                    tbl.Rows.Add(cell4);
                    tbl.Rows.Add(cell5);
                    tbl.Style.Add("align", "center");
                    NewControl.Controls.Add(tbl);
                    NewControl.Style.Add("float", "left");
                    NewControl.Style.Add("width", "33%");
                    NewControl.Attributes.Add("align", "center");
                    NewControl.Style.Add("text-align", "center");
                    NewControl.Attributes["class"] = "interns col-4";
                    NewControl.ID = i.ID.ToString();
                    interns.Controls.Add(NewControl);
                }
            }
        }
    }