public static ProjectUnitAggregate ToDomain(this ProjectUnit projectUnit) { if (projectUnit == null) { throw new ArgumentNullException(nameof(projectUnit)); } return(new ProjectUnitAggregate { Packages = projectUnit.Unit == null || projectUnit.Unit.Packages == null ? new List <UnitPackageAggregate>() : projectUnit.Unit.Packages.Select(s => s.ToDomain()), UnitName = projectUnit.Unit == null ? null : projectUnit.Unit.UnitName }); }
public IActionResult CreateProject(Project project, List <TeamMember> members) { ProjectUnit unit = new ProjectUnit(); project.ProjectID = Guid.NewGuid(); unit.ProjectRepository.Insert(project); foreach (var item in members) { item.ProjectID = project.ProjectID; unit.TeamRepository.Insert(item); } unit.CreateProject(); ViewBag.Message = "Project created successfully!"; return(View("Index")); }
/// <summary> /// Get current length display unit type /// </summary> /// <param name="document">Revit's document</param> /// <returns>Current length display unit type</returns> private static DisplayUnitType GetLengthUnitType(Document document) { UnitType unittype = UnitType.UT_Length; ProjectUnit projectUnit = document.ProjectUnit; try { Autodesk.Revit.DB.FormatOptions formatOption = projectUnit.get_FormatOptions(unittype); return(formatOption.Units); } catch (System.Exception /*e*/) { return(DisplayUnitType.DUT_DECIMAL_FEET); } }
/// <summary> /// Get current length display unit type /// </summary> private void GetLengthUnitType() { UnitType unitType = UnitType.UT_Length; ProjectUnit projectUnit = m_document.ProjectUnit; try { Autodesk.Revit.DB.FormatOptions formatOption = projectUnit.get_FormatOptions(unitType); m_LengthUnitType = formatOption.Units; } catch (System.Exception /*e*/) { m_LengthUnitType = DisplayUnitType.DUT_DECIMAL_FEET; } }
public string CreateUnit(FormCollection FC) { ProjectUnit PU = new ProjectUnit(); PU.ExpectedPrice = Convert.ToDouble(FC["price"]); PU.Finishing = Convert.ToInt32(FC["finish"]); PU.FloorNumber = Convert.ToInt32(FC["floors"]); PU.Notes = FC["notes"]; PU.ProjectID = (int)TempData["PID"]; PU.LastEditBy = (Session["User"] as User).ID; PU.UnitSpace = Convert.ToInt32(FC["space"]); PU.UnitType = Convert.ToInt32(FC["type"]); PU.Create(); TempData.Keep(); return("true"); }
public void CreateContract(FormCollection FC) { Contract C = new Contract(); C.Date = DateTime.UtcNow.AddHours(3); C.Paid = Convert.ToDouble(FC["cpaid"]); C.Price = Convert.ToDouble(FC["cprice"]); C.ProjectID = Convert.ToInt32(FC["cprojectid"]); C.Remaining = Convert.ToDouble(FC["cremaining"]); C.UnitID = Convert.ToInt32(FC["cunitid"]); C.Notes = FC["cnotes"]; C.LastEditBy = (Session["User"] as User).ID; List <Installment> LOI = new List <Installment>(); double Amount = Convert.ToDouble(FC["cremaining"]); int InstallNum = Convert.ToInt32(FC["INum"]); double SingleInstallAmount = Convert.ToDouble(Amount / InstallNum); int MonthPeriod = Convert.ToInt32(FC["IMonthNum"]); DateTime LastMonthDate = Convert.ToDateTime(FC["IFirstDate"]); for (int i = 1; i <= InstallNum; i++) { Installment I = new Installment(); I.Amount = SingleInstallAmount; I.LastEditBy = (Session["User"] as User).ID; if (i == 1) { I.DueDate = LastMonthDate; } else { I.DueDate = LastMonthDate.AddMonths(MonthPeriod); LastMonthDate = (DateTime)I.DueDate; } I.PaymentDate = null; I.ResponsibleID = Convert.ToInt32(FC["iresponsibleid"]); LOI.Add(I); } List <ContractOwner> LOCO = new List <ContractOwner>(); LOCO = TempData["LOCO"] as List <ContractOwner>; ProjectUnit PU = new ProjectUnit { Id = (int)C.UnitID }; int UO = Convert.ToInt32(FC["iresponsibleid"]); C.CreateContract(LOCO, LOI, PU, UO, (Session["User"] as User).ID, Convert.ToInt32(FC["RecAcc"])); }