コード例 #1
0
  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;
  }
コード例 #2
0
 public CCCommandProcessingDetailViewModel(CostCentre costCentre, List<CommandProcessingAudit> items)
 {
     Items = new List<CommandProcessingAuditItem>();
     CostCentreName = costCentre.Name;
     CostCentreId = costCentre.Id.ToString();
     Setup(items);
 }
コード例 #3
0
        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;
        }
コード例 #4
0
ファイル: ActivityFactory.cs プロジェクト: asanyaga/BuildTest
 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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
ファイル: AuditLog.cs プロジェクト: asanyaga/BuildTest
 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;
 }
コード例 #7
0
 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);
 }
コード例 #8
0
 public CostCentreViewModel Map(CostCentre costCentre)
 {
     return new CostCentreViewModel
     {
         CostCentreType   = costCentre.CostCentreType,
        
         ParentCostCentre = costCentre.ParentCostCentre,
         Contact          = costCentre.Contact
     };
 }
コード例 #9
0
 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;
 }
コード例 #10
0
 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();
 }
コード例 #11
0
ファイル: DocumentFactory.cs プロジェクト: asanyaga/BuildTest
         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);
        }
コード例 #12
0
        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;
        }
コード例 #13
0
 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;
 }
コード例 #14
0
ファイル: StockIssueNote.cs プロジェクト: asanyaga/BuildTest
 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;
 }
コード例 #15
0
 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;
 }
コード例 #16
0
ファイル: OrderFactory.cs プロジェクト: asanyaga/BuildTest
        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;
        }
コード例 #17
0
ファイル: RouteFactory.cs プロジェクト: asanyaga/BuildTest
        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;
        }
コード例 #18
0
        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;
        }
コード例 #19
0
ファイル: DocumentFactory.cs プロジェクト: asanyaga/BuildTest
        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;
        }
コード例 #20
0
        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;
        }
コード例 #21
0
 public MakeOrderEnvelopeContext(long sequenceNumber, Outlet outlet, User user, CostCentre costCentre, Order order) : base(sequenceNumber, outlet, user, costCentre, order)
 {
 }
コード例 #22
0
        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;
        }
コード例 #23
0
 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);
 }
コード例 #24
0
 private void AssertCostCernter(CostCentre producerCostCentreX, CostCentre producerCostCentreY)
 {
     Assert.NotNull(producerCostCentreX.Id);
     Assert.AreEqual(producerCostCentreX.CostCentreType, producerCostCentreY.CostCentreType);
     Assert.AreEqual(producerCostCentreX.Name, producerCostCentreY.Name);
 }
コード例 #25
0
 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));
 }
コード例 #26
0
ファイル: MasterDataUsage.cs プロジェクト: asanyaga/BuildTest
 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;
 }
コード例 #27
0
 protected string GetDocumentReference(string docRef, CostCentre issuerCostCentre)
 {
     using (StructureMap.IContainer cont = NestedContainer)
     {
         docRef = Using<IGetDocumentReference>(cont)
             .GetDocReference(docRef, issuerCostCentre.Id, issuerCostCentre.Id);
     }
     return docRef;
 }
コード例 #28
0
 public CCCommandProcessingDetailViewModel(CostCentre costCentre)
 {
     CostCentreName = costCentre.Name;
     CostCentreId = costCentre.Id.ToString();
     GroupItems = new List<CommandProcessingAuditGroup>();
 }
コード例 #29
0
 public SaleAndContextBuilder(Outlet outlet, CostCentre costCentre, User user, Sale sale, Bank bank, BankBranch bankBranch)
     : base(outlet, costCentre, user, sale, bank, bankBranch)
 {
 }
コード例 #30
0
 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;
     
 }