public CompanySite() { Site = ApplicationDataContext.Instance.SystemEntityContext.SYS_Site.Include("SYS_Entity").FirstOrDefault(n => n.SYS_Entity.Id == ApplicationDataContext.Instance.LoggedInUser.DefaultSite.Id); Entity = Site.SYS_Entity; billingAddress = Site.SYS_Address_BillingAddress; //dataContext.EntitySystemContext.SYS_Address.FirstOrDefault(n => n.Id == Site.BillingAddress); shippingAddress = Site.SYS_Address_ShippingAddress; //dataContext.EntitySystemContext.SYS_Address.FirstOrDefault(n => n.Id == Site.ShippingAddress); printerBarcode = Site.SYS_Printer_Barcode; //dataContext.EntitySystemContext.SYS_Printer.FirstOrDefault(n => n.Id == Site.PrinterBarcode); printerPicker = Site.SYS_Printer_Picker; //dataContext.EntitySystemContext.SYS_Printer.FirstOrDefault(n => n.Id == Site.PrinterPicker); printerReceipt = Site.SYS_Printer_Receipt; //dataContext.EntitySystemContext.SYS_Printer.FirstOrDefault(n => n.Id == Site.PrinterReceipt); }
public SiteAccounts() { Site = ApplicationDataContext.Instance.SystemEntityContext.SYS_Site.Include("SYS_Entity").FirstOrDefault(n => n.SYS_Entity.Id == ApplicationDataContext.Instance.LoggedInUser.DefaultSiteId); SiteEntity = Site.SYS_Entity; List <int> siteTypes = Enum.GetValues(typeof(GLX.GLX_SystemAccountType)).Cast <int>().ToList(); //SEAN: //removed && n.SystemDefaultAccount == true here List <DB.GLX_SiteAccount> siteAccounts = ApplicationDataContext.Instance.AccountingEntityContext.GLX_SiteAccount.Where(n => siteTypes.Contains(n.TypeId) && n.SiteId == Site.EntityId).ToList(); bank = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.Bank); cardControl = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.CardControl); cashControl = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.CashControl); chequeControl = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.ChequeControl); costDifference = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.CostDifference); costOfSales = costOfSales = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.CostofSales); creditControl = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.CreditControl); creditors = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.Creditors); if (creditors != null) { creditorsEntity = ApplicationDataContext.Instance.SystemEntityContext.SYS_Entity.FirstOrDefault(n => n.Id == creditors.EntityId); } debtors = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.Debtors); if (debtors != null) { debtorsEntity = ApplicationDataContext.Instance.SystemEntityContext.SYS_Entity.FirstOrDefault(n => n.Id == debtors.EntityId); } distributedReserves = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.Distributedreserves); eftControl = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.Eftcontrol); interestCharged = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.InterestCharged); inventory = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.Inventory); profit = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.Profit); rounding = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.Rounding); sales = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.Sales); settlemetnDiscountAllowed = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.SettlementDiscountAllowed); settlemetnDiscountRecieved = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.SettlementDiscountReceived); stockAdjustment = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.StockAdjustment); vatControl = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.VatControl); vatInput = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.VatInput); vatOutput = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.VatOutput); inventoryBuyout = siteAccounts.FirstOrDefault(n => n.TypeId == (byte)GLX.GLX_SystemAccountType.InventoryBuyout); }
internal static String Save(DB.SYS_Site entry, DataContext dataContext) { try { if (dataContext.EntitySystemContext.GetEntityState(entry) == EntityState.Detached) { dataContext.EntitySystemContext.SYS_Site.Add(entry); //TODO : Generate Stock items and history for this site } Validation.ValidateEntity(dataContext.EntitySystemContext, entry); } catch (Validation.EntityValidationException ex) { return(dataContext.PackageValidationException()); } return("Success"); }
public static DB.SYS_Site GetPreviousItem(DB.SYS_Site SYS_Site, DataContext dataContext) { return(dataContext.EntitySystemContext.SYS_Site.OrderByDescending(o => o.SYS_Entity.Name).FirstOrDefault(n => n.SYS_Entity.Name.CompareTo(SYS_Site.SYS_Entity.Name) < 0 && n.SYS_Entity.Name.CompareTo(SYS_Site.SYS_Entity.Name) != 0)); }
public static DB.SYS_Site GetNextItem(DB.SYS_Site SYS_Site, DataContext dataContext) { return(dataContext.EntitySystemContext.SYS_Site.OrderBy(o => o.SYS_Entity.Name).FirstOrDefault(n => n.SYS_Entity.Name.CompareTo(SYS_Site.SYS_Entity.Name) > 0 && n.SYS_Entity.Name.CompareTo(SYS_Site.SYS_Entity.Name) != 0)); }