Exemple #1
0
        // GET: /AppManage/
        public ActionResult Index()
        {
            var bind = (from b in sdb.BindCodes where b.CompanyId == this.CompanyId select b).ToList();
            List <BindCodeViewModel> list = new List <BindCodeViewModel>();

            foreach (var temp in bind)
            {
                Staff             staff      = (from s in db.Staffs where s.StaffNumber == temp.StaffNumber select s).FirstOrDefault();
                Department        department = (from d in db.Departments where d.DepartmentId == staff.Department select d).FirstOrDefault();
                BindCodeViewModel bindModel  = new BindCodeViewModel();
                bindModel.Id          = temp.Id;
                bindModel.StaffNumber = temp.StaffNumber;
                bindModel.RealName    = temp.RealName;
                bindModel.BindingCode = temp.BindingCode;
                bindModel.Phone       = temp.Phone;
                bindModel.LastTime    = temp.LastTime;
                bindModel.BindTag     = temp.BindTag;
                bindModel.Department  = department.Name;
                bindModel.Position    = staff.Position;
                list.Add(bindModel);
            }
            //var list = (from b in sdb.BindCodes
            //            where b.CompanyId == this.CompanyId
            //            select new BindCodeViewModel { Id = b.Id, StaffNumber = b.StaffNumber, RealName = b.RealName, BindingCode = b.BindingCode, Phone = b.Phone, LastTime = b.LastTime, BindTag = b.BindTag }).ToList();
            return(View(list));
        }
Exemple #2
0
        // GET: /AppManage/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BindCode bind = (from b in sdb.BindCodes
                             where b.Id == id select b).FirstOrDefault();
            Staff             staff      = (from s in db.Staffs where s.StaffNumber == bind.StaffNumber select s).FirstOrDefault();
            Department        department = (from d in db.Departments where d.DepartmentId == staff.Department select d).FirstOrDefault();
            BindCodeViewModel bindModel  = new BindCodeViewModel();

            bindModel.Id          = bind.Id;
            bindModel.StaffNumber = bind.StaffNumber;
            bindModel.RealName    = bind.RealName;
            bindModel.BindingCode = bind.BindingCode;
            bindModel.Phone       = bind.Phone;
            bindModel.LastTime    = bind.LastTime;
            bindModel.BindTag     = bind.BindTag;
            bindModel.Department  = department.Name;
            bindModel.Position    = staff.Position;
            return(View(bindModel));
        }