Esempio n. 1
0
 public CompanySite()
 {
     Site            = ApplicationDataContext.Instance.SystemEntityContext.SYS_Site.Include("SYS_Entity").FirstOrDefault(n => n.SYS_Entity.Id == ApplicationDataContext.Instance.LoggedInUser.DefaultSiteId);
     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);
 }
Esempio n. 2
0
 public void OpenRecord(DB.SYS_Site siteCopy)
 {
     try
     {
         BindingSource.DataSource = siteCopy;
     }
     catch (Exception ex)
     {
         if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
         {
             throw ex;
         }
     }
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        internal static String Save(DB.SYS_Site entry, DataContext dataContext)
        {
            try
            {
                if (dataContext.EntitySystemContext.GetEntityState(entry) == System.Data.Entity.EntityState.Detached)
                {
                    dataContext.EntitySystemContext.SYS_Site.Add(entry);
                    //TODO : Generate Stock items and history for this site
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                return(dataContext.PackageValidationException());
            }

            return("Success");
        }
Esempio n. 5
0
        /// <summary>
        /// Loads and opens the next Role record. The current record is not saved.
        /// </summary>
        /// <remarks>Created: Theo Crous 23/07/2012</remarks>
        protected override void OnNextRecord()
        {
            try
            {
                base.OnNextRecord();

                DB.SYS_Site sysSite = BL.SYS.SYS_Site.GetNextItem((DB.SYS_Site)BindingSource.DataSource, DataContext);
                if (sysSite != null)
                {
                    BindingSource.DataSource = sysSite;
                }
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }
Esempio n. 6
0
 public override void OpenRecord(Int64 Id)
 {
     try
     {
         //DB.SYS_Site sysSite = Context.SYS_Site.FirstOrDefault(n => n.Id == (int)Id);
         DB.SYS_Site sysSite = BL.SYS.SYS_Site.LoadByEntityId(Id, DataContext, new List <String>()
         {
             "SYS_Entity", "SYS_Address_BillingAddress", "SYS_Address_ShippingAddress", "SYS_Printer_Barcode", "SYS_Printer_Picker", "SYS_Printer_Receipt"
         });
         BindingSource.DataSource = sysSite;
         BindingSourcePaymentAccounts.DataSource = BL.GLX.PaymentAccountSerializer.DeSerializePaymentAccounts(((DB.SYS_Site)BindingSource.DataSource).PaymentAccounts, typeof(List <BL.GLX.PaymentAccount>));
         ddlSafetyStockPeriod.EditValue          = Enum.GetName(typeof(BL.SYS.SYS_SafetyStockPeriod), ((DB.SYS_Site)BindingSource.DataSource).SafetyStockPeriod);
     }
     catch (Exception ex)
     {
         if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
         {
             throw ex;
         }
     }
 }
Esempio n. 7
0
        /*protected override void OnShown(EventArgs e)
         * {
         *
         *  base.OnShown(e);
         *
         *  OnOpenRecord(DataContext.EntitySystemContext.SYS_Site.FirstOrDefault().EntityId);
         *  this.Close();
         * }*/

        private void btnCopySite_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                DB.SYS_Site   copySite   = BL.ApplicationDataContext.DeepClone <DB.SYS_Site>(BL.SYS.SYS_Site.LoadByEntityId(SelectedRowId, DataContext), BL.SYS.SYS_Site.New);
                DB.SYS_Entity copyEntity = BL.ApplicationDataContext.DeepClone <DB.SYS_Entity>((BL.SYS.SYS_Site.LoadByEntityId(SelectedRowId, DataContext, new List <String>()
                {
                    "SYS_Entity"
                })).SYS_Entity, BL.SYS.SYS_Entity.NewSite);
                copySite.SYS_Entity = copyEntity;
                SiteForm childForm = new SiteForm();
                childForm.OpenRecord(copySite);
                ShowForm(childForm);
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }
Esempio n. 8
0
 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));
 }
Esempio n. 9
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));
 }