예제 #1
0
 public List <Department> GetAll()
 {
     using (EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities())
     {
         return(db.Departments.ToList());
     }
 }
 public List <Employee> GetAll()
 {
     using (EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities())
     {
         return(db.Employees.ToList());
     }
 }
        void DataGvProperties()
        {
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();
            var test1 = (from e in db.Employees
                         join d in db.Departments
                         on e.DepttId equals d.Id
                         join ds in db.Designs
                         on e.DesigId equals ds.Id


                         select new
            {
                Id = e.Id,
                Name = e.Name,
                EmailId = e.Email,
                mob = e.Mobile,
                Add = e.Address,
                DepttName = d.DepttName,
                Designation = ds.DesignationName,
                Status = e.Status,
            }).ToList();

            //GridView1.DataSource = StudentServices.GetAll();
            GridView1.DataSource = test1;
            GridView1.DataBind();
        }
        public void Delete(int Id)
        {
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();
            Employee employee            = db.Employees.Single(u => u.Id == Id);

            db.Employees.Attach(employee);
            db.Employees.Remove(employee);
            db.SaveChanges();
        }
 public Employee Insert(Employee obj)
 {
     using (EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities())
     {
         db.Employees.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
예제 #6
0
        public void Delete(int Id)
        {
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();
            Department department        = db.Departments.Single(u => u.Id == Id);

            db.Departments.Attach(department);
            db.Departments.Remove(department);
            db.SaveChanges();
        }
예제 #7
0
 public Department Insert(Department obj)
 {
     using (EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities())
     {
         db.Departments.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
예제 #8
0
        public void Delete(int Id)
        {
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();
            Design design = db.Designs.Single(u => u.Id == Id);

            db.Designs.Attach(design);
            db.Designs.Remove(design);
            db.SaveChanges();
        }
예제 #9
0
 public Design Insert(Design obj)
 {
     using (EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities())
     {
         db.Designs.Add(obj);
         db.SaveChanges();
         return(obj);
     }
 }
        void dropdownlistDataForDesign()
        {
            //Teacher teacher = new Teacher();
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();

            ddDesignation.DataSource = db.Designs.ToList();

            ddDesignation.DataTextField  = "DesignationName";
            ddDesignation.DataValueField = "Id";
            ddDesignation.DataBind();
        }
        void dropdownlistData()
        {
            //Teacher teacher = new Teacher();
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();

            ddDepartment.DataSource = db.Departments.ToList();

            ddDepartment.DataTextField  = "DepttName";
            ddDepartment.DataValueField = "Id";
            ddDepartment.DataBind();
        }
예제 #12
0
        public void Update(Department obj)
        {
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();
            Department department        = db.Departments.Single(u => u.Id == obj.Id);

            department.DepttName = obj.DepttName;

            db.Departments.Attach(department);
            db.Entry(department).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
예제 #13
0
        public void Update(Design obj)
        {
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();
            Design design = db.Designs.Single(u => u.Id == obj.Id);

            design.DesignationName = obj.DesignationName;

            db.Designs.Attach(design);
            db.Entry(design).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
        public void Update(Employee obj)
        {
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();
            Employee employee            = db.Employees.Single(u => u.Id == obj.Id);

            employee.Name    = obj.Name;
            employee.Email   = obj.Email;
            employee.Address = obj.Address;
            employee.Mobile  = obj.Mobile;
            employee.DepttId = obj.DepttId;
            employee.DesigId = obj.DesigId;
            db.Employees.Attach(employee);
            db.Entry(employee).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
예제 #15
0
        protected void btnLogin_Click1(object sender, EventArgs e)
        {
            EmployeeMgtSystemEntities db = new EmployeeMgtSystemEntities();
            var query = from u in db.Users
                        where u.UserName == txtUser.Text &&
                        u.Password == txtPassword.Text
                        select u;

            if (query.Any())
            {
                Session["id"] = model.Id;
                Response.Redirect("EmployeeMaster.aspx");
                lblError.Text = "Login Success";
            }
            else
            {
                lblError.Text = "Login Failed";
            }
        }