コード例 #1
0
        public ActionResult Create(int? id)
        {
            var userName = System.Web.HttpContext.Current.User.Identity.Name;
            var user = _systemService.GetUserAndRole(0, userName);
            if (user == null)
            {
                return RedirectToAction("Index", "Login");
            }

            if (user.ProjectR == 0)
            {
                return RedirectToAction("Index", "Home");
            }

            var item = new WAMS_PROJECT
                           {
                               dBeginDate = DateTime.Now
                           };

            if (id.HasValue)
            {
                // If have eror use store procedure
                item = _service.GetByKeySp(id.Value);
            }

            var model = new ProjectViewModel
            {
                Id = item.Id,
                vProjectID = item.vProjectID,
                vProjectName = item.vProjectName,
                vLocation = item.vLocation,
                vMainContact = item.vMainContact,
                vCompanyName = item.vCompanyName,
                dBeginDate = item.dBeginDate.ToString("dd/MM/yyyy"),
                ClientId = item.ClientId,
                CountryId = item.CountryId,
                StoreId = item.StoreId,
                StatusId = item.StatusId,
                vDescription = item.vDescription,
                Timestamp = item.Timestamp,
                iCreated = item.iCreated,
                dCreated = item.dCreated,
                Countries = new SelectList(this._systemService.CountryList(), "Id", "Name"),
                Client = new SelectList(this._systemService.ClientProjectList(), "Id", "Name"),
                Suppervisor = new SelectList(this._systemService.SuppervisorList(), "vWorkerID", "Suppervisor"),
                StatusProject = new SelectList(this._systemService.GetLookUp(Constants.LuProjectStatus), Constants.LookUpKey, Constants.LookUpValue),
                UserLogin = user
            };

            if (item.dEnd.HasValue)
            {
                model.dEnd = item.dEnd.Value.ToString("dd/MM/yyyy");
            }
            return View(model);
        }
コード例 #2
0
ファイル: ProjectService.cs プロジェクト: xuantranm/V3System
 public bool Insert(WAMS_PROJECT project)
 {
     _projectRepository.Add(project);
     _unitOfWork.CommitChanges();
     return true;
 }
コード例 #3
0
ファイル: ProjectService.cs プロジェクト: xuantranm/V3System
 public bool Update(WAMS_PROJECT project)
 {
     _projectRepository.Update(project);
     _unitOfWork.CommitChanges();
     return true;
 }