Ejemplo n.º 1
0
        public string CreateProject(string ProjectName, int ManagerId, string StartingDate, string FinishingDate)
        {
            var tt = HttpContext.User.Identity.Name;
            var user = uService.GetSingleUserByEmail(tt);
            var logObj = _companyViewLog.GetLastViewCompanyByUserId(user.Id);
            var companyId = 0;
            if (logObj != null)
            {
                companyId = (int)logObj.CompanyId;
            }
            //var user = uService.GetSingleUserByEmail(HttpContext.User.Identity.Name);
            //var AccSet = setService.GetAllByUserId(user.Id);

            var newProj = new Project();
            newProj.ProjectName = ProjectName;
            newProj.ManagerId = ManagerId;
            newProj.CompanyId = companyId;
            newProj.ProjectDate = DateTime.Now;
            newProj.StartingDate = Convert.ToDateTime(StartingDate);
            newProj.FinishingDate = Convert.ToDateTime(FinishingDate);
            if (pService.CreateProject(newProj))
            {
                return "Success";
            }
            else
            {
                return "Failed";
            }
        }
Ejemplo n.º 2
0
 public bool CreateProject(Project project)
 {
     try
     {
         project.State = ObjectState.Added;
         proRep.AddOperation(project);
         return true;
     }
     catch (Exception ex)
     {
         var msg = ex.Message;
         return false;
     }
 }
Ejemplo n.º 3
0
        public bool UpdateProject(Project project)
        {
            try
            {
                var dbObj = proRep.GetSingleObject(project.Id);

                dbObj.StartingDate = project.StartingDate;
                dbObj.FinishingDate = project.FinishingDate;
                dbObj.ManagerId = project.ManagerId;
                dbObj.ProjectName = project.ProjectName;
                dbObj.State = ObjectState.Modified;
                proRep.UpdateOperation(dbObj);
                return true;
            }
            catch (Exception ex)
            {
                var msg = ex.Message;
                return false;
            }
        }
Ejemplo n.º 4
0
        public string EditProject(int id, string ProjectName, int ManagerId, string StartingDate, string FinishingDate)
        {
            string[] dateString = StartingDate.Split('/');
            DateTime start_date = Convert.ToDateTime(dateString[1] + "/" + dateString[0] + "/" + dateString[2]);
            string[] dateString1 = FinishingDate.Split('/');
            DateTime end_date = Convert.ToDateTime(dateString1[1] + "/" + dateString1[0] + "/" + dateString1[2]);
            var proj = new Project();
            proj.Id = id;
            proj.ProjectName = ProjectName;
            proj.ManagerId = ManagerId;

            proj.StartingDate = start_date;
            proj.FinishingDate = end_date;

            if (pService.UpdateProject(proj))
            {
                return "Success";
            }
            else
            {
                return "Failed";
            }
        }