예제 #1
0
        private void BuildBudgetLabel()
        {
            if (ddlFiscalYearID != null && ddlFiscalYearID.Items.Count > 0)
            {
                if (ddlAccountID != null && ddlAccountID.Items.Count > 0)
                {
                    String fe1 = SqlExpressionBuilder.PrepareFilterExpression(ACBudgetEntity.FLD_NAME_FiscalYearID, ddlFiscalYearID.SelectedValue.ToString(), SQLMatchType.Equal);
                    String fe2 = SqlExpressionBuilder.PrepareFilterExpression(ACBudgetEntity.FLD_NAME_AccountID, ddlAccountID.SelectedValue.ToString(), SQLMatchType.Equal);

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                    IList <ACBudgetEntity> lst = FCCACBudget.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                    if (lst != null && lst.Count > 0)
                    {
                        var sum = (from g in lst
                                   select g.Amount).Sum();

                        lblTopTotalBudgetValue.Text = sum.ToString();
                    }
                    else
                    {
                        lblTopTotalBudgetValue.Text = "0";
                    }
                }
            }
        }
예제 #2
0
        public IList <ACBudgetEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <ACBudgetEntity> aCBudgetEntityList = new List <ACBudgetEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = ACBudgetEntity.FLD_NAME_BudgetID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                aCBudgetEntityList = FCCACBudget.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (aCBudgetEntityList != null && aCBudgetEntityList.Count > 0)
                {
                    totalRowCount = aCBudgetEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(aCBudgetEntityList ?? new List <ACBudgetEntity>());
        }
예제 #3
0
        private void SaveACBudgetEntity()
        {
            if (IsValid)
            {
                try
                {
                    ACBudgetEntity aCBudgetEntity = BuildACBudgetEntity();

                    Int64 result = -1;

                    if (aCBudgetEntity.IsNew)
                    {
                        result = FCCACBudget.GetFacadeCreate().Add(aCBudgetEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(ACBudgetEntity.FLD_NAME_BudgetID, aCBudgetEntity.BudgetID.ToString(), SQLMatchType.Equal);
                        result = FCCACBudget.GetFacadeCreate().Update(aCBudgetEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _BudgetID       = 0;
                        _ACBudgetEntity = new ACBudgetEntity();
                        PrepareInitialView();
                        BindACBudgetList();

                        if (aCBudgetEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Budget Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Budget Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (aCBudgetEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Budget Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Budget Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
예제 #4
0
        private void BuildBudgetWizard()
        {
            if (ddlFiscalYearID != null && ddlFiscalYearID.Items.Count > 0)
            {
                if (ddlAccountID != null && ddlAccountID.Items.Count > 0 && ddlAccountID.SelectedValue != "$$OPTGROUP$$OPTGROUP$$")
                {
                    String fe1 = SqlExpressionBuilder.PrepareFilterExpression(ACBudgetEntity.FLD_NAME_FiscalYearID, ddlFiscalYearID.SelectedValue.ToString(), SQLMatchType.Equal);
                    String fe2 = SqlExpressionBuilder.PrepareFilterExpression(ACBudgetEntity.FLD_NAME_AccountID, ddlAccountID.SelectedValue.ToString(), SQLMatchType.Equal);

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                    IList <ACBudgetEntity> lst = FCCACBudget.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                    if (lst != null && lst.Count > 0)
                    {
                        BindList();
                    }
                    else
                    {
                        ACFiscalYearEntity aCFisalYearEntitiy = FCCACFiscalYear.GetFacadeCreate().GetByID(Int64.Parse(ddlFiscalYearID.SelectedValue));

                        if (aCFisalYearEntitiy != null && aCFisalYearEntitiy.FiscalYearID > 0)
                        {
                            DateTime beginDate = aCFisalYearEntitiy.BeginDate;

                            while (beginDate <= aCFisalYearEntitiy.EndDate)
                            {
                                try
                                {
                                    ACBudgetEntity aCBudgetEntity = new ACBudgetEntity();
                                    aCBudgetEntity.FiscalYearID = Int64.Parse(ddlFiscalYearID.SelectedValue);
                                    aCBudgetEntity.AccountID    = Int64.Parse(ddlAccountID.SelectedValue);
                                    aCBudgetEntity.Period       = beginDate;
                                    aCBudgetEntity.Amount       = 0;

                                    FCCACBudget.GetFacadeCreate().Add(aCBudgetEntity, DatabaseOperationType.Add, TransactionRequired.No);

                                    beginDate = beginDate.AddMonths(1);
                                }

                                catch (Exception)
                                {
                                    throw;
                                }
                            }

                            BindList();
                        }
                    }
                    BuildBudgetLabel();
                }
            }
        }
예제 #5
0
        protected void lvACBudget_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 BudgetID;

            Int64.TryParse(e.CommandArgument.ToString(), out BudgetID);

            if (BudgetID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _BudgetID = BudgetID;
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(ACBudgetEntity.FLD_NAME_BudgetID, BudgetID.ToString(), SQLMatchType.Equal);

                        ACBudgetEntity aCBudgetEntity = new ACBudgetEntity();


                        result = FCCACBudget.GetFacadeCreate().Delete(aCBudgetEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _BudgetID       = 0;
                            _ACBudgetEntity = new ACBudgetEntity();
                            PrepareInitialView();
                            BindACBudgetList();

                            MiscUtil.ShowMessage(lblMessage, "A CBudget has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete A CBudget.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
예제 #6
0
        public IList <ACBudgetEntity> GetData()
        {
            IList <ACBudgetEntity> aCBudgetEntityList = new List <ACBudgetEntity>();

            try
            {
                aCBudgetEntityList = FCCACBudget.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (aCBudgetEntityList != null && aCBudgetEntityList.Count > 0)
                {
                    totalRowCount = aCBudgetEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(aCBudgetEntityList ?? new List <ACBudgetEntity>());
        }
예제 #7
0
        private void UpdateACBudgetEntity()
        {
            try
            {
                IList <ListViewDataItem> list = lvACBudget.Items;

                if (list != null && list.Count > 0)
                {
                    Int32 tempDataItemIndex = 0;

                    foreach (ListViewDataItem lvdi in list)
                    {
                        DataKey currentDataKey = lvACBudget.DataKeys[tempDataItemIndex++];
                        Int64   _budgetID      = (Int64)currentDataKey["BudgetID"];
                        _BudgetID = _budgetID;

                        TextBox txtAmountLV = (TextBox)lvdi.FindControl("txtAmountLV");

                        ACBudgetEntity acBudgetEntity = CurrentACBudgetEntity;

                        Decimal budgetamount;
                        Decimal.TryParse(txtAmountLV.Text, out budgetamount);

                        acBudgetEntity.Amount = budgetamount;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(ACBudgetEntity.FLD_NAME_BudgetID, _budgetID.ToString(), SQLMatchType.Equal);
                        FCCACBudget.GetFacadeCreate().Update(acBudgetEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    MiscUtil.ShowMessage(lblMessage, "Budget Information has been added successfully.", false);
                    BuildBudgetLabel();
                }
            }
            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, "Failed to Save Budget Information.", false);
            }
        }