protected void gridviewGeneralJournal_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e)
 {
     if (e.Column.FieldName.Equals("AccountId!Key"))
     {
         Guid accountId = (Guid)e.Value;
         NAS.DAL.Accounting.AccountChart.Account account =
             session.GetObjectByKey <NAS.DAL.Accounting.AccountChart.Account>(accountId);
         e.DisplayText = String.Format("{0} - {1}", account.Code, account.Name);
     }
     else if (e.Column.Name.Equals("DynamicObjectList"))
     {
         ASPxGridView grid = sender as ASPxGridView;
         //Get TransactionId
         var generalJournalId = grid.GetRowValues(e.VisibleRowIndex, "GeneralJournalId");
         if (generalJournalId == null)
         {
             return;
         }
         //Get transction
         NAS.DAL.Accounting.Journal.GeneralJournal generalJournal =
             session.GetObjectByKey <NAS.DAL.Accounting.Journal.GeneralJournal>(generalJournalId);
         GeneralJournalObject generalJournalObject = generalJournal.GeneralJournalObjects.FirstOrDefault();
         if (generalJournalObject != null)
         {
             ObjectBO objectBO = new ObjectBO();
             DynamicObjectListSerialize dynamicObjectList =
                 objectBO.GetDynamicObjectList(generalJournalObject.ObjectId.ObjectId);
             if (dynamicObjectList != null)
             {
                 e.DisplayText = dynamicObjectList.ToString();
             }
         }
     }
 }
Esempio n. 2
0
 protected void gridviewAllocation_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e)
 {
     if (e.Column.Name.Equals("DynamicObjectList"))
     {
         ASPxGridView grid = sender as ASPxGridView;
         //Get TransactionId
         var transactionId = grid.GetRowValues(e.VisibleRowIndex, "TransactionId");
         if (transactionId == null)
         {
             return;
         }
         //Get transction
         NAS.DAL.Accounting.Journal.Transaction transaction =
             session.GetObjectByKey <NAS.DAL.Accounting.Journal.Transaction>(transactionId);
         TransactionObject transactionObject = transaction.TransactionObjects.FirstOrDefault();
         if (transactionObject != null)
         {
             ObjectBO objectBO = new ObjectBO();
             DynamicObjectListSerialize dynamicObjectList =
                 objectBO.GetDynamicObjectList(transactionObject.ObjectId.ObjectId);
             if (dynamicObjectList != null)
             {
                 e.DisplayText = dynamicObjectList.ToString();
             }
         }
     }
 }
Esempio n. 3
0
        protected void gridBookingEntries_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e)
        {
            if (e.Column.Name.Equals("DynamicObjectList"))
            {
                ASPxGridView grid = sender as ASPxGridView;
                //Get TransactionId
                var transactionId = grid.GetRowValues(e.VisibleRowIndex, "TransactionId");
                if (transactionId == null)
                {
                    return;
                }
                //Get transction
                NAS.DAL.Accounting.Journal.Transaction transaction =
                    session.GetObjectByKey <NAS.DAL.Accounting.Journal.Transaction>(transactionId);
                TransactionObject transactionObject = transaction.TransactionObjects.FirstOrDefault();
                if (transactionObject != null)
                {
                    ObjectBO objectBO = new ObjectBO();
                    DynamicObjectListSerialize dynamicObjectList =
                        objectBO.GetDynamicObjectList(transactionObject.ObjectId.ObjectId);
                    if (dynamicObjectList != null)
                    {
                        e.DisplayText = dynamicObjectList.ToString();
                    }
                }
            }

            else if (e.Column.FieldName.Equals("Amount"))
            {
                double amount = double.Parse(e.Value.ToString());
                if (amount == 0)
                {
                    e.DisplayText = "0";
                }
                else
                {
                    e.DisplayText = string.Format("{0:#,###} VNĐ", amount);
                }
            }
        }