Beispiel #1
0
        // Same as TryGetProject but it doesn't throw
        private bool TryGetProject(string projectFile, out ProjectModel.Project project, out string errorMessage)
        {
            try
            {
                if (!ProjectReader.TryGetProject(projectFile, out project))
                {
                    if (project?.Diagnostics != null && project.Diagnostics.Any())
                    {
                        errorMessage = string.Join(Environment.NewLine, project.Diagnostics.Select(e => e.ToString()));
                    }
                    else
                    {
                        errorMessage = "Failed to read project.json";
                    }
                }
                else
                {
                    errorMessage = null;
                    return true;
                }
            }
            catch (Exception ex)
            {
                errorMessage = CollectMessages(ex);
            }

            project = null;
            return false;
        }
		public void SetUp()
		{
            doc = new ProjectDocument();
            project = new ProjectModel(doc);
            doc.CreateNewProject();
            xmlfile = Path.ChangeExtension(Path.GetTempFileName(), ".nunit");
		}
        public ProjectModel GetProject(int userId, int projectId)
        {
            //Get files from database matching project ID:
            List<SimulatorFile> lSources = DB.GetProjectSource(userId, projectId, true);

            // Fabricate a ProjectModel from the list of files
            ProjectModel projectModel = new ProjectModel()
            {
                OwnerUserId = userId,
                ProjectId = projectId
            };
            foreach (SimulatorFile cFile in lSources)
            {
                var fileModel = new ProjectFileModel()
                {
                    ProjectId = projectId,
                    Id = cFile.id,
                    Name = cFile.name,
                    Content = cFile.content
                };
                projectModel.Children.Add(fileModel);
            }

            return projectModel;
        }
Beispiel #4
0
        public MapObjectData(ProjectModel project)
        {
            _project = project;

            DocumentCollection acDocMgr = Application.DocumentManager;
            _document = acDocMgr.GetDocument(project.Database);
        }
 public ActionResult Create()
 {
     ViewBag.AllLanguages = _languageService.GetAllLanguages(true);
     var model = new ProjectModel();
     AddLocales(_languageService, model.Locales);
     return View(model);
 }
        public void SetUp()
        {
            doc = new ProjectDocument(xmlfile);
            project = new ProjectModel(doc);

            doc.ProjectChanged += OnProjectChange;
            gotChangeNotice = false;
        }
 public void Initialize()
 {
     var doc = new ProjectModel();
     doc.LoadXml(NUnitProjectXml.EmptyConfigs);
     model = new PropertyModel(doc);
     dlg = Substitute.For<IRenameConfigurationDialog>();
     presenter = new RenameConfigurationPresenter(model, dlg, "Debug");
 }
 public NewProjectViewController (WorkspaceModel workspace, int color)
 {
     this.model = Model.Update (new ProjectModel () {
         Workspace = workspace,
         Color = color,
         IsActive = true,
     });
     Title = "NewProjectTitle".Tr ();
 }
        public JsonResult Add(ProjectModel project)
        {
            if (Session[CookieModel.UserName.ToString()] == null || string.IsNullOrEmpty(Session[CookieModel.UserName.ToString()].ToString()))
            {
                Redirect("Login/Index");
                return null;
            }
            JsonResult json = new JsonResult() { ContentType = "text/html" };
            int result = 0;

            string message = ValidateInput(project);
            if (!string.IsNullOrEmpty(message))
            {
                json.Data = new { Result = 0, Message = message };
                return json;
            }
            try
            {
                if (project.ProHouseType == "1")
                {
                    project.ProjectAddress = string.Format("{0}{1}{2}期{3}幢{4}室", project.Address0, project.Address1, project.Address2, project.Address3, project.Address4);
                }
                if (project.ProHouseType == "2")
                {
                    project.ProjectAddress = string.Format("{0}{1}{2}期{3}幢", project.Address0, project.Address1, project.Address2, project.Address3);
                }
                if (project.ProHouseType == "3")
                {
                    project.ProjectAddress = string.Format("{0}{1}镇{2}村{3}", project.Address0, project.Address1, project.Address6, project.Address5);
                }
                project.ProjectName = string.Empty;
                project.ProjectUses = string.Empty;
                project.ProjectType = GetProHouseType(project.ProHouseType);
                project.ProjectStatus = "登录成功";
                result = ServiceModel.CreateInstance().Client.AddProject(Session[CookieModel.UserName.ToString()].ToString(), project.ProjectName, project.ProjectUses, project.MachineType, project.ProjectAddress, project.CustomerName, project.CustomerTel, float.Parse(project.Price), project.ProjectStatus, project.ProjectType);
                switch (result)
                {
                    case -1:
                        message = "没有权限";
                        break;
                    case 0:
                        message = "登录项目失败";
                        break;
                    case 1:
                        message = "登录项目成功";
                        break;
                }
            }
            catch (Exception ex)
            {
                result = 0;
                message = ex.Message;
            }
            json.Data = new { Result = result, Message = message };
            return json;
        }
 public NewProjectViewController (WorkspaceModel workspace, int color)
 {
     model = new ProjectModel {
         Workspace = workspace,
         Color = color,
         IsActive = true,
         IsPrivate = true
     };
     Title = "NewProjectTitle".Tr ();
 }
        public void SetUp()
        {
            var doc = new ProjectModel();
            doc.LoadXml(NUnitProjectXml.NormalProject);
            model = new PropertyModel(doc);

            dlg = Substitute.For<IAddConfigurationDialog>();

            presenter = new AddConfigurationPresenter(model, dlg);
        }
        public void Initialize()
        {
            ProjectDocument doc = new ProjectDocument();
            doc.LoadXml(NUnitProjectXml.NormalProject);
            model = new ProjectModel(doc);

            view = Substitute.For<IConfigurationEditorDialog>();

            editor = new ConfigurationEditor(model, view);
        }
