public override SortedDictionary <string, string> GetSubmitPara() { var sd = new SortedDictionary <string, string> { { "requestId", RequestId }, { "merchantCode", SumapayConfig.MerchantCode }, { "userIdIdentity", UserId.ToString() }, { "projectCode", ProjectCode.ToString() }, { "sum", Sum }, { "payType", PayType }, { "successReturnUrl", SuccessReturnUrl }, { "failReturnUrl", FailReturnUrl }, { "noticeUrl", SumapayConfig.NoticeUrl }, { "signature", GetSignature() } }; if (!string.IsNullOrEmpty(ProjectDescription)) { sd.Add("projectDescription ", HttpUtility.UrlEncode(ProjectDescription, Encoding.GetEncoding("GBK"))); } if (!string.IsNullOrEmpty(GiftFlag)) { sd.Add("giftFlag", GiftFlag); } if (!string.IsNullOrEmpty(SubledgerList)) { sd.Add("subledgerList", SubledgerList); } return(sd); }
public override SortedDictionary <string, string> GetSubmitPara() { var sd = new SortedDictionary <string, string> { { "requestId", RequestId }, { "merchantCode", SumapayConfig.MerchantCode }, { "userIdIdentity", UserId.ToString() }, { "projectCode", ProjectCode.ToString() }, { "sum", Sum }, { "successReturnUrl", SuccessReturnUrl }, { "failReturnUrl", FailReturnUrl }, { "noticeUrl", SumapayConfig.NoticeUrl }, { "signature", GetSignature() } }; if (!string.IsNullOrEmpty(RechargeUrl)) { sd.Add("rechargeUrl", RechargeUrl); } if (!string.IsNullOrEmpty(GiftFlag)) { sd.Add("giftFlag", GiftFlag); } if (!string.IsNullOrEmpty(SubledgerList)) { sd.Add("subledgerList", SubledgerList); } return(sd); }
public bool DeleteProjectCode(ProjectCode projectCode) { if (projectCode == null) return false; _unitOfWork.ProjectCodeRepository.Delete(projectCode); _unitOfWork.Save(); return true; }
public void user_project_command_failed() { //given var fixture = new Fixture().Customize(new AutoNSubstituteCustomization { ConfigureMembers = true }); fixture.Customizations.Add(new RandomNumericSequenceGenerator(long.MinValue, -1)); fixture.Register <Money>(() => Money.From(fixture.Create <Decimal>())); fixture.Register <EntityId>(() => EntityId.Empty()); fixture.Register <ProjectName>(() => ProjectName.Empty()); fixture.Register <ProjectCode>(() => ProjectCode.Empty()); fixture.Register <DateAndTime>(() => DateAndTime.Empty()); fixture.Register <Money>(() => fixture.Create <Money>()); var command = new AddProjectCommand(); var mediator = fixture.Create <IMediator>(); var logger = fixture.Create <ILogger <AddProjectCommandHandler> >(); var projectDb = fixture.Create <IDbSession <IProjectRepository> >(); var userDb = fixture.Create <IDbSession <IUserRepository> >(); // when var handler = new AddProjectCommandHandler(logger, mediator, projectDb, userDb); var result = handler.Execute(command); // then Assert.True(!result.IsSucceed && result.Violations.Count == 4); }
protected internal virtual Claim CreateNewClaim(Employee employee, Employee approver, string description, ProjectCode projectCode, DateTime dateCreated) { Claim claim = ClaimRepository.CreateNewClaim(employee, description); claim.ModifyApprover(approver); claim.ModifyProjectCode(projectCode); claim.DateCreated = dateCreated; return claim; }
public void The_project_parameters_request(String clientId, string name, string code, decimal budget, DateTime date) { _projectName = ProjectName.From(name); _projectCode = ProjectCode.From(code); _startDate = DateAndTime.From(date); _budget = Money.From(budget); _clientId = EntityId.From(Guid.Parse(clientId)); }
public ProjectCodeApiJson(ProjectCode projectCode) { ProjectCodeID = projectCode.ProjectCodeID; ProjectCodeName = projectCode.ProjectCodeName; ProjectCodeTitle = projectCode.ProjectCodeTitle; CreateDate = projectCode.CreateDate; ProjectStartDate = projectCode.ProjectStartDate; ProjectEndDate = projectCode.ProjectEndDate; }
public virtual void ModifyProjectCode(ProjectCode newCode) { ProjectCode = newCode; for (int i = 0; i < ExpenseItems.Count; i++) { AbstractExpenseItem item = (ExpenseItems[i]); item.ModifyProjectCode(m_projectCode); } }
public void Install() { CODE1 = CreateProjectCode("001", "Marketing"); CODE2 = CreateProjectCode("002", "Sales"); CODE3 = CreateProjectCode("003", "Training"); CreateProjectCode("004", "Consulting"); CreateProjectCode("005", "Product Development"); CreateProjectCode("006", "Recruitment"); CreateProjectCode("007", "Overhead"); }
public bool DeleteProjectCode(ProjectCode projectCode) { if (projectCode == null) { return(false); } _unitOfWork.ProjectCodeRepository.Delete(projectCode); _unitOfWork.Save(); return(true); }
/// <summary> /// Initializes a new project template /// </summary> public EmptyProjectTemplate() { Name = "Empty Project"; Description = "An empty project."; DefaultName = "GLua Project 1"; AllowType = true; // allow the user to change the project type ForcedType = ProjectType.Addon; // this doesn't matter because AllowType is true CodeFiles = new ProjectCode[0]; // we don't have any codefiles yet }
public static Project ToProject(this ProjectState state) => Project.From( EntityId.From(state.Id), ProjectName.From(state.Name), ProjectCode.From(state.Code), DateAndTime.From(state.StartDate), Money.From(state.Budget), EntityId.From(state.ClientId), Email.From(state.Owner), ProjectStatus.From(state.Status), ServiceOrderNumber.From(state.OrderNumber), Version.From(BitConverter.ToInt32(state.RowVersion)));
// This is only called after Clone() (so no need to unhook handlers). Need to refactor so that ResetProperties calls this public void AttachEventHandlers() { ProjectCode.PropertyChanged += ProjectCode_PropertyChanged; ProjectCode.AttachEventHandlers(); TaskCode.PropertyChanged += TaskCode_PropertyChanged; TaskCode.AttachEventHandlers(); foreach (var item in TimeEntries) { item.PropertyChanged += TimeEntries_Item_PropertyChanged; item.AttachEventHandlers(); } }
private ProjectAddedEvent(EntityId id, ProjectName name, ProjectCode code, DateAndTime startDate, Money budget, EntityId clientId, Version version) : base(DateTime.Now, version) { Id = id; Code = code; Name = name; Budget = budget; StartDate = startDate; ClientId = clientId; Owner = Email.Empty(); Status = ProjectStatus.Default(); OrderNumber = ServiceOrderNumber.Empty(); }
public override SortedDictionary <string, string> GetSubmitPara() { var sd = new SortedDictionary <string, string> { { "requestId", RequestId }, { "merchantCode", SumapayConfig.MerchantCode }, { "userIdIdentity", UserId.ToString() }, { "projectCode", ProjectCode.ToString() }, { "originalRequestId", OriginalRequestId }, { "originalOrderSum", OriginalOrderSum }, { "assignmentSum", AssignmentSum }, { "undertakeSum", UndertakeSum }, { "payType", PayType }, { "subledgerList", SubledgerList }, { "successReturnUrl", SuccessReturnUrl }, { "failReturnUrl", FailReturnUrl }, { "noticeUrl", SumapayConfig.NoticeUrl }, { "signature", GetSignature() } }; if (!string.IsNullOrEmpty(ProjectDescription)) { sd.Add("projectDescription", ProjectDescription); } if (!string.IsNullOrEmpty(CreditValue)) { sd.Add("creditValue", CreditValue); } if (!string.IsNullOrEmpty(UndertakePercentage)) { sd.Add("undertakePercentage", UndertakePercentage); } if (!string.IsNullOrEmpty(MainAccountType)) { sd.Add("mainAccountType", MainAccountType); } if (!string.IsNullOrEmpty(MainAccountCode)) { sd.Add("mainAccountCode", MainAccountCode); } if (!string.IsNullOrEmpty(BackUrl)) { sd.Add("backUrl", BackUrl); } if (!string.IsNullOrEmpty(RequestType)) { sd.Add("requestType", RequestType); } return(sd); }
public override SortedDictionary <string, string> GetSubmitPara() { return(new SortedDictionary <string, string> { { "requestId", RequestId }, { "merchantCode", SumapayConfig.MerchantCode }, { "userIdIdentity", UserId.ToString() }, { "projectCode", ProjectCode.ToString() }, { "successReturnUrl", SuccessReturnUrl }, { "failReturnUrl", FailReturnUrl }, { "noticeUrl", SumapayConfig.NoticeUrl }, { "signature", GetSignature() } }); }
public void project_add_command_succed() { var fixture = new Fixture().Customize(new AutoNSubstituteCustomization { ConfigureMembers = true }); fixture.Register <EntityId>(() => EntityId.From(fixture.Create <Guid>())); fixture.Register <ProjectName>(() => ProjectName.From(fixture.Create <string>())); fixture.Register <ProjectCode>(() => ProjectCode.From(fixture.Create <string>())); fixture.Register <DateAndTime>(() => DateAndTime.From(fixture.Create <DateTime>())); fixture.Register <ProjectStatus>(() => ProjectStatus.Default()); fixture.Register <ServiceOrderNumber>(() => ServiceOrderNumber.Empty()); fixture.Register <Email>(() => Email.From(string.Format($"{fixture.Create<string>()}@teste.com"))); fixture.Register <Project>(() => Project.NewRequest(fixture.Create <EntityId>(), fixture.Create <ProjectName>(), fixture.Create <ProjectCode>(), fixture.Create <DateAndTime>(), fixture.Create <Money>(), fixture.Create <EntityId>())); fixture.Register <User>(() => User.From(fixture.Create <EntityId>(), fixture.Create <Name>(), fixture.Create <SocialSecurityId>(), fixture.Create <Email>(), fixture.Create <Version>())); var finalProject = fixture.Create <Project>(); var finalClient = fixture.Create <User>(); var command = fixture.Build <AddProjectCommand>() .With(project => project.Name, finalProject.Name.Value) .With(project => project.Code, finalProject.Code.Value) .With(project => project.Budget, finalProject.Budget.Value) .With(project => project.ClientId, finalProject.ClientId.Value) .With(project => project.StartDate, finalProject.StartDate.Value) .Create(); var mediator = fixture.Create <IMediator>(); var logger = fixture.Create <ILogger <AddProjectCommandHandler> >(); var projectDb = fixture.Create <IDbSession <IProjectRepository> >(); var userDb = fixture.Create <IDbSession <IUserRepository> >(); var handler = new AddProjectCommandHandler(logger, mediator, projectDb, userDb); var result = handler.Execute(command); userDb.Received().Repository.Get(finalProject.ClientId).Returns(finalClient); projectDb.Received().Repository.Add(finalProject); projectDb.Received().SaveChanges(); mediator.Received(1).Publish(Arg.Any <ProjectAddedEvent>()); Assert.True(result.IsSucceed); }
public override SortedDictionary <string, string> GetSubmitPara() { var sd = new SortedDictionary <string, string> { { "requestId", RequestId }, { "merchantCode", SumapayConfig.MerchantCode }, { "userIdIdentity", UserId.ToString() }, { "projectCode", ProjectCode.ToString() }, { "repayLimit", RepayLimit }, { "successReturnUrl", SuccessReturnUrl }, { "failReturnUrl", FailReturnUrl }, { "noticeUrl", SumapayConfig.NoticeUrl }, { "signature", GetSignature() } }; if (!string.IsNullOrEmpty(Cycle)) { sd.Add("cycle", Cycle); } return(sd); }
public async Task <IViewComponentResult> InvokeAsync(Guid?formsId) { var code = from t1 in _context.Forms where t1.FormsId == formsId select t1.FormFileContent; byte[] arrCode = await code.FirstOrDefaultAsync(); ProjectCode pc = new ProjectCode(); if (arrCode != null) { pc.LeCode = System.Text.Encoding.ASCII.GetString(arrCode); } else { pc.LeCode = "Code not available"; } return(View(pc)); }
public object Clone() { var clone = new ObservableProjectTaskTimesheetItem(); clone.ProjectCode = (ObservablePickListItem)ProjectCode.Clone(); clone.TaskCode = (ObservablePickListItem)TaskCode.Clone(); clone.TimeEntries = new ObservableCollection <ObservableTimeEntry>(); foreach (var item in TimeEntries) { clone.TimeEntries.Add(item); } clone.AttachEventHandlers(); clone.AcceptChanges(); return(clone); }
protected override CommandResult <Guid> ExecuteCommand(AddProjectCommand command) { var isSucceed = false; var aggregationId = Guid.Empty; _logger.LogDebug("Criada agregação a partir do comando {CommandName} com valores {Valores}", nameof(command), command); var client = _dbUserSession.Repository.Get(EntityId.From(command.ClientId)); var agg = ProjectAggregationRoot.CreateFrom( ProjectName.From(command.Name), ProjectCode.From(command.Code), Money.From(command.Budget), DateAndTime.From(command.StartDate), client.Id); if (agg.ValidationResults.IsValid) { // _logger.LogInformation($"Agregação Project valida id gerado", agg.GetChange().Id); using (_logger.BeginScope("Persistencia")) { _dbSession.Repository.Add(agg.GetChange()); _dbSession.SaveChanges(); } // _logger.LogInformation($"Project persistido ID: {agg.GetChange().Id}"); using (_logger.BeginScope("Publicacão de Eventos")) { agg.GetEvents().ToImmutableList().ForEach(ev => Publisher.Publish(ev)); } isSucceed = true; aggregationId = agg.GetChange().Id.Value; } return(new CommandResult <Guid>(isSucceed, aggregationId, agg.ValidationResults.Errors.ToImmutableList())); }
/// <summary> /// Gets the project code id W ith create. /// </summary> /// <param name="projectNumber">The project number.</param> /// <returns></returns> public ProjectCode GetProjectCodeIdWIthCreate(string projectNumber) { var projCode = _unitOfWork.ProjectCodeRepository.FindBy(i => i.Value.ToUpper() == projectNumber.ToUpper()).SingleOrDefault(); if (projCode != null) { return(projCode); } else { ProjectCode newProjectCode = new ProjectCode() { Value = projectNumber.ToUpperInvariant() }; _unitOfWork.ProjectCodeRepository.Add(newProjectCode); _unitOfWork.Save(); return(newProjectCode); } }
public static ProjectAggregationRoot CreateFrom(ProjectName name, ProjectCode code, Money budget, DateAndTime startDate, EntityId clientId) { return(new ProjectAggregationRoot(EntityId.GetNext(), name, code, budget, startDate, clientId)); }
public bool EditProjectCode(ProjectCode projectCode) { _unitOfWork.ProjectCodeRepository.Edit(projectCode); _unitOfWork.Save(); return true; }
public virtual void ModifyProjectCode(ProjectCode newCode) { ProjectCode = (newCode); CheckIfComplete(); }
public bool AddProjectCode(ProjectCode projectCode) { _unitOfWork.ProjectCodeRepository.Add(projectCode); _unitOfWork.Save(); return true; }
/// <summary> /// Gets the project code id W ith create. /// </summary> /// <param name="projectNumber">The project number.</param> /// <returns></returns> public ProjectCode GetProjectCodeIdWIthCreate(string projectNumber) { var projCode = _unitOfWork.ProjectCodeRepository.FindBy(i => i.Value.ToUpper() == projectNumber.ToUpper()).SingleOrDefault(); if (projCode != null) { return projCode; } else { ProjectCode newProjectCode = new ProjectCode() { Value = projectNumber.ToUpperInvariant() }; _unitOfWork.ProjectCodeRepository.Add(newProjectCode); _unitOfWork.Save(); return newProjectCode; } }
private ProjectAggregationRoot(EntityId id, ProjectName name, ProjectCode code, Money budget, DateAndTime startDate, EntityId clientId) : this(Project.NewRequest(id, name, code, startDate, budget, clientId)) { }
/// <summary> /// Gets the balance In Units for non-food items. /// </summary> /// <param name="hubID">The hub ID.</param> /// <param name="commodityId">The commodity id.</param> /// <param name="shippingInstructionID">The shipping instruction ID.</param> /// <returns></returns> public SIBalance GetBalanceInUnit(int hubID, int commodityId, int shippingInstructionID) { SIBalance siBalance = new SIBalance(); siBalance.Commodity = repository.Commodity.FindById(commodityId).Name; siBalance.SINumberID = shippingInstructionID; ProjectCode projectCode = GetProjectCodeForSI(hubID, commodityId, shippingInstructionID); siBalance.ProjectCodeID = projectCode.ProjectCodeID; siBalance.Project = projectCode.Value; ShippingInstruction si = repository.ShippingInstruction.FindById(shippingInstructionID); var availableBalance = (from v in si.Transactions where v.LedgerID == Ledger.Constants.GOODS_ON_HAND_UNCOMMITED && commodityId == v.ParentCommodityID select v.QuantityInUnit).DefaultIfEmpty().Sum(); var firstOrDefaultans = si.Transactions.FirstOrDefault(); if (firstOrDefaultans != null) { siBalance.Program = firstOrDefaultans.Program.Name; } siBalance.AvailableBalance = availableBalance; siBalance.SINumber = si.Value; // convert the amount which is in Quintals to ... MT siBalance.CommitedToFDP = (from v in si.DispatchAllocations where v.IsClosed == false && v.CommodityID == commodityId select v.AmountInUnit).DefaultIfEmpty().Sum(); //select v.Amount / 10).DefaultIfEmpty().Sum(); var utilGetDispatchedAllocationFromSiResult = db.util_GetDispatchedAllocationFromSI(hubID, shippingInstructionID).FirstOrDefault(); if (utilGetDispatchedAllocationFromSiResult != null) { if (utilGetDispatchedAllocationFromSiResult.QuantityInUnit != null) { siBalance.CommitedToFDP -= utilGetDispatchedAllocationFromSiResult.QuantityInUnit.Value; } } siBalance.CommitedToOthers = (from v in si.OtherDispatchAllocations where v.IsClosed == false && v.CommodityID == commodityId select v.QuantityInUnit).DefaultIfEmpty().Sum(); decimal ReaminingExpectedReceipts = 0; var rAll = repository.ReceiptAllocation.FindBySINumber(siBalance.SINumber) .Where( p => { if (p.Commodity.ParentID == null) { return(p.CommodityID == commodityId); } else { return(p.Commodity.ParentID == commodityId); } } ) .Where(q => q.IsClosed == false); foreach (var receiptAllocation in rAll) { decimal Qunt = 0; if (receiptAllocation.QuantityInUnit != null) { Qunt = receiptAllocation.QuantityInUnit.Value; } ReaminingExpectedReceipts = ReaminingExpectedReceipts + (Qunt - repository.ReceiptAllocation.GetReceivedAlreadyInUnit(receiptAllocation)); } siBalance.ReaminingExpectedReceipts = ReaminingExpectedReceipts; siBalance.Dispatchable = siBalance.AvailableBalance - (siBalance.CommitedToFDP + siBalance.CommitedToOthers) + ReaminingExpectedReceipts; siBalance.TotalDispatchable = siBalance.AvailableBalance - (siBalance.CommitedToFDP + siBalance.CommitedToOthers); return(siBalance); }
protected internal virtual Claim CreateNewClaim(Employee employee, Employee approver, string description, ProjectCode projectCode, DateTime dateCreated) { Claim claim = ClaimRepository.CreateNewClaim(employee, description); claim.ModifyApprover(approver); claim.ModifyProjectCode(projectCode); claim.DateCreated = dateCreated; return(claim); }
private void SendData() { for (int i = 0; i < 10; i++) { string lbName; var listboxData = new ListBox(); var container = Master.FindControl("Body"); string[] input = new string[10]; for (int i2 = 0; i2 <= 2; i2++) //--Var { string tbName = "tbEdit" + i.ToString() + i2.ToString(); var txtBox = container.FindControl(tbName); switch (i2) { case 0: if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString())) { goto track1; } else { input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString())); } break; case 1: if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString())) { input[i2] = DateTime.Today.ToString(); } else { input[i2] = (((TextBox)txtBox).Text.ToString()); } break; case 2: if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString())) { input[i2] = DateTime.Today.ToString(); } else { input[i2] = (((TextBox)txtBox).Text.ToString()); } break; } } UserCode LoginUser = (UserCode)Session["authenticatedUser"]; UserCode user = GetCurrentUser(LoginUser.ID); DateTime dt = DateTime.Now; string dateNow = dt.ToString("yyyy-MM-dd"); _business.AddProject(new ProjectCode(0, input[0], Convert.ToDateTime(input[1]), Convert.ToDateTime(input[2]), user.ID, Convert.ToDateTime(dateNow), Convert.ToDateTime(dateNow))); //--Var lbName = "lbEdit" + i.ToString() + "0"; listboxData = container.FindControl(lbName) as ListBox; if (listboxData.SelectedIndex.ToString().Count() != 0) { foreach (ListItem l in listboxData.Items) { if (l.Selected == true) { ProjectCode Project = _business.GetProjects(sortingPar).Last(); //--Var _business.AddCRAToProject(Convert.ToInt32(l.Value.ToString()), Project.ID); //--Var } } } lbName = "lbEdit" + i.ToString() + "1"; listboxData = container.FindControl(lbName) as ListBox; if (listboxData.SelectedIndex.ToString().Count() != 0) { foreach (ListItem l in listboxData.Items) { if (l.Selected == true) { ProjectCode Project = _business.GetProjects(sortingPar).Last(); //--Var _business.AddDoctorToProject(Convert.ToInt32(l.Value.ToString()), Project.ID); //--Var } } } lbName = "lbEdit" + i.ToString() + "2"; listboxData = container.FindControl(lbName) as ListBox; if (listboxData.SelectedIndex.ToString().Count() != 0) { foreach (ListItem l in listboxData.Items) { if (l.Selected == true) { ProjectCode Project = _business.GetProjects(sortingPar).Last(); //--Var _business.AddHospitalToProject(Convert.ToInt32(l.Value.ToString()), Project.ID); //--Var } } } lbName = "lbEdit" + i.ToString() + "3"; listboxData = container.FindControl(lbName) as ListBox; if (listboxData.SelectedIndex.ToString().Count() != 0) { foreach (ListItem l in listboxData.Items) { if (l.Selected == true) { ProjectCode Project = _business.GetProjects(sortingPar).Last(); //--Var _business.AddProjectManagerToProject(Convert.ToInt32(l.Value.ToString()), Project.ID); //--Var } } } track1: continue; } }
public virtual void NewProjectCode(ProjectCode newCode) { ModifyProjectCode(newCode); }
public virtual void ClearProjectCode() { ProjectCode = (null); CheckIfComplete(); }
public bool EditProjectCode(ProjectCode projectCode) { _unitOfWork.ProjectCodeRepository.Edit(projectCode); _unitOfWork.Save(); return(true); }
public bool AddProjectCode(ProjectCode projectCode) { _unitOfWork.ProjectCodeRepository.Add(projectCode); _unitOfWork.Save(); return(true); }
public override int GetHashCode() { return((ProjectCode?.GetHashCode()).GetValueOrDefault() ^ TicketNumber.GetHashCode()); }
public virtual void ClearProjectCode() { ProjectCode = null; }