コード例 #1
0
ファイル: EmployeeBLL.cs プロジェクト: ZB347954263/RailExam
        /// <summary>
        /// 新增员工
        /// </summary>
        /// <param name="employee">新增的员工信息</param>
        /// <returns></returns>
        public int AddEmployee(Employee employee)
        {
            int nEmployeeID = dal.AddEmployee(employee);

            if (nEmployeeID > 0)
            {
                SystemLogBLL systemLogBLL = new SystemLogBLL();

                systemLogBLL.WriteLog("新增员工:" + employee.EmployeeName + "(" + employee.WorkNo + ")基本信息");
            }

            return(nEmployeeID);
        }
コード例 #2
0
 public void AddEmployee(Employee employee)
 {
     try {
         employee_db.AddEmployee(employee);
     } catch {
         throw new Exception("Something went wrong.");
     }
 }
コード例 #3
0
 internal void AddEmployee(Employee employee)
 {
     if (String.IsNullOrEmpty(employee.Nume))
     {
         return;
     }
     employeeDAL.AddEmployee(employee);
     //UserList.Add(user);
 }
コード例 #4
0
 public IActionResult Add([Bind] EmployeeInfo objEmp)
 {
     if (ModelState.IsValid)
     {
         employeeDAL.AddEmployee(objEmp);
         return(RedirectToAction("Index"));
     }
     return(View(objEmp));
 }
コード例 #5
0
 public IActionResult Create([Bind] Employee employee)
 {
     if (ModelState.IsValid)
     {
         employeeDAL.AddEmployee(employee);
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }
コード例 #6
0
 public bool Add(Employee t)
 {
     try
     {
         return(dal.AddEmployee(t));
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
コード例 #7
0
 public void AddEmployee(Employee employee)
 {
     try
     {
         employee_db.AddEmployee(employee);
     }
     catch
     {
         throw new Exception("Yikes, dat is niet best");
     }
 }
コード例 #8
0
        public IActionResult Create([Bind] Models.Employee employee)
        {
            if (ModelState.IsValid)
            {
                _employeeDAL.AddEmployee(employee);

                TempData["sal"]  = employee.Salary;
                TempData["age"]  = employee.Age;
                TempData["name"] = employee.Name;

                return(RedirectToAction("Index"));
            }
            return(View(employee));
        }
コード例 #9
0
 public IActionResult CreateOrUpdate([Bind] Employee emp)
 {
     if (!ModelState.IsValid)
     {
         return(RedirectToAction("Index"));
     }
     if (emp.EmployeeId == 0)
     {
         EmpDal.AddEmployee(emp);
         return(RedirectToAction("Index"));
     }
     EmpDal.UpdateEmployee(emp);
     return(RedirectToAction("Index"));
 }
コード例 #10
0
        public bool AddEmployee(Employee employee)
        {
            bool employeeAdded = false;

            try
            {
                if (ValidateEmployee(employee))
                {
                    EmployeeDAL obj = new EmployeeDAL();
                    employeeAdded = obj.AddEmployee(employee);
                }
            }
            catch (EmployeeException)
            {
                throw;
            }
            return(employeeAdded);
        }
コード例 #11
0
        private void Save()
        {
            string   mode     = hdnMode.Value;
            Employee employee = new Employee();

            employee.Username   = txtUsername.Text;
            employee.Phone      = txtPhone.Text;
            employee.Email      = txtEmail.Text;
            employee.DOB        = Convert.ToDateTime(txtDOB.Text);
            employee.DocumentID = Convert.ToInt32(ddlDocuments.SelectedValue);
            employee.GenderID   = Convert.ToInt32(rblGender.SelectedValue);
            employee.Address    = txtAddress.Text;
            foreach (ListItem item in cblEducation.Items)
            {
                if (item.Text == "SSC")
                {
                    employee.SSC = item.Selected;
                }
                if (item.Text == "Inter")
                {
                    employee.Inter = item.Selected;
                }
                if (item.Text == "Degree")
                {
                    employee.Degree = item.Selected;
                }
            }

            switch (mode)
            {
            case "Add":
                EmployeeDAL.AddEmployee(employee);
                break;

            case "Update":
                employee.ID = Convert.ToInt32(txtID.Text);
                EmployeeDAL.UpdateEmployee(employee);
                break;

            default:
                break;
            }
        }
コード例 #12
0
 public ActionResult NewEmployee(EmployeeModel model)
 {
     if (ModelState.IsValid)
     {
         model.EmpoyeeImageAddress = "/Images/" + Guid.NewGuid() + ".jpg";
         model.EmployeeImageFile.SaveAs(Server.MapPath(model.EmpoyeeImageAddress));
         EmployeeDAL dal = new EmployeeDAL();
         int         id  = dal.AddEmployee(model);
         ViewBag.msg = "Employee Added : " + id;
         ModelState.Clear();
         ViewBag.cities = dal.GetCities();
         return(View());
     }
     else
     {
         EmployeeDAL dal = new EmployeeDAL();
         ViewBag.cities = dal.GetCities();
         return(View());
     }
 }
コード例 #13
0
        public void Test_AddEmployee_DAL()
        {
            var empData = new EmployeeDetail
            {
                Name         = "Pranay Kumar",
                EmployeeID   = "M103",
                EmailId      = "*****@*****.**",
                UserLocation = "Texas"
            };
            var mockSet     = new Mock <DbSet <EmployeeDetail> >();
            var mockContext = new Mock <API201Entities>();

            mockContext.Setup(m => m.EmployeeDetails).Returns(mockSet.Object);

            var service = new EmployeeDAL(mockContext.Object);
            var emp     = service.AddEmployee(empData);

            mockSet.Verify(m => m.Add(It.IsAny <EmployeeDetail>()), Times.Once());
            mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }
コード例 #14
0
        static void Main(string[] args)
        {
            Console.WriteLine("Select an option:\n 1.Add Employee\n 2.Delete Employee\n 3.Search Employee\n 4.List Of Employees");
            int option = int.Parse(Console.ReadLine());

            switch (option)
            {
            case 1:
                Console.WriteLine("Enter the Employee id:");
                int i = int.Parse(Console.ReadLine());
                Console.WriteLine("Enter the Employee Name:");
                string j = Console.ReadLine();
                Console.WriteLine("Enter the Employee Salary:");
                double k = Convert.ToDouble(Console.ReadLine());

                EmployeeDAL cemp = new EmployeeDAL();
                Employee    e    = new Employee();
                cemp.AddEmployee(new Employee()
                {
                    Employeeid = i, Employeename = j, salary = k
                });


                break;

            case 2:
                EmployeeDAL demp = new EmployeeDAL();
                break;

            case 3:
                EmployeeDAL semp = new EmployeeDAL();
                break;

            case 4:
                EmployeeDAL lemp = new EmployeeDAL();
                break;
            }
        }
コード例 #15
0
        public bool AddUser(User user1, Account account1)
        {
            bool result = employeeDAL.AddEmployee(user1, account1);

            return(result);
        }
コード例 #16
0
        static void Main(string[] args)
        {
            EmployeeDAL employeeDAL = new EmployeeDAL();
            Stopwatch   sw;

            //Insert
            for (int i = 0; i < 1000; i++)
            {
                Employee empTmp1 = new Employee();
                empTmp1.Id      = 1;
                empTmp1.Name    = i.ToString();
                empTmp1.Address = i.ToString();
                empTmp1.Salary  = i;
                empTmp1.Email   = i.ToString();
                employeeDAL.AddEmployee(empTmp1);
            }


            //查
            sw = new Stopwatch();
            sw.Start();
            List <Employee> employees1 = new List <Employee>();

            employees1 = employeeDAL.GetEmployees().ToList();
            foreach (var tmpEmp in employees1)
            {
                Console.WriteLine(tmpEmp.ToString());
                Console.WriteLine("--------------------");
            }
            sw.Stop();
            Console.WriteLine("普通查询耗时(毫秒):" + sw.ElapsedMilliseconds);
            Console.WriteLine("-------------------------");


            //速查,使用AsNoTracking()可以提高查询效率,不用在DbContext中进行缓存
            sw = new Stopwatch();
            sw.Start();
            List <Employee> employees2 = new List <Employee>();

            employees2 = employeeDAL.GetEmployeesAsNoTracking().ToList();
            foreach (var tmpEmp in employees2)
            {
                Console.WriteLine(tmpEmp.ToString());
                Console.WriteLine("***************");
            }
            sw.Stop();
            Console.WriteLine("AsNoTracking快查耗时(毫秒):" + sw.ElapsedMilliseconds);


            Employee empTmp = new Employee();

            empTmp.Id      = 1;
            empTmp.Name    = "Alexandra";
            empTmp.Address = "333w hempstead ave";
            empTmp.Salary  = 7999m;
            empTmp.Email   = "*****@*****.**";

            //改1
            sw = new Stopwatch();
            sw.Start();
            employeeDAL.Edit1Employee(empTmp);
            sw.Stop();
            Console.WriteLine("EDIT1(毫秒):" + sw.ElapsedMilliseconds);

            //改2
            sw = new Stopwatch();
            sw.Start();
            employeeDAL.Edit2Employee(empTmp);
            sw.Stop();
            Console.WriteLine("EDIT2(毫秒):" + sw.ElapsedMilliseconds);

            //删
            sw = new Stopwatch();
            sw.Start();
            employeeDAL.DeleteEmployee(1);
            sw.Stop();
            Console.WriteLine("delete(毫秒):" + sw.ElapsedMilliseconds);

            //执行sql语句
            sw = new Stopwatch();
            sw.Start();
            string sql = "update T_Employee set Salary=Salary+1000 where Salary<@Salary";

            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@Salary", 8000)
            };
            employeeDAL.ExecuteSQLCommand(sql, param);
            sw.Stop();
            Console.WriteLine("执行SQL语句(毫秒):" + sw.ElapsedMilliseconds);

            Console.ReadKey();
        }
コード例 #17
0
 public int AddEmployee([FromBody] Employee employee)
 {
     return(_employeeDAL.AddEmployee(employee));
 }
コード例 #18
0
 public bool AddEmployee(Employee e)
 {
     return(employeeDAL.AddEmployee(e));
 }
コード例 #19
0
 public int AddEmployeeBLL(EmployeeBO employee)
 {
     return(dal.AddEmployee(employee));
 }
コード例 #20
0
 public CustomEntities AddEmployee(EmployeeEntites empl)
 {
     return(ob.AddEmployee(empl));
 }
コード例 #21
0
        /// <summary>
        /// add method for performing add operations in our EmployeeBALform
        /// </summary>

        public void AddEmployeeBAL(EmpDTO em)
        {
            emp.AddEmployee(map.GetModel(em));
        }
コード例 #22
0
ファイル: EmployeeBLL.cs プロジェクト: Gwj-ui/HRM
 public bool AddEmployee(Employee emp)
 {
     return(empdal.AddEmployee(emp) > 0);
 }
コード例 #23
0
ファイル: EmployeeBLL.cs プロジェクト: yenon118/RideXpress
 public int AddEmployee(EmployeeViewModel add)
 {
     return(data.AddEmployee(add));
 }