Beispiel #13
0
 public JsonResult GetProject(ProjectModel project)
 {
     if (Session[CookieModel.UserName.ToString()] == null || string.IsNullOrEmpty(Session[CookieModel.UserName.ToString()].ToString()))
     {
         Redirect("Login/Index");
         return null;
     }
     JsonResult json = new JsonResult() { ContentType = "text/html" };
     try
     {
         project.ProjectStatus = string.IsNullOrEmpty(project.ProjectStatus) ? string.Empty : project.ProjectStatus;
         project.CustomerName = string.IsNullOrEmpty(project.CustomerName) ? string.Empty : project.CustomerName;
         project.CustomerTel = string.IsNullOrEmpty(project.CustomerTel) ? string.Empty : project.CustomerTel;
         project.ProjectAddress = string.IsNullOrEmpty(project.ProjectAddress) ? string.Empty : project.ProjectAddress;
         project.ProjectType = string.IsNullOrEmpty(project.ProjectType) ? string.Empty : project.ProjectType;
         project.MachineType = string.IsNullOrEmpty(project.MachineType) ? string.Empty : project.MachineType;
         project.StartDate = string.IsNullOrEmpty(project.StartDate) ? string.Empty : project.StartDate;
         project.EndDate = string.IsNullOrEmpty(project.EndDate) ? string.Empty : project.EndDate;
         int page = 0;
         if (!int.TryParse(HttpContext.Request.Params["page"], out page))
         {
             page = 1;
         }
         page = page == 0 ? 1 : page;
         int rows = 0;
         if (!int.TryParse(HttpContext.Request.Params["rows"], out rows))
         {
             rows = 50;
         }
         rows = rows == 0 ? 50 : rows;
         DataSet dst = ServiceModel.CreateInstance().Client.GetProject(Session[CookieModel.UserName.ToString()].ToString(),project.ProjectStatus, project.CustomerName, project.CustomerTel, project.ProjectAddress, project.ProjectType, project.MachineType, project.StartDate, project.EndDate, page, rows);
         if (dst == null) return null;
         if (dst.Tables.Count != 2) return null;
         var data = from row in dst.Tables[0].AsEnumerable()
                    select new ProjectQueryModel()
                    {
                        createtime = row["createtime"].ToString().Trim(),
                        pname = row["pname"].ToString().Trim(),
                        paddress = row["paddress"].ToString().Trim(),
                        price = row["price"].ToString().Trim(),
                        customer = row["customer"].ToString().Trim(),
                        pstatus = row["pstatus"].ToString().Trim(),
                        view = row["view"].ToString().Trim()
                    };
         json.Data = new { total = Convert.ToInt32(dst.Tables[1].Rows[0][0]), rows = data };
     }
     catch { }
     return json;
 }
Beispiel #14
0
        public ActionResult Create(ProjectModel model)
        {
            try
            {
                _projectDAO.SaveOrUpdate(_session, model.SelectedProject);

                return RedirectToAction("Index");
            }
            catch (Exception exception)
            {
                Log.Error(exception.Message, exception);
                ViewBag.Message = exception.Message;
                return View(model);
            }
        }
Beispiel #15
0
        public CheckResult ValidateProject(ProjectModel model)
        {
            CheckResult result = CheckResult.Default;

            if (string.IsNullOrWhiteSpace(model.Name))
            {
                result.Details.Add(
                    new CheckResultDetail(
                        CheckResultDetail.ErrorType.Error,
                        StaticReflection.GetMemberName<ProjectModel>(x => x.Name),
                        "Enter name of the project!"));
            }

            return result;
        }
        public ActionResult Create(ProjectModel model, bool continueEditing)
        {
            if (ModelState.IsValid)
            {
                var project = model.ToEntity();
                project.CreatedOnUtc = DateTime.UtcNow;
                _projectService.InsertProject(project);

                //locales
                UpdateLocales(project, model);
                _projectService.UpdateProject(project);

                SuccessNotification(_localizationService.GetResource("Toi.Plugin.Misc.Projects.Project.Added"));
                return continueEditing ? RedirectToAction("Edit", new { id = project.Id }) : RedirectToAction("List");
            }

            return View(model);
        }
Beispiel #17
0
 public static ProjectModel GetActiveProject()
 {
     ProjectModel pmModelResult = new ProjectModel();
     var sActiveProject = PlayerPrefs.GetString(activeProjectKey);
     if (sActiveProject != "")
     {
         var par = sActiveProject.Split(separator);
         if (par.Length > 0)
         {
             pmModelResult.Name = par[0];
         }
         if (par.Length > 1)
         {
             pmModelResult.DateTime = DateTime.Parse(par[1]);
         }
     }
     return pmModelResult;
 }
        public JsonResult Add(ProjectModel project)
        {
            if (Session[CookieModel.UserName.ToString()] == null || string.IsNullOrEmpty(Session[CookieModel.UserName.ToString()].ToString()))
            {
                Redirect("Login/Index");
                return null;
            }
            JsonResult json = new JsonResult() { ContentType = "text/html" };
            int result = 0;

            string message = ValidateInput(project);
            if (!string.IsNullOrEmpty(message))
            {
                json.Data = new { Result = 0, Message = message };
                return json;
            }
            try
            {
                project.ProjectAddress = string.Format("{0}市{1}(乡、镇、街道){2}(路、街){3}(号、大厦){4}楼{5}", project.Area1, project.Area2, project.Area3, project.Area4, project.Area5, project.Area6);
                project.MachineType = string.Empty;
                project.ProjectType = "工程";
                project.ProjectStatus = "登录成功";
                result = ServiceModel.CreateInstance().Client.AddProject(Session[CookieModel.UserName.ToString()].ToString(), project.ProjectName, project.ProjectUses, project.MachineType, project.ProjectAddress, project.CustomerName, project.CustomerTel, float.Parse(project.Price), project.ProjectStatus, project.ProjectType);
                switch (result)
                {
                    case -1:
                        message = "没有权限";
                        break;
                    case 0:
                        message = "登录项目失败";
                        break;
                    case 1:
                        message = "登录项目成功";
                        break;
                }
            }
            catch (Exception ex)
            {
                result = 0;
                message = ex.Message;
            }
            json.Data = new { Result = result, Message = message };
            return json;
        }
Beispiel #19
0
        public Project(ProjectModel.Project runtimeProject)
        {
            ProjectFile = runtimeProject.ProjectFilePath;
            ProjectDirectory = runtimeProject.ProjectDirectory;

            var compilerOptions = runtimeProject.GetCompilerOptions(targetFramework: null, configurationName: null);

            var filesToWatch = new List<string>() { runtimeProject.ProjectFilePath };
            if (compilerOptions?.CompileInclude != null)
            {
                filesToWatch.AddRange(compilerOptions.CompileInclude.ResolveFiles());
            }
            else
            {
                filesToWatch.AddRange(runtimeProject.Files.SourceFiles);
            }

            if (compilerOptions?.EmbedInclude != null)
            {
                filesToWatch.AddRange(compilerOptions.EmbedInclude.ResolveFiles());
            }
            else
            {
                filesToWatch.AddRange(runtimeProject.Files.ResourceFiles.Values);
            }

            filesToWatch.AddRange(runtimeProject.Files.SharedFiles);
            filesToWatch.AddRange(runtimeProject.Files.PreprocessSourceFiles);

            Files = filesToWatch;

            var projectLockJsonPath = Path.Combine(runtimeProject.ProjectDirectory, "project.lock.json");

            if (File.Exists(projectLockJsonPath))
            {
                var lockFile = LockFileReader.Read(projectLockJsonPath, designTime: false);
                ProjectDependencies = lockFile.ProjectLibraries.Select(dep => GetProjectRelativeFullPath(dep.Path)).ToList();
            }
            else
            {
                ProjectDependencies = new string[0];
            }
        }
        public void CanSaveAndReloadProject()
        {
            doc.LoadXml(NUnitProjectXml.NormalProject);
            doc.Save(xmlfile);
            Assert.IsTrue(File.Exists(xmlfile));

            ProjectModel doc2 = new ProjectModel(xmlfile);
            doc2.Load();
            PropertyModel project2 = new PropertyModel(doc2);

            Assert.AreEqual(2, project2.Configs.Count);

            Assert.AreEqual(2, project2.Configs[0].Assemblies.Count);
            Assert.AreEqual("assembly1.dll", project2.Configs[0].Assemblies[0]);
            Assert.AreEqual("assembly2.dll", project2.Configs[0].Assemblies[1]);

            Assert.AreEqual(2, project2.Configs[1].Assemblies.Count);
            Assert.AreEqual("assembly1.dll", project2.Configs[1].Assemblies[0]);
            Assert.AreEqual("assembly2.dll", project2.Configs[1].Assemblies[1]);
        }
