Exemplo n.º 1
0
        private JF_TasksStats myJF_TasksStats(EM_Employee gEM, DateTime sTime, DateTime eTime)
        {
            JF_TasksStats myJF_TasksStats = new JF_TasksStats();

            myJF_TasksStats.EMRealName = gEM.EMRealName;
            myJF_TasksStats.EmType     = db.SYS_DD.Where(s => s.DDCode == gEM.EmType && s.DDType == "EmType").FirstOrDefault().DDName;
            switch (gEM.EmType)
            {
            case "01":
                myJF_TasksStats.BaseScore = db.JF_Tasks.Where(s => s.Executor == gEM.EmID && s.CreatedOn >= sTime && s.CreatedOn <= eTime).Sum(s => s.ExecutorGetScore);
                break;

            case "02":
                myJF_TasksStats.BaseScore = db.JF_Tasks.Where(s => s.TestEmployee == gEM.EmID && s.CreatedOn >= sTime && s.CreatedOn <= eTime).Sum(s => s.TestScore);
                break;

            default:
                myJF_TasksStats.BaseScore = db.JF_Tasks.Where(s => s.DemandEmployee == gEM.EmID && s.CreatedOn >= sTime && s.CreatedOn <= eTime).Sum(s => s.DemandScore);
                break;
            }

            double?ExecutorGetScore = db.JF_Tasks.Where(s => (s.FinishStatus == "04" || s.FinishStatus == "05") && s.Executor == gEM.EmID && s.CreatedOn >= sTime && s.CreatedOn <= eTime).Sum(s => s.ExecutorGetScore);
            double?TestScore        = db.JF_Tasks.Where(s => s.FinishStatus == "05" && s.TestEmployee == gEM.EmID && s.CreatedOn >= sTime && s.CreatedOn <= eTime).Sum(s => s.TestScore);
            double?DemandScore      = db.JF_Tasks.Where(s => (s.FinishStatus == "04" || s.FinishStatus == "05") && s.DemandEmployee == gEM.EmID && s.CreatedOn >= sTime && s.CreatedOn <= eTime).Sum(s => s.DemandScore);

            myJF_TasksStats.GetScore = (ExecutorGetScore == null ? 0 : ExecutorGetScore) + (TestScore == null ? 0 : TestScore) + (DemandScore == null ? 0 : DemandScore);
            myJF_TasksStats.Money    = myJF_TasksStats.GetScore * 5;
            return(myJF_TasksStats);
        }
Exemplo n.º 2
0
        public async Task <ActionResult> DeleteConfirmed(Guid id)
        {
            EM_Employee em_employee = await db.EM_Employee.FindAsync(id);

            db.EM_Employee.Remove(em_employee);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Edit([Bind(Include = "EmID,EMUserName,EMPassWord,EMRealName,EmType,Mobile,IsDisabled,CreatedOn,CreatedBy")] EM_Employee em_employee)
        {
            if (ModelState.IsValid)
            {
                db.Entry(em_employee).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(em_employee));
        }
        /// <summary>
        /// Assembles the entity.
        /// </summary>
        /// <param name="employee">The employee.</param>
        /// <returns></returns>
        private EmployeeEntity AssembleEntity(EM_Employee employee)
        {
            EmployeeEntity entity = new EmployeeEntity();

              entity.Address = employee.Address;
              entity.Email = employee.Email;
              entity.FirstName = employee.FirstName;
              entity.LastName = employee.LastName;
              entity.Phone = employee.Phone;

              return entity;
        }
Exemplo n.º 5
0
        public async Task <ActionResult> Create([Bind(Include = "EmID,EMUserName,EMPassWord,EMRealName,EmType,Mobile,IsDisabled,CreatedOn,CreatedBy")] EM_Employee em_employee)
        {
            if (ModelState.IsValid)
            {
                em_employee.EmID = Guid.NewGuid();
                db.EM_Employee.Add(em_employee);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(em_employee));
        }
Exemplo n.º 6
0
        // GET: /EM/EM_Employee/Details/5
        public async Task <ActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EM_Employee em_employee = await db.EM_Employee.FindAsync(id);

            if (em_employee == null)
            {
                return(HttpNotFound());
            }
            return(View(em_employee));
        }
Exemplo n.º 7
0
        // GET: /EM/EM_Employee/Edit/5
        public async Task <ActionResult> Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EM_Employee em_employee = await db.EM_Employee.FindAsync(id);

            ViewBag.EmType = new SelectList(db.SYS_DD.Where(s => s.DDType == "EmType"), "DDCode", "DDName", em_employee.EmType);
            if (em_employee == null)
            {
                return(HttpNotFound());
            }
            return(View(em_employee));
        }
 /// <summary>
 /// There are no comments for EM_Employee in the schema.
 /// </summary>
 public void AddToEM_Employee(EM_Employee eM_Employee)
 {
     base.AddObject("EM_Employee", eM_Employee);
 }
 /// <summary>
 /// Create a new EM_Employee object.
 /// </summary>
 /// <param name="externalId">Initial value of ExternalId.</param>
 public static EM_Employee CreateEM_Employee(string externalId)
 {
     EM_Employee eM_Employee = new EM_Employee();
     eM_Employee.ExternalId = externalId;
     return eM_Employee;
 }