public void BuildShippingTypeList()
 {
     using (FFAdminDBEntities db = new FFAdminDBEntities())
     {
         ShippingTypeList = db.ShippingType.ToList();
     }
 }
        public ProfitForTranListViewModel(List <Tran> trans)
        {
            using (FFAdminDBEntities db = new FFAdminDBEntities())
            {
                if (trans != null || trans.Count() > 0)
                {
                    this.ProfitsVM = new List <ProfitViewModel>();
                    // get trans

                    this.Trans = trans;

                    // calculate all profits per currency
                    foreach (var x in Trans)
                    {
                        this.ProfitsVM.Add(new ProfitViewModel(x.TranID));
                    }

                    // create grouping
                    ProfitGrouping = new List <TranProfit>();
                    CreateProfitGrouping();

                    // calculate the profit
                    foreach (var x in ProfitGrouping)
                    {
                        x.Profit = x.TotalEarned - x.TotalPaid;
                    }
                }
            }
        }
 public void BuildShippingTypeList()
 {
     using (FFAdminDBEntities db = new FFAdminDBEntities())
     {
         ShippingTypeList = db.ShippingType.ToList();
     }
 }
        public ProfitForTranListViewModel(List<Tran> trans)
        {
            using (FFAdminDBEntities db = new FFAdminDBEntities())
            {

                if (trans != null || trans.Count() > 0)
                {
                    this.ProfitsVM = new List<ProfitViewModel>();
                    // get trans

                    this.Trans = trans;

                    // calculate all profits per currency
                    foreach (var x in Trans)
                    {
                        this.ProfitsVM.Add(new ProfitViewModel(x.TranID));
                    }

                    // create grouping
                    ProfitGrouping = new List<TranProfit>();
                    CreateProfitGrouping();

                    // calculate the profit
                    foreach (var x in ProfitGrouping)
                    {
                        x.Profit = x.TotalEarned - x.TotalPaid;
                    }

                }
            }
        }
 public ProfitViewModel(int id)
 {
     using (FFAdminDBEntities db = new FFAdminDBEntities())
     {
         this.TranId = id;
         this.BLNo = db.Tran.FirstOrDefault(s => s.TranID == id).BLNo;
         this.Profits = db.TranProfit.Where(x => x.TranID == id).Include(t => t.Currency).ToList();
         this.Totals = db.TranTotals.Where(x => x.TranID == id).Include(t => t.Currency).ToList();
     }
 }
Example #6
0
 public ProfitViewModel(int id)
 {
     using (FFAdminDBEntities db = new FFAdminDBEntities())
     {
         this.TranId  = id;
         this.BLNo    = db.Tran.FirstOrDefault(s => s.TranID == id).BLNo;
         this.Profits = db.TranProfit.Where(x => x.TranID == id).Include(t => t.Currency).ToList();
         this.Totals  = db.TranTotals.Where(x => x.TranID == id).Include(t => t.Currency).ToList();
     }
 }
 public TranContainersViewModel(int tranId)
 {
     BuildShippingTypeList();
     using (FFAdminDBEntities db = new FFAdminDBEntities())
     {
         //db.TranContainer.Include(a => a.ShippingType);
         TranContainers = db.TranContainer.Include(a => a.ShippingType).Where(t => t.TranID == tranId).ToList();
         TranID = tranId;
         StatusID = db.Tran.FirstOrDefault().TranDetail.StatusID.Value;
     }
 }
 public TranContainersViewModel(int tranId)
 {
     BuildShippingTypeList();
     using (FFAdminDBEntities db = new FFAdminDBEntities())
     {
         //db.TranContainer.Include(a => a.ShippingType);
         TranContainers = db.TranContainer.Include(a => a.ShippingType).Where(t => t.TranID == tranId).ToList();
         TranID         = tranId;
         StatusID       = db.Tran.FirstOrDefault().TranDetail.StatusID.Value;
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">Customer ID</param>
        public ProfitForCustomerViewModel(int id)
        {
            using (FFAdminDBEntities db = new FFAdminDBEntities())
            {
                this.Customer = db.Customer.Find(id);

                if (Customer != null)
                {
                    TranList = new ProfitForTranListViewModel(
                        db.Tran.Where(s => s.ConsigneeID == Customer.CustomerID)
                        .Select(s => s.TranID).ToList()
                        );
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id">Customer ID</param>
        public ProfitForCustomerViewModel(int id)
        {
            using (FFAdminDBEntities db = new FFAdminDBEntities())
            {
                this.Customer = db.Customer.Find(id);

                if (Customer != null)
                {

                    TranList = new ProfitForTranListViewModel(
                        db.Tran.Where(s => s.ConsigneeID == Customer.CustomerID)
                        .Select(s=> s.TranID).ToList()
                        );
                }
            }
        }
 public TranContainersViewModel()
 {
     BuildShippingTypeList();
     TranContainers = new List<TranContainer>();
     using (FFAdminDBEntities db = new FFAdminDBEntities())
     {
         foreach(var shiptype in db.ShippingType.ToList())
         {
             TranContainers.Add(new TranContainer() {
                 
                 ShippingType = shiptype,
                 Count = 0
             });
         }
     }
     TranID = -1;
     StatusID = -1;
 }
 public TranContainersViewModel()
 {
     BuildShippingTypeList();
     TranContainers = new List <TranContainer>();
     using (FFAdminDBEntities db = new FFAdminDBEntities())
     {
         foreach (var shiptype in db.ShippingType.ToList())
         {
             TranContainers.Add(new TranContainer()
             {
                 ShippingType = shiptype,
                 Count        = 0
             });
         }
     }
     TranID   = -1;
     StatusID = -1;
 }