Beispiel #21
0
    public static ProjectModel GenerateNewProject()
    {
        var projectModel = new ProjectModel() { Name = "", Seconds = 0f, DateTime = DateTime.Now, TimeLimit = 600};
        if (projectCount < projectLimit)
        {
            var projectList = PlayerPrefs.GetString(_projectsListKey);
            String projectName = "";
            for (int i = 0; i < projectLimit * 10; i++)
            {
                projectName = String.Format("{0}{1}", _projectPrefix, i);
                if (!projectList.Contains(projectName))
                    break;
            }

            PlayerPrefs.SetString(_projectsListKey, String.Format("{0}{1}{2}", projectList, projectName, separator));
            projectModel.Name = projectName;
            projectModel.Seconds = 0f;
            projectModel.DateTime = DateTime.Now;
            SaveProject(projectModel);
            GetProjects();
        }
        return projectModel;
    }
Beispiel #22
0
        public ActionResult Edit(ProjectHelperClass projectHelperModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(projectHelperModel));
            }

            ProjectModel project = new ProjectModel()
            {
                Id          = projectHelperModel.Id,
                Description = projectHelperModel.Description,
                GitHubUrl   = projectHelperModel.GitHubUrl,
                ImagePath   = projectHelperModel.ImagePath,
                Name        = projectHelperModel.Name,
                OtherUrl    = projectHelperModel.OtherUrl,
                Position    = projectHelperModel.Position,
                SiteUrl     = projectHelperModel.SiteUrl,
                UserId      = projectHelperModel.UserId
            };

            PC.Entry(project).State = System.Data.Entity.EntityState.Modified;
            PC.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #23
0
        private void ProjectPlanDocumentForm_Load(object sender, EventArgs e)
        {
            loadDocument();
            string json = JsonHelper.loadProjectInfo(Settings.Default.Username);
            List <ProjectModel> projectListModel = JsonConvert.DeserializeObject <List <ProjectModel> >(json);

            projectModel = projectModel.getProjectModel(Settings.Default.ProjectID, projectListModel);

            /*
             * //tabControl collor
             * tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed;
             * tabControl1.SizeMode = TabSizeMode.Fixed;
             * Size tab_size = tabControl1.ItemSize;
             * tab_size.Width = 100;
             * tab_size.Height += 15;
             * tabControl1.ItemSize = tab_size;
             *
             * tabControl3.DrawMode = TabDrawMode.OwnerDrawFixed;
             * tabControl3.SizeMode = TabSizeMode.Fixed;
             * Size tab_size2 = tabControl3.ItemSize;
             * tab_size2.Width = 100;
             * tab_size2.Height += 15;
             * tabControl3.ItemSize = tab_size2;*/
        }
        public ProjectModel GetProject(int employeeid)
        {
            ProjectModel details = new ProjectModel();

            sqlConnection          = OpenConnection();
            sqlCommand             = new SqlCommand();
            sqlCommand.Connection  = sqlConnection;
            sqlCommand.CommandType = CommandType.StoredProcedure;
            sqlCommand.CommandText = "uspGetProjectDetails";
            sqlCommand.Parameters.Add("@EmployeeID", SqlDbType.Int).Value = Convert.ToInt32(employeeid);
            SqlDataReader companydatareader = sqlCommand.ExecuteReader();

            while (companydatareader.Read())
            {
                details.EmployeeID   = companydatareader.GetInt32(companydatareader.GetOrdinal("EmployeeID"));
                details.Project_Name = companydatareader.GetString(companydatareader.GetOrdinal("Project_Name"));
                details.Client_Name  = companydatareader.GetString(companydatareader.GetOrdinal("Client_Name"));
                details.Location     = companydatareader.GetString(companydatareader.GetOrdinal("Location"));
                details.Roles        = companydatareader.GetString(companydatareader.GetOrdinal("Roles"));
            }


            return(details);
        }
Beispiel #25
0
 public JsonResult ModifyProjectStatus(ProjectModel project)
 {
     if (Session[CookieModel.UserName.ToString()] == null || string.IsNullOrEmpty(Session[CookieModel.UserName.ToString()].ToString()))
     {
         Redirect("Login/Index");
         return null;
     }
     JsonResult json = new JsonResult() { ContentType = "text/html" };
     int result = 0;
     string message = string.Empty;
     try
     {
         project.ProjectStatus = string.IsNullOrEmpty(project.ProjectStatus) ? string.Empty : project.ProjectStatus;
         project.ProjectStatus = project.ProjectStatus == "1" ? "登录成功" : "登录失败";
         result = ServiceModel.CreateInstance().Client.ModifyProjectStatus(Session[CookieModel.UserName.ToString()].ToString(), project.ProjectID, project.ProjectStatus);
         switch (result)
         {
             case -1:
                 message = "没有权限";
                 break;
             case 0:
                 message = "修改失败";
                 break;
             case 1:
                 message = "修改成功";
                 break;
         }
     }
     catch (Exception ex)
     {
         result = 0;
         message = ex.Message;
     }
     json.Data = new { Result = result, Message = message };
     return json;
 }
        public ActionResult Create(FormCollection collection)
        {
            string projectName = collection.Get("ProjectName");

            if (string.IsNullOrWhiteSpace(projectName))
            {
                return(View());
            }

            try
            {
                ProjectModel model = new ProjectModel();
                model.Id          = Guid.NewGuid().ToString();
                model.ProjectName = projectName;

                bll.CreateProject(model);
            }
            catch
            {
                return(View());
            }

            return(RedirectToAction("Index"));
        }
