public CommodityDeliveryNote Create(CostCentre documentIssuerCostCentre, Guid documentIssueCostCentreApplicationId, CostCentre documentRecipientCostCentre, User documentIssuerUser, string documentReference, Guid documentParentId, DateTime documentDate, DateTime documentDateIssued, string driverName, string vehicleRegNo, DateTime? vehicleArrivalTime = null, DateTime? vehicleDepartureTime = null,decimal? vehicleArrivalMileage = null,decimal? vehicleDepartureMileage = null, string description = "", string note = "") { Guid id = Guid.NewGuid(); CommodityDeliveryNote doc = DocumentPrivateConstruct<CommodityDeliveryNote>(id); if (documentParentId == null || documentParentId == Guid.Empty) doc.DocumentParentId = id; else doc.DocumentParentId = documentParentId; doc.DocumentDate = documentDate; doc.DocumentDateIssued = documentDateIssued; doc.Description = description; doc.Note = note; doc.DriverName = driverName; doc.VehiclRegNo = vehicleRegNo; doc.VehicleArrivalMileage = vehicleArrivalMileage; doc.VehicleArrivalTime = vehicleArrivalTime; doc.VehicleDepartureMileage = vehicleDepartureMileage; doc.VehicleDepartureTime = vehicleDepartureTime; Map(doc, documentIssuerCostCentre, documentIssueCostCentreApplicationId, documentRecipientCostCentre, documentIssuerUser, documentReference, null, null); SetDefaultDates(doc); doc.EnableAddCommands(); return doc; }
public CCCommandProcessingDetailViewModel(CostCentre costCentre, List<CommandProcessingAudit> items) { Items = new List<CommandProcessingAuditItem>(); CostCentreName = costCentre.Name; CostCentreId = costCentre.Id.ToString(); Setup(items); }
public CommodityReleaseNote Create(CostCentre documentIssuerCostCentre, Guid documentIssueCostCentreApplicationId, CostCentre documentRecipientCostCentre, User documentIssuerUser, string documentReference, Guid documentParentId, DateTime documentDate, DateTime documentDateIssued, string description,string note) { Guid id = Guid.NewGuid(); var doc = DocumentPrivateConstruct<CommodityReleaseNote>(id); if (documentParentId == null || documentParentId == Guid.Empty) doc.DocumentParentId = id; else doc.DocumentParentId = documentParentId; doc.DocumentIssuerCostCentre = documentIssuerCostCentre; doc.DocumentIssuerCostCentreApplicationId = documentIssueCostCentreApplicationId; doc.DocumentRecipientCostCentre = documentRecipientCostCentre; doc.DocumentReference = documentReference; doc.DocumentIssuerUser = documentIssuerUser; doc.Description = description; doc.Note = note; doc.DocumentDate = documentDate; doc.DocumentDateIssued = documentDateIssued; Map(doc, documentIssuerCostCentre, documentIssueCostCentreApplicationId, documentRecipientCostCentre, documentIssuerUser, documentReference, null, null); SetDefaultDates(doc); doc.EnableAddCommands(); return doc; }
public ActivityDocument Create(CostCentre hub, CostCentre clerk, CostCentre supplier, CommodityProducer commodityProducer, ActivityType activityType, Route route, Centre centre, Season season, string documentReference, Guid documentIssueCostCentreApplicationId, DateTime documentDate, DateTime activityDate, string description = "", string note = "") { Guid id = Guid.NewGuid(); ActivityDocument doc = DocumentPrivateConstruct<ActivityDocument>(id); doc.DocumentDate = documentDate; doc.DocumentDateIssued = activityDate; doc.Description = description; doc.Hub = hub; doc.FieldClerk = clerk; doc.Supplier = supplier; doc.Producer = commodityProducer; doc.ActivityType = activityType; doc.Route = route; doc.Centre = centre; doc.DocumentReference = documentReference; doc.DocumentIssuerCostCentreApplicationId = documentIssueCostCentreApplicationId; doc.Hub = hub; doc.FieldClerk = clerk; doc.Supplier = supplier; doc.DocumentReference = documentReference; doc.ActivityDate = activityDate; doc.DocumentDateIssued = DateTime.Now; doc.Season = season; SetDefaultDates(doc); doc.EnableAddCommands(); return doc; }
protected OrderSaleContextBuilder(Outlet outlet, CostCentre costCentre, User user, Sale sale, Bank bank, BankBranch bankBranch) { Outlet = outlet; CostCentre = costCentre; User = user; Sale = sale; Bank = bank; BankBranch = bankBranch; }
public AuditLog(Guid id, CostCentre actionOwner, User actionUser, string module, string action, DateTime actionTimeStamp) :base(id) { ActionOwner = actionOwner; ActionUser = actionUser; Module = module; Action = action; ActionTimeStamp = actionTimeStamp; }
public CCCommandProcessingDetailViewModel(DateTime dt, CostCentre costCentre, List<CommandProcessingAudit> items) { Date = dt; ShortDate = dt.ToShortDateString(); Items = new List<CommandProcessingAuditItem>(); CostCentreName = costCentre.Name; CostCentreId = costCentre.Id.ToString(); Setup(items); }
public CostCentreViewModel Map(CostCentre costCentre) { return new CostCentreViewModel { CostCentreType = costCentre.CostCentreType, ParentCostCentre = costCentre.ParentCostCentre, Contact = costCentre.Contact }; }
public CCAuditHitSummaryViewModel(DateTime dt, CostCentre costCentre, List<CCAuditItem> items, string selectedaction) { ItemsByAction = new List<CCAuditItem>(); Date = dt; CostCentreId = costCentre.Id; CostCentre = costCentre.Name; Setup(items, selectedaction); SelectedAction = selectedaction; }
protected OrderSaleEnvelopeContext(long sequenceNumber, Outlet outlet, User user, CostCentre costCentre, Order order) { Outlet = outlet; User = user; CostCentre = costCentre; Order = order; var dateTime = DateTime.Now; //Remove milliseconds Now = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second); ReferenceGenerator = new ReferenceGenerator(sequenceNumber, user, outlet, Now); VisitId = Guid.NewGuid(); }
Document Map(Document document, DocumentType documentType, CostCentre documentIssuerCostCentre, CostCentre documentRecipientCostCentre, User documentIssuerUser, string DocumentReference, double? longitude, double? latitude) { document.DocumentType = documentType; document.DocumentIssuerCostCentre = documentIssuerCostCentre; document.DocumentRecipientCostCentre = documentRecipientCostCentre; document.DocumentIssuerUser = documentIssuerUser; document.DocumentReference = DocumentReference; document.Status = DocumentStatus.New; document.DocumentDateIssued = DateTime.Now; return MapLocation(document, longitude, latitude); }
public InventoryTransferNote Create(CostCentre documentIssuerCostCentre, Guid documentIssuerCostCentreApplicationId, User documentIssuerUser, CostCentre documentRecipientCostCentre, CostCentre documentIssuedOnBehalfOfCostCentre, string documentReference) { Guid id = Guid.NewGuid(); InventoryTransferNote doc = DocumentPrivateConstruct<InventoryTransferNote>(id); doc.DocumentType = DocumentType.InventoryTransferNote; doc.DocumentParentId = id; Map(doc,documentIssuerCostCentre, documentIssuerCostCentreApplicationId,documentRecipientCostCentre, documentIssuerUser,documentReference,null, null); SetDefaultDates(doc); doc.EnableAddCommands(); return doc; }
public CreditNote Create(CostCentre documentIssuerCostCentre, Guid documentIssueCostCentreApplicationId, CostCentre documentRecipientCC, User documentIssuerUser, string documentReference, Guid documentParentId, Guid invoiceId) { Guid id = Guid.NewGuid(); CreditNote doc = DocumentPrivateConstruct<CreditNote>(id); doc.DocumentType = DocumentType.CreditNote; doc.InvoiceId = invoiceId; if (documentParentId == null || documentParentId == Guid.Empty) doc.DocumentParentId = id; else doc.DocumentParentId = documentParentId; Map(doc, documentIssuerCostCentre, documentIssueCostCentreApplicationId, documentRecipientCC, documentIssuerUser, documentReference, null, null); SetDefaultDates(doc); doc.EnableAddCommands(); return doc; }
public StockIssueNote(Guid id, string documentReference, CostCentre documentIssuerCostCentre, int documentIssueCostCentreApplicationId, User documentIssuerUser, DateTime documentDateIssued, CostCentre documentRecipientCostCentre, DocumentStatus status, List<StockIssueNoteLineItem> lineItems ) : base(id, documentReference, documentIssuerCostCentre, documentIssueCostCentreApplicationId, documentIssuerUser, documentDateIssued, documentRecipientCostCentre, status) { _lineItems = lineItems; this.DocumentType = DocumentType.StockIssueNote; }
public InventoryAdjustmentNote Create(CostCentre documentIssuerCostCentre, Guid documentIssueCostCentreApplicationId, CostCentre documentRecipientCC, User documentIssuerUser, string documentReference, InventoryAdjustmentNoteType inventoryAdjustmentNoteType, Guid documentParentId , double? longitude = null, double? latitude = null) { Guid id = Guid.NewGuid(); InventoryAdjustmentNote doc = DocumentPrivateConstruct<InventoryAdjustmentNote>(id); // new InventoryAdjustmentNote(id); doc.InventoryAdjustmentNoteType = inventoryAdjustmentNoteType; doc.DocumentType = DocumentType.InventoryAdjustmentNote; if (documentParentId == null || documentParentId == Guid.Empty) doc.DocumentParentId = id; else doc.DocumentParentId = documentParentId; Map(doc, documentIssuerCostCentre, documentIssueCostCentreApplicationId, documentRecipientCC, documentIssuerUser, documentReference, latitude, longitude); SetDefaultDates(doc); doc.EnableAddCommands(); return doc; }
public Order Create(CostCentre documentIssuerCostCentre, Guid documentIssueCostCentreApplicationId, CostCentre documentRecipientCC, User documentIssuerUser, CostCentre issuedOnBehalfOf, OrderType orderType, string documentReference, Guid documentParentId, DateTime dateRequired) { Guid id = Guid.NewGuid(); Order doc = DocumentPrivateConstruct<Order>(id); doc.DocumentType = DocumentType.Order; doc.OrderType = orderType; doc.IssuedOnBehalfOf = issuedOnBehalfOf; doc.DateRequired = dateRequired; if (documentParentId == null || documentParentId == Guid.Empty) doc.DocumentParentId = id; else doc.DocumentParentId = documentParentId; Map(doc, documentIssuerCostCentre, documentIssueCostCentreApplicationId, documentRecipientCC, documentIssuerUser, documentReference, null, null); SetDefaultDates(doc); doc.EnableAddCommands(); return doc; }
public Route CreateRoute(CostCentre costCenter,string name,string code, Guid id) { //throw new ArgumentException("in else5"); if (costCenter.CostCentreType != CostCentreType.Distributor) { if (costCenter.CostCentreType != CostCentreType.Hub) throw new ArgumentException("Invalid CostCenter" + costCenter.CostCentreType); } if(costCenter.Id==Guid.Empty) throw new ArgumentException("CostCenter must exist in the system"); Route route = new Route(id) { //Distributor = new CostCentreRef {Id = costCenter.Id}, Name = name, Code = code }; return route; }
public DispatchNote Create(CostCentre documentIssuerCostCentre, Guid documentIssueCostCentreApplicationId, CostCentre documentRecipientCC, User documentIssuerUser, CostCentre issuedOnBehalfOf, DispatchNoteType dispatchNoteType, string documentReference, Guid documentParentId, Guid orderId) { Guid id = Guid.NewGuid(); DispatchNote doc = DocumentPrivateConstruct<DispatchNote>(id); doc.DocumentType = DocumentType.DispatchNote; doc.DispatchType = dispatchNoteType; doc.OrderId = orderId; if (documentParentId == null || documentParentId == Guid.Empty) doc.DocumentParentId = id; else doc.DocumentParentId = documentParentId; Map(doc, documentIssuerCostCentre, documentIssueCostCentreApplicationId, documentRecipientCC, documentIssuerUser, documentReference, null, null); SetDefaultDates(doc); doc.EnableAddCommands(); return doc; }
public Document CreateDocument(Guid id, DocumentType documentType, CostCentre documentIssuerCC, CostCentre documentRecipientCC, User documentIssuerUser, string DocumentReference, double? longitude=null, double? latitude=null) { Document doc = null; switch (documentType) { case DocumentType.Order: doc = new Order(id); doc = Map(doc, documentType, documentIssuerCC, documentRecipientCC, /*null, */documentIssuerUser, DocumentReference, longitude, latitude); break; case DocumentType.DispatchNote:// doc = new DispatchNote(id); doc = Map(doc, documentType, documentIssuerCC, documentRecipientCC, /*null, */documentIssuerUser, DocumentReference, longitude, latitude); break; case DocumentType.Receipt: doc = new Receipt(id); doc = Map(doc, documentType, documentIssuerCC, documentRecipientCC, documentIssuerUser, DocumentReference, longitude, latitude); break; case DocumentType.DisbursementNote: doc = new DisbursementNote(id); doc = Map(doc, documentType, documentIssuerCC, documentRecipientCC, documentIssuerUser, DocumentReference, longitude, latitude); break; case DocumentType.CreditNote: doc = new CreditNote(id); doc = Map(doc, documentType, documentIssuerCC, documentRecipientCC, documentIssuerUser, DocumentReference, longitude, latitude); break; case DocumentType.ReturnsNote: doc = new ReturnsNote(id); doc = Map(doc, documentType, documentIssuerCC, documentRecipientCC, documentIssuerUser, DocumentReference, longitude, latitude); break; case DocumentType.PaymentNote: doc = new PaymentNote(id); doc = Map(doc, documentType, documentIssuerCC, documentRecipientCC, documentIssuerUser, DocumentReference, longitude, latitude); break; } return doc; }
public MainOrder Create(CostCentre documentIssuerCostCentre, Guid documentIssueCostCentreApplicationId, CostCentre documentRecipientCC, User documentIssuerUser, CostCentre issuedOnBehalfOf, OrderType orderType, string documentReference, Guid documentParentId,string shipToAddress, DateTime dateRequired,decimal saleDiscount,string note="") { Guid id = Guid.NewGuid(); MainOrder doc = DocumentPrivateConstruct<MainOrder>(id); doc.DocumentType = DocumentType.Order; doc.OrderType = orderType; doc.IssuedOnBehalfOf = issuedOnBehalfOf; doc.DateRequired = dateRequired; doc.OrderStatus = OrderStatus.New; doc.DocumentParentId = id; doc.ParentId = id; doc.SaleDiscount = saleDiscount; doc.ShipToAddress = shipToAddress; doc.Note = note; Map(doc, documentIssuerCostCentre, documentIssueCostCentreApplicationId, documentRecipientCC, documentIssuerUser, documentReference, null, null); SetDefaultDates(doc); doc.EnableAddCommands(); SubOrder subOrder = MakeSubOrder(doc); AddSubDocument(subOrder, doc); return doc; }
public MakeOrderEnvelopeContext(long sequenceNumber, Outlet outlet, User user, CostCentre costCentre, Order order) : base(sequenceNumber, outlet, user, costCentre, order) { }
protected string GetDocumentReference(string docRef, CostCentre issuerCostCentre) { DateTime dt = DateTime.Now; string D = ""; string DT = dt.ToString("yyyyMMdd"); string TM = dt.ToString("hhmmss"); string SN = ""; string SC = ""; string ON = ""; string OC = ""; string SQ = ""; int sequenceId = 0; var salesman = _costCentreRepository.GetById(issuerCostCentre.Id); var outlet = _costCentreRepository.GetById(issuerCostCentre.Id); ON = outlet != null ? outlet.Name : ""; OC = outlet != null ? outlet.CostCentreCode : ""; SN = salesman != null ? salesman.Name : ""; SC = salesman != null ? salesman.CostCentreCode : ""; string refRule = "{D}_{SN}_{OC}_{DT}_{TM}_{SQ}"; var docrefRule = _settingsRepository.GetByKey(SettingsKeys.DocReferenceRule); if (docrefRule != null) { refRule = docrefRule.Value; } D = "CRN"; SQ = (_commodityReleaseRepository.GetCount() + 1).ToString(); SQ = SQ.PadLeft(5, '0'); string refno = refRule.Replace("{D}", D).Replace("{SN}", SN).Replace("{SC}", SC).Replace("{ON}", ON).Replace("{OC}", OC).Replace("{DT}", DT).Replace("{TM}", TM).Replace("{SQ}", SQ); refno = refno.Replace(" ", ""); return refno; }
private void AssertDistributorSalesman(CostCentre distributorSalesman, CostCentre savedDistributorSalesman) { Assert.AreEqual(distributorSalesman.Name,savedDistributorSalesman.Name); Assert.AreEqual(distributorSalesman.CostCentreCode,savedDistributorSalesman.CostCentreCode); Assert.AreEqual(distributorSalesman._Status,EntityStatus.Active); }
private void AssertCostCernter(CostCentre producerCostCentreX, CostCentre producerCostCentreY) { Assert.NotNull(producerCostCentreX.Id); Assert.AreEqual(producerCostCentreX.CostCentreType, producerCostCentreY.CostCentreType); Assert.AreEqual(producerCostCentreX.Name, producerCostCentreY.Name); }
private static void SetAsDeleted(CostCentre updatedCC, Guid updatedCcId) { CostCentre costCentre; _costCentreRepository.SetAsDeleted(updatedCC); costCentre = _costCentreRepository.GetById(updatedCcId); Assert.AreEqual(costCentre._Status, EntityStatus.Deleted); Trace.WriteLine(string.Format("CostCentre[{0}], Status[{1}]", costCentre.CostCentreType, costCentre._Status)); }
public bool CanEditHubOrDistributrRegion(CostCentre hubOrDistributr) { if(_ctx.tblCostCentre.FirstOrDefault(n => n.Id == hubOrDistributr.Id).tblRegion.tblRoutes.Any(n => n.IM_Status != (int)EntityStatus.Deleted)) { return false; } return true; }
protected string GetDocumentReference(string docRef, CostCentre issuerCostCentre) { using (StructureMap.IContainer cont = NestedContainer) { docRef = Using<IGetDocumentReference>(cont) .GetDocReference(docRef, issuerCostCentre.Id, issuerCostCentre.Id); } return docRef; }
public CCCommandProcessingDetailViewModel(CostCentre costCentre) { CostCentreName = costCentre.Name; CostCentreId = costCentre.Id.ToString(); GroupItems = new List<CommandProcessingAuditGroup>(); }
public SaleAndContextBuilder(Outlet outlet, CostCentre costCentre, User user, Sale sale, Bank bank, BankBranch bankBranch) : base(outlet, costCentre, user, sale, bank, bankBranch) { }
public void SetUp() { ClearViewModel(); Config config = GetConfigParams(); currentUser = GetEntityById(typeof(User), GetConfigViewModelParameters().CurrentUserId) as User; currentCostCenter = GetEntityById(typeof(CostCentre), config.CostCentreId) as CostCentre; currentCostCentreAppId = config.CostCentreApplicationId; using (StructureMap.IContainer c = NestedContainer) { DocumentReference= Using<IGetDocumentReference>(c).GetDocReference("StorageNote", currentCostCenter.Id, currentCostCenter.Id); } LoadStores(); StoreList.Add(DefaultStore); SelectedStore = DefaultStore; }