コード例 #1
0
ファイル: AccountForm.cs プロジェクト: tslekwadi/CDS
 private void ceSiteAccount_CheckedChanged(object sender, EventArgs e)
 {
     if (ceSiteAccount.Checked)
     {
         if (glxSiteAccount == null)
         {
             glxSiteAccount        = BL.GLX.GLX_SiteAccount.New;
             glxSiteAccount.SiteId = (long)ddlSiteSelection.EditValue;
             BindingSourceSiteAccount.DataSource = glxSiteAccount;
         }
         ValidateSiteAccount();
     }
     else
     {
         if (DataContext.EntityAccountingContext.GetEntityState(glxSiteAccount) != System.Data.Entity.EntityState.Detached)
         {
             DataContext.EntityAccountingContext.GLX_SiteAccount.Remove(glxSiteAccount);
         }
         glxSiteAccount              = null;
         ddlSiteAccountType.Enabled  = false;
         txtShortDescription.Enabled = false;
         ceSystemAccount.Enabled     = false;
         ddlSiteSelection.Enabled    = false;
     }
 }
コード例 #2
0
        public static String Delete(DB.GLX_SiteAccount entry, DataContext dataContext)
        {
            try
            {
                if (dataContext.EntityAccountingContext.GetEntityState(entry) != System.Data.Entity.EntityState.Detached)
                {
                    dataContext.EntityAccountingContext.GLX_SiteAccount.Remove(entry);
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                return(dataContext.PackageValidationException());
            }

            return("Success");
        }
コード例 #3
0
ファイル: SiteAccounts.cs プロジェクト: tslekwadi/CDS
        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);
        }
コード例 #4
0
ファイル: AccountForm.cs プロジェクト: tslekwadi/CDS
        /// <summary>
        /// Open an Account record from the database.
        /// </summary>
        /// <param name="Id">The id (primary key) of the Account to open.</param>
        /// <remarks>Created: Theo Crous 14/11/2011</remarks>
        public override void OpenRecord(Int64 Id)
        {
            try
            {
                using (new CDS.Client.Desktop.Essential.UTL.WaitCursor())
                {
                    base.OpenRecord(Id);
                    glxAccount = BL.GLX.GLX_Account.LoadByEntityId(Id, DataContext);
                    sysEntity  = BL.SYS.SYS_Entity.Load(glxAccount.EntityId, DataContext);
                    //If you do this in one line the ddlSiteAccount_EditValueChanged fires and creates a new site account
                    //this should not be done
                    glxSiteAccount = BL.GLX.GLX_SiteAccount.LoadByAccount(glxAccount.EntityId, DataContext);
                    if (glxSiteAccount != null)
                    {
                        //chkSystemAccount.Enabled = true;
                        //if (glxSiteAccount.SystemDefaultAccount)
                        //{
                        //    ddlSiteAccountType.Enabled = false;
                        //}
                        fieldBudgetAmount.Visible = !glxAccount.AgingAccount;
                    }

                    chkControlAccount.Checked = sysEntity.CodeSub == "00000";
                    chkControlAccount.Enabled = false;
                    //ddlType.Enabled = sysEntity.CodeSub == "00000";

                    //GET LOOKUP INFO
                    tcgDetails_SelectedPageChanged(tcgDetails, null);
                }
            }
            catch (Exception ex)
            {
                if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
                {
                    throw ex;
                }
            }
        }