Beispiel #27
0
        /// <summary>
        /// Генерирует список проектов
        /// </summary>
        /// <param name="key">ключ выбранного проекта</param>
        /// <returns>Список проектов</returns>
        static List <ProjectModel> GetProjects(string key)
        {
            List <ProjectModel> output = new List <ProjectModel>();
            JObject             o      = ApiRequestGet("/rest/api/1.0/projects");

            if (o["values"] == null)
            {
                return(output);
            }
            foreach (var pro in o["values"])
            {
                ProjectModel p = new ProjectModel();
                p.Description = pro["description"] == null ? string.Empty : pro["description"].Value <string>();
                p.Key         = pro["key"].Value <string>();
                p.Name        = pro["name"].Value <string>();
                if (pro["links"] != null)
                {
                    p.Link = pro["links"]["self"].First["href"].Value <string>();
                }
                p.Selected = string.Equals(key, p.Key, StringComparison.OrdinalIgnoreCase);
                output.Add(p);
            }
            return(output);
        }
Beispiel #28
0
///////////////////////////UPDATE

        public string Update(ProjectModel aModel)
        {
            try
            {
                string       msg   = "";
                const string query = @"UPDATE project SET PnoCode=@PnoCode,pno=@pno,ContractPerson=@ContractPerson,title=@title,pl=@pl,ps=@ps,ec=@ec,status=@status,UserName=@UserName,SubPno=@SubPno,SubSubPno=@SubSubPno,ProjectCost=@ProjectCost,IsShowAccounts=@IsShowAccounts,WillShowInHospital=@WillShowInHospital,WillShowInPayment=@WillShowInPayment
                                        WHERE PnoCode=@PnoCode";
                Con.Open();
                var cmd = new SqlCommand(query, Con);
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@PnoCode", aModel.PnoCode);
                cmd.Parameters.AddWithValue("@pno", aModel.Pno);
                cmd.Parameters.AddWithValue("@ContractPerson", aModel.ContractPerson);
                cmd.Parameters.AddWithValue("@title", aModel.Title);
                cmd.Parameters.AddWithValue("@status", aModel.Status);
                cmd.Parameters.AddWithValue("@UserName", aModel.UserName);
                cmd.Parameters.AddWithValue("@SubPno", aModel.SubPno);
                cmd.Parameters.AddWithValue("@SubSubPno", aModel.SubSubPno);
                cmd.Parameters.AddWithValue("@ProjectCost", aModel.ProjectCost);
                cmd.Parameters.AddWithValue("@IsShowAccounts", aModel.IsShowAccounts);
                cmd.Parameters.AddWithValue("@WillShowInHospital", aModel.WillShowInHospital);
                cmd.Parameters.AddWithValue("@WillShowInPayment", aModel.WillShowInPayment);
                int rtn = cmd.ExecuteNonQuery();
                msg = rtn == 1 ? "Update Success" : "Update Failed";
                Con.Close();
                return(msg);
            }
            catch (Exception exception)
            {
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
                return(exception.ToString());
            }
        }
Beispiel #29
0
        public static void Save(ProjectModel projectModel)
        {
            var xDocument = GetDataBaseXDocumentInstance;
            var xElement = GetElement(projectModel.Id.ToString());
            if (xElement == null)
            {
                xElement = new XElement(Constants.ProjectNodeName,
                                new XAttribute(nameof(ProjectModel.Id), projectModel.Id),
                                new XAttribute(nameof(ProjectModel.Title), projectModel.Title),
                                new XAttribute(nameof(ProjectModel.InitialDuration), projectModel.InitialDuration.ToStandardString()),
                                new XAttribute(nameof(ProjectModel.TotalDuration), "00:00:00"),
                                new XAttribute(nameof(ProjectModel.RegisterDateTime), DateTime.Now.ToStandardString()));
                xDocument.Descendants(Constants.ProjectsNodeName).First().Add(xElement);
            }
            else
            {
                xElement.SetAttributeValue(nameof(ProjectModel.Title), projectModel.Title);
                xElement.SetAttributeValue(nameof(ProjectModel.InitialDuration), projectModel.InitialDuration.ToStandardString());
            }

            // 
            SaveChanges();
            CalculateTotalDuration(projectModel.Id);
        }
Beispiel #30
0
        public ActionResult UpdateProject(ProjectModel model)
        {
            var result = new StandardJsonResult <bool>();

            result.Try(() =>
            {
                if (!ModelState.IsValid)
                {
                    throw new KnownException(ModelState.GetFirstError());
                }
                ProjectDto project = new ProjectDto();
                project.BeginDate  = model.BeginDate;
                project.Status     = (Status)model.Status;
                project.Deleted    = false;
                project.ProjectID  = model.ProjectID;
                project.Roles      = model.Roles[0];
                foreach (var a in model.Departments)
                {
                    project.Departments += a + "|";
                }
                project.Departments = project.Departments.Substring(0, project.Departments.Length - 1);
                foreach (var a in model.Managers)
                {
                    project.Managers += a + "|";
                }
                project.Managers     = project.Managers.Substring(0, project.Managers.Length - 1);
                project.Name         = model.Name;
                project.EnterpriseID = BCSession.User.EnterpriseID;
                project.RegistDate   = model.RegistDate;
                project.EndDate      = model.EndDate;
                result.Value         = service.UpdateProject(project);
                result.Message       = "修改成功";
            });

            return(result);
        }
 private void SerializeAndSave(ProjectModel project, string name)
 {
     _loadSave.Save(project, name);
     ProjectSaved(project);
 }
 public NewProjectViewModel (ProjectModel model)
 {
     this.model = model;
     ServiceContainer.Resolve<ITracker> ().CurrentScreen = "New Project";
 }
Beispiel #33
0
 public ProjectUpdateResult Post(ProjectModel oProj)
 {
     return(oProject.UpdateProject(oProj));
 }
Beispiel #34
0
        public MsgModel GetAllProjects()
        {
            var msg = new MsgModel
            {
                State = false,
                Msg   = "无法获取到项目信息!",
                Data  = null
            };

            try
            {
                const string sql    = "SELECT * FROM `projects`;";
                var          result = DbHelper.ExecuteDataTable(CommandType.Text, sql);
                if ((result != null) && (result.Rows.Count > 0))
                {
                    var projects = new List <ProjectModel>();
                    foreach (DataRow row in result.Rows)
                    {
                        var project = new ProjectModel();
                        if (DBNull.Value != row["Id"])
                        {
                            project.Id = Convert.ToInt32(row["Id"]);
                        }
                        if (DBNull.Value != row["projectname"])
                        {
                            project.Projectname = Convert.ToString(row["projectname"]);
                        }
                        if (DBNull.Value != row["projectleaderid"])
                        {
                            project.Projectleaderid = Convert.ToInt32(row["projectleaderid"]);
                        }
                        if (DBNull.Value != row["projectleader"])
                        {
                            project.Projectleader = Convert.ToString(row["projectleader"]);
                        }
                        if (DBNull.Value != row["Constructionleaderid"])
                        {
                            project.Constructionleaderid = Convert.ToInt32(row["Constructionleaderid"]);
                        }
                        if (DBNull.Value != row["Constructionleader"])
                        {
                            project.Constructionleader = Convert.ToString(row["Constructionleader"]);
                        }
                        if (DBNull.Value != row["Accountantid"])
                        {
                            project.Accountantid = Convert.ToInt32(row["Accountantid"]);
                        }
                        if (DBNull.Value != row["Accountant"])
                        {
                            project.Accountant = Convert.ToString(row["Accountant"]);
                        }
                        if (DBNull.Value != row["Productleaderid"])
                        {
                            project.Productleaderid = Convert.ToInt32(row["Productleaderid"]);
                        }
                        if (DBNull.Value != row["Productleader"])
                        {
                            project.Productleader = Convert.ToString(row["Productleader"]);
                        }
                        if (DBNull.Value != row["Qualityleaderid"])
                        {
                            project.Qualityleaderid = Convert.ToInt32(row["Qualityleaderid"]);
                        }
                        if (DBNull.Value != row["Qualityleader"])
                        {
                            project.Qualityleader = Convert.ToString(row["Qualityleader"]);
                        }
                        if (DBNull.Value != row["Safetyleaderid"])
                        {
                            project.Safetyleaderid = Convert.ToInt32(row["Safetyleaderid"]);
                        }
                        if (DBNull.Value != row["Safetyleader"])
                        {
                            project.Safetyleader = Convert.ToString(row["Safetyleader"]);
                        }
                        if (DBNull.Value != row["Storekeeperid"])
                        {
                            project.Storekeeperid = Convert.ToInt32(row["Storekeeperid"]);
                        }
                        if (DBNull.Value != row["Storekeeper"])
                        {
                            project.Storekeeper = Convert.ToString(row["Storekeeper"]);
                        }
                        if (DBNull.Value != row["buildingTotal"])
                        {
                            project.BuildingTotal = Convert.ToInt32(row["buildingTotal"]);
                        }
                        if (DBNull.Value != row["state"])
                        {
                            project.State = Convert.ToBoolean(row["state"]);
                        }
                        projects.Add(project);
                    }
                    msg.State = true;
                    msg.Msg   = "成功获取项目信息";
                    msg.Data  = projects;
                }
            }
            catch (Exception)
            {
                //ignore
            }
            return(msg);
        }
        public ActionResult Edit(ProjectModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews))
                return AccessDeniedView();

            var project = _projectService.GetProjectById(model.Id);
            if (project == null)
                //No news item found with the specified id
                return RedirectToAction("List");

            if (ModelState.IsValid)
            {
                project = model.ToEntity(project);
                _projectService.UpdateProject(project);

                //locales
                UpdateLocales(project, model);
                _projectService.UpdateProject(project);

                SuccessNotification(_localizationService.GetResource("Toi.Plugin.Misc.Projects.Project.Updated"));
                return continueEditing ? RedirectToAction("Edit", new { id = project.Id }) : RedirectToAction("List");
            }
            return View(model);
        }
 public ProjectListController(ProjectModel projectModel, ProjectMemberModel projectMemberModel)
 {
     this.projectModel       = projectModel;
     this.projectMemberModel = projectMemberModel;
 }
Beispiel #37
0
        private void Button_Click_Add_New(object sender, RoutedEventArgs e)
        {
            if (typeOf == "Manufacturer")
            {
                this.Title = "Add new Manufacturer";
                ManufacturerModel mm = new ManufacturerModel()
                {
                    Name         = txtName.Text,
                    ClientNumber = txtClientNumber.Text,
                    WebAddress   = txtWebAddress.Text
                };
                ManufacturerController.addManufacturer(mm);
                MessageBox.Show("New " + typeOf + " " + mm.Name + " was added succesfully");
            }
            if (typeOf == "Supplier")
            {
                this.Title = "Add new Supplier";
                SupplierModel sm = new SupplierModel()
                {
                    Name         = txtName.Text,
                    clientNumber = txtClientNumber.Text,
                    webAddress   = txtWebAddress.Text
                };
                SupplierController.addSupplier(sm);
                MessageBox.Show("New " + typeOf + " " + sm.Name + " was added succesfully");
            }

            if (typeOf == "Project")
            {
                this.Title      = "Add new Project";
                lbl1.Content    = "Project Name";
                lbl2.Visibility = Visibility.Hidden;
                lbl3.Visibility = Visibility.Hidden;
                ProjectModel pj = new ProjectModel()
                {
                    Name = txtName.Text,
                };
                ProjectController.addProject(pj);
                MessageBox.Show("New " + typeOf + " " + pj.Name + " was added succesfully");
            }

            if (typeOf == "Location")
            {
                this.Title                 = "Add new Location";
                lbl1.Content               = "Location Name";
                lbl2.Visibility            = Visibility.Hidden;
                lbl3.Visibility            = Visibility.Hidden;
                txtClientNumber.Visibility = Visibility.Hidden;
                txtWebAddress.Visibility   = Visibility.Hidden;
                LocationModel lm = new LocationModel()
                {
                    Location = txtName.Text
                };
                LocationController.addLocation(lm);
                MessageBox.Show("New " + typeOf + " " + lm.Location + " was added succesfully");
            }
            if (typeOf == "Category")
            {
                this.Title   = "Add new Location";
                lbl1.Content = "ID";
                lbl2.Content = "Description";

                lbl3.Visibility          = Visibility.Hidden;
                txtWebAddress.Visibility = Visibility.Hidden;
                CategoryModel cm = new CategoryModel()
                {
                    CategoryID  = txtName.Text,
                    Description = txtClientNumber.Text
                };
                bool result = CategoryController.addCategory(cm);
                if (result)
                {
                    MessageBox.Show("New " + typeOf + " " + cm.CategoryID + " - " + cm.Description + " was added succesfully");
                }
            }
        }
 public void Dispose ()
 {
     model = null;
 }
Beispiel #39
0
 public DeployForm(ProjectModel projectModel = null)
 {
     InitializeComponent();
     _projectModel = projectModel;
 }
        public void SetUp()
        {
            doc = new ProjectModel();
            doc.CreateNewProject();
            doc.Changed += new ActionHandler(OnProjectChange);

            gotChangeNotice = false;
        }
 public void SetUp()
 {
     doc = new ProjectModel(xmlfile);
     project = new PropertyModel(doc);
 }
        private void loadDocument()
        {
            dgvDocumentInformation.Columns.Add("colType", "Type");
            dgvDocumentInformation.Columns.Add("colInformation", "Information");

            dgvDocumentHistory.Columns.Add("colVersion", "Version");
            dgvDocumentHistory.Columns.Add("colIssueDate", "Issue date");
            dgvDocumentHistory.Columns.Add("colChanges", "Changes");

            dgvDocumentApprovals.Columns.Add("colRole", "Role");
            dgvDocumentApprovals.Columns.Add("colName", "Name");
            dgvDocumentApprovals.Columns.Add("colSignature", "Signature");
            dgvDocumentApprovals.Columns.Add("colDateApproved", "Date approved");

            string json = JsonHelper.loadDocument(Settings.Default.ProjectID, "RiskManagamentProcess");
            List<string[]> documentInfo = new List<string[]>();
            newRiskManagmentProcessModel = new RiskManagmentProcessModel();
            currentRiskManagmentProcessModel = new RiskManagmentProcessModel();

            string jsonWord = JsonHelper.loadProjectInfo(Settings.Default.Username);
            List<ProjectModel> projectListModel = JsonConvert.DeserializeObject<List<ProjectModel>>(jsonWord);
            projectModel = projectModel.getProjectModel(Settings.Default.ProjectID, projectListModel);

            if (json != "")
            {
                versionControl = JsonConvert.DeserializeObject<VersionControl<RiskManagmentProcessModel>>(json);
                newRiskManagmentProcessModel = JsonConvert.DeserializeObject<RiskManagmentProcessModel>(versionControl.getLatest(versionControl.DocumentModels));
                currentRiskManagmentProcessModel = JsonConvert.DeserializeObject<RiskManagmentProcessModel>(versionControl.getLatest(versionControl.DocumentModels));

                documentInfo.Add(new string[] { "Document ID", currentRiskManagmentProcessModel.DocumentID });
                documentInfo.Add(new string[] { "Document Owner", currentRiskManagmentProcessModel.DocumentOwner });
                documentInfo.Add(new string[] { "Issue Date", currentRiskManagmentProcessModel.IssueDate });
                documentInfo.Add(new string[] { "Last Save Date", currentRiskManagmentProcessModel.LastSavedDate });
                documentInfo.Add(new string[] { "File Name", currentRiskManagmentProcessModel.FileName });

                foreach (var row in documentInfo)
                {
                    dgvDocumentInformation.Rows.Add(row);
                }
                dgvDocumentInformation.AllowUserToAddRows = false;

                foreach (var row in currentRiskManagmentProcessModel.DocumentHistories)
                {
                    dgvDocumentHistory.Rows.Add(new string[] { row.Version, row.IssueDate, row.Changes });
                }

                foreach (var row in currentRiskManagmentProcessModel.DocumentApprovals)
                {
                    dgvDocumentApprovals.Rows.Add(new string[] { row.Role, row.Name, row.Signature, row.DateApproved });
                }


                txtIdentifyRisk.Text = currentRiskManagmentProcessModel.IdentifyRisk;
                txtReviewRisk.Text = currentRiskManagmentProcessModel.ReviewRisk;
                txtAssignRiskActions.Text = currentRiskManagmentProcessModel.AssignRisk;

                txtTeamMember.Text = currentRiskManagmentProcessModel.TeamMember;
                txtProjectManager.Text = currentRiskManagmentProcessModel.ProjectManager;
                txtProjectBoard.Text = currentRiskManagmentProcessModel.ProjectBoard;

                txtRiskForm.Text = currentRiskManagmentProcessModel.RiskForm;
                txtRiskManager.Text = currentRiskManagmentProcessModel.RiskRegister;
            }
            else
            {
                versionControl = new VersionControl<RiskManagmentProcessModel>();
                versionControl.DocumentModels = new List<VersionControl<RiskManagmentProcessModel>.DocumentModel>();
                documentInfo.Add(new string[] { "Document ID", "" });
                documentInfo.Add(new string[] { "Document Owner", "" });
                documentInfo.Add(new string[] { "Issue Date", "" });
                documentInfo.Add(new string[] { "Last Save Date", "" });
                documentInfo.Add(new string[] { "File Name", "" });
                newRiskManagmentProcessModel = new RiskManagmentProcessModel();

                foreach (var row in documentInfo)
                {
                    dgvDocumentInformation.Rows.Add(row);
                }
                dgvDocumentInformation.AllowUserToAddRows = false;
            }
        }
 public NewProjectViewModel(ProjectModel model)
 {
     this.model = model;
     ServiceContainer.Resolve <ITracker>().CurrentScreen = "New Project";
 }
Beispiel #44
0
        public FileResult ExportToCSVProject(string fromdate, string todate, string location)
        {
            ProjectModel projectModel = new ProjectModel();
            DataTable    dtResult     = new DataTable();
            MemoryStream memoryStream = new MemoryStream();
            StreamWriter streamWriter = new StreamWriter(memoryStream);

            if (location == null || location == "")
            {
                location = "0";
            }
            dtResult = taskService.GetProjectWise(fromdate, todate, Convert.ToInt32(location));

            string WriteValue  = "";
            string writeHeader = "";
            int    i           = 0;

            foreach (DataColumn z in dtResult.Columns)
            {
                //This will create your Headers
                if (i == 0)
                {
                    writeHeader += string.Format("{0}", z.ColumnName.ToString());
                    WriteValue  += "Project type";
                    i            = 1;
                }
                else
                {
                    if (z.ColumnName.ToString().Contains("|"))
                    {
                        var      outval = z.ColumnName.ToString();
                        string[] array  = new string[2];
                        array        = outval.Split('|');
                        writeHeader += "," + string.Format("{0}", array[0].ToString());
                        WriteValue  += "," + string.Format("{0}", array[1].ToString());
                    }
                    // WriteValue += "," + string.Format("{0}", z.ColumnName.ToString());
                }
            }
            writeHeader += "," + "Total";
            streamWriter.WriteLine(writeHeader);
            streamWriter.WriteLine(WriteValue);
            foreach (DataRow r in dtResult.Rows)
            {
                WriteValue = "";
                i          = 0;
                foreach (DataColumn z in dtResult.Columns)
                {
                    if (i == 0)
                    {
                        WriteValue += string.Format("{0}", r[z.ColumnName].ToString());
                        i           = 1;
                    }
                    else
                    {
                        WriteValue += "," + string.Format("{0}", r[z.ColumnName].ToString());
                    }
                }
                streamWriter.WriteLine(WriteValue);
            }
            streamWriter.Flush();
            memoryStream.Position = 0;
            return(File(memoryStream, "text/csv", "ProjectWiseReport - " + fromdate + " - " + todate + ".csv"));
        }
#pragma warning disable VSTHRD100 // Avoid async void methods
        public async void OnProjectLoaded(Microsoft.Build.Evaluation.Project project, ProjectModel projectModel)
#pragma warning restore VSTHRD100 // Avoid async void methods
        {
            try
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                if (projectModel.IsBSIPAProject)
                {
                    BsipaProjectInSolution = true;
                }
                Microsoft.Build.Evaluation.Project userProj = null;
                try
                {
                    userProj = EnvUtils.GetProject(project.FullPath + ".user");
                    if (userProj == null)
                    {
                        return;
                    }
                }
                catch (InvalidOperationException) { return; }
                var installPath      = BSMTSettingsManager.Instance.CurrentSettings.ChosenInstallPath;
                var projBeatSaberDir = project.GetPropertyValue("BeatSaberDir");
                var userBeatSaberDir = userProj.GetPropertyValue("BeatSaberDir");
                if (BSMTSettingsManager.Instance.CurrentSettings.GenerateUserFileOnExisting &&
                    !string.IsNullOrEmpty(BSMTSettingsManager.Instance.CurrentSettings.ChosenInstallPath) &&
                    projectModel.IsBSIPAProject)
                {
                    Utilities.EnvUtils.SetReferencePaths(userProj, projectModel, project, null);
                    if (!string.IsNullOrEmpty(userBeatSaberDir) &&
                        userBeatSaberDir != BSMTSettingsManager.Instance.CurrentSettings.ChosenInstallPath)
                    {
                        var    prop    = userProj.GetProperty("BeatSaberDir");
                        string message = $"Overriding BeatSaberDir in {projectModel.ProjectName} to \n{prop?.EvaluatedValue}\n(Old path: {userBeatSaberDir})";
                        VsShellUtilities.ShowMessageBox(
                            this.package,
                            message,
                            $"{projectModel.ProjectName}: Auto Set BeatSaberDir",
                            OLEMSGICON.OLEMSGICON_INFO,
                            OLEMSGBUTTON.OLEMSGBUTTON_OK,
                            OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
                    }
                }
            }
            catch (Exception ex)
            {
                _ = Helpers.ShowErrorAsync("OnProjectLoaded", $"Error in OnProjectLoaded: {ex.Message}\n{ex}");
            }
        }
        public List <ProjectModel> GetAllProjectSummary()
        {
            try
            {
                foreach (Project proj in projects)
                {
                    try
                    {
                        currentProjectConfigs = buildConfigs.Where(x => x.ProjectId == proj.Id).ToList <BuildConfig>();

                        foreach (BuildConfig currentConfig in currentProjectConfigs)
                        {
                            var build = GetLatestBuildForConfig(currentConfig.Id);

                            ProjectModel project = new ProjectModel()
                            {
                                ProjectName         = proj.Name,
                                ProjectId           = proj.Id,
                                BuildConfigName     = currentConfig.Name,
                                LastBuildTime       = DateTime.ParseExact(build.StartDate, "yyyyMMddTHHmmsszzzzz", System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy HH:mm:ss"),
                                LastBuildStatus     = build.Status,
                                LastBuildStatusText = build.StatusText
                            };
                            projectList.Add(project);
                        }
                    }
                    catch (ArgumentNullException)
                    {
                        ProjectModel project = new ProjectModel()
                        {
                            ProjectName         = proj.Name,
                            ProjectId           = proj.Id,
                            BuildConfigName     = "** No Builds available **",
                            LastBuildTime       = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"),
                            LastBuildStatus     = "undefined",
                            LastBuildStatusText = String.Empty
                        };
                        projectList.Add(project);
                    }
                    catch (NullReferenceException)
                    {
                        ProjectModel project = new ProjectModel()
                        {
                            ProjectName         = proj.Name,
                            ProjectId           = proj.Id,
                            BuildConfigName     = String.Empty,
                            LastBuildTime       = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"),
                            LastBuildStatus     = "undefined",
                            LastBuildStatusText = String.Empty
                        };
                        projectList.Add(project);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }

                return(projectList
                       .OrderBy(x => x.LastBuildStatus.ToLower().Contains("success") ? 3 : 0)
                       .ThenBy(x => x.LastBuildStatus.ToLower().Contains("undefined") ? 2 : 0)
                       .ThenBy(x => x.LastBuildStatus.ToLower().Contains("failure") ? 1 : 0)
                       .ToList <ProjectModel>());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #47
0
 public void SaveContract(ProjectModel model)
 {
     Project.UpdateDataContract(model);
     SerializationHelper.Serialize(Project.filename, Project);
 }
 public ProjectNodeViewModel(BaseNodeViewModel parent, ProjectModel project) : base(project.FullFileName, project.Name, parent, true)
 {
     Project = project;
     IsBold  = true;
 }
 public Project ToProject(ProjectModel entry)
 {
     return(new Project {
         CreationDate = entry.CreationDate, Id = entry.Id, Name = entry.Name
     });
 }
Beispiel #50
0
        public void RulesForPipelineStatus(UserSessionModel admin, Project project)
        {
            //If Project Status changed from 'Inactive' to 'Open', change pipeline status to 'Opportunity'.
            if (project.ProjectStatusTypeId == ProjectStatusTypeEnum.Open)
            {
                var response = GetProjectModel(admin, project.ProjectId);
                if (response != null)
                {
                    var oldmodel = (ProjectModel)response.Model;
                    if (oldmodel.ProjectStatusTypeId == (byte?)ProjectStatusTypeEnum.Inactive)
                    {
                        project.ProjectLeadStatusTypeId = ProjectLeadStatusTypeEnum.Opportunity;
                    }
                }
            }

            //If project Open Status changed to 'Submittals' or 'Rep has PO', change pipeline status to 'Opportunity'.
            if (project.ProjectOpenStatusTypeId == (byte)ProjectOpenStatusTypeEnum.RepHasPO || project.ProjectOpenStatusTypeId == (byte)ProjectOpenStatusTypeEnum.Submittal)
            {
                project.ProjectLeadStatusTypeId = ProjectLeadStatusTypeEnum.Opportunity;
            }

            //If project has approved DAR , change pipeline status to 'Opportunity'.
            //ServiceResponse serviceResponse = GetProjectQuoteDARModel(admin, project.ProjectId);
            ServiceResponse serviceResponse = GetProjectModel(admin, project.ProjectId);

            if (serviceResponse != null)
            {
                ProjectModel projectModel = (ProjectModel)serviceResponse.Model;

                if (projectModel.ActiveQuoteSummary.DiscountRequestStatusTypeId == (byte)DiscountRequestStatusTypeEnum.Approved)
                {
                    project.ProjectLeadStatusTypeId = ProjectLeadStatusTypeEnum.Opportunity;
                }
            }

            //If project status changed to 'Inactive', change pipeline status to 'Disqualified'.
            if (project.ProjectStatusTypeId == ProjectStatusTypeEnum.Inactive)
            {
                project.ProjectLeadStatusTypeId = ProjectLeadStatusTypeEnum.Disqualified;
            }

            // Add project note when pipeline status is changed from 'Lead' to 'Opportunity'
            if (project.ProjectLeadStatusTypeId == ProjectLeadStatusTypeEnum.Opportunity &&
                !string.IsNullOrEmpty(project.ProjectId.ToString()))
            {
                // get old ProjectLeadStatusTypeId
                ServiceResponse response = GetProjectModel(admin, project.ProjectId);
                if (response != null)
                {
                    ProjectModel oldmodel = (ProjectModel)response.Model;
                    if (oldmodel.ProjectLeadStatusTypeId == ProjectLeadStatusTypeEnum.Lead)
                    {
                        //Add note
                        var newNoteModel = new ProjectPipelineNoteModel();
                        newNoteModel.ProjectId = project.ProjectId;
                        newNoteModel.Note      = Resources.ResourceUI.ConvertToOpportunity;

                        newNoteModel.ProjectPipelineNoteType = new ProjectPipelineNoteTypeModel()
                        {
                            ProjectPipelineNoteTypeId = 1,
                            Name = @Resources.ResourceUI.ProjectPipelineNoteTypeName1
                        };

                        AddProjectPipelineNote(admin, newNoteModel);
                    }
                }
            }
        }
Beispiel #51
0
 Task <ProjectModel> IProjectUsecase.AddProjectAsync(ProjectModel project)
 {
     project.SetStatus(true);
     return(this._projectRepository.AddProjectAsync(project));
 }
 public void Dispose()
 {
     _projectModel = null;
 }
        private async Task CreateProject()
        {
            try
            {
                List <KeyValuePair <string, string> > values = new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("Title", Title),
                    new KeyValuePair <string, string>("Project Type", TypeText),
                    new KeyValuePair <string, string>("Project Status", StatusText),
                    new KeyValuePair <string, string>("Firm", FirmText),
                    new KeyValuePair <string, string>("Address", Address)
                };
                if (FieldValidation.ValidateFields(values))
                {
                    if (Contractors.Where(c => c.IsChecked).Count() <= 0)
                    {
                        MessageBox.Show("Please add atleast 1 Contractor to the Project", "Add Contractor", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    else if (Suppliers.Where(c => c.IsChecked).Count() <= 0)
                    {
                        MessageBox.Show("Please add atleast 1 Supplier to the Project", "Add Supplier", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    else
                    {
                        CanSaveProject = false;

                        List <ProjectContractorsModel> projectContractors = new List <ProjectContractorsModel>();
                        List <ProjectSuppliersModel>   projectSuppliers   = new List <ProjectSuppliersModel>();

                        Contractors.Where(s => s.IsChecked).ToList().ForEach(s => projectContractors.Add(
                                                                                 new ProjectContractorsModel
                        {
                            ProjectID    = ID,
                            ContractorID = s.ID,
                        }));

                        Suppliers.Where(s => s.IsChecked).ToList().ForEach(s => projectSuppliers.Add(
                                                                               new ProjectSuppliersModel
                        {
                            ProjectID  = ID,
                            SupplierID = s.ID,
                        }));

                        ProjectModel projectData = new ProjectModel()
                        {
                            Title         = Title,
                            Description   = Description,
                            ProjectTypeID = SelectedType?.ID,
                            Type          = SelectedType == null ? new TypeModel {
                                Title = TypeText, CreatedBy = ParentLayout.LoggedInUser.Name
                            } : null,
                            ProjectStatusID = SelectedStatus?.ID,
                            Status          = SelectedStatus == null ? new StatusModel {
                                Title = StatusText, CreatedBy = ParentLayout.LoggedInUser.Name
                            } : null,
                            FirmID = SelectedFirm?.ID,
                            Firm   = SelectedFirm == null ? new FirmModel {
                                Name = FirmText, CreatedBy = ParentLayout.LoggedInUser.Name
                            } : null,
                            StartDate   = StartDate,
                            DueDate     = DueDate,
                            Address     = Address,
                            TeamID      = SelectedTeam?.ID,
                            Contractors = projectContractors,
                            Suppliers   = projectSuppliers
                        };

                        HttpResponseMessage result = null;
                        if (isUpdate)
                        {
                            projectData.ID         = ID;
                            projectData.CreatedBy  = SelectedProject.CreatedBy;
                            projectData.CreatedOn  = SelectedProject.CreatedOn;
                            projectData.ModifiedBy = ParentLayout.LoggedInUser.Name;
                            projectData.ModifiedOn = DateTime.Now;
                            result = await apiHelper.PutProject(ParentLayout.LoggedInUser.Token, projectData).ConfigureAwait(false);
                        }
                        else
                        {
                            projectData.CreatedBy = ParentLayout.LoggedInUser.Name;
                            projectData.CreatedOn = DateTime.Now;
                            result = await apiHelper.PostProject(ParentLayout.LoggedInUser.Token, projectData).ConfigureAwait(false);
                        }
                        if (result.IsSuccessStatusCode)
                        {
                            MessageBox.Show($"Project Saved Successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                            await GetProjects();

                            await ParentLayout.GetProjects();

                            IsUpdate = false;
                            ClearFields();
                            await GetContractors();
                            await GetSuppliers();
                            await GetTypes();
                            await GetStatuses();
                            await GetFirms();
                        }
                        else
                        {
                            MessageBox.Show("Error in saving Project", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                        CanSaveProject = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                CanSaveProject = true;
            }
        }
Beispiel #54
0
 public int InsertProjectDetails(ProjectModel prjModel)
 {
     return(projectDataAccess.InsertProjectDetails(prjModel));
 }
        protected void UpdateLocales(Project project, ProjectModel model)
        {
            foreach (var localized in model.Locales)
            {
                _localizedEntityService.SaveLocalizedValue(project,
                                                               x => x.Title,
                                                               localized.Title,
                                                               localized.LanguageId);
                _localizedEntityService.SaveLocalizedValue(project,
                                                               x => x.Full,
                                                               localized.Full,
                                                               localized.LanguageId);

            }
        }
Beispiel #56
0
 public int UpdateProjectDetails(ProjectModel prjModel)
 {
     return(projectDataAccess.UpdateProjectDetails(prjModel));
 }
 public void SetUp()
 {
     doc = new ProjectModel();
     project = new PropertyModel(doc);
     doc.CreateNewProject();
 }
Beispiel #58
0
 public void Initialize(ProjectModel pmodel)
 {
     SimulateHelper.Simulate(pmodel);
 }
        public async Task <IActionResult> Update([FromBody] ProjectModel model, Guid id)
        {
            await _projectService.Update(model, id);

            return(NoContent());
        }
 private void OnNewProjectExecuted()
 {
     Project = new ProjectModel();
        // LogManager.AddListener(new FileLogListener("UUM.log"));
     _log.Info("NewProject command executed");
 }