public override bool Approve(int userId, int id, ref object dtoItem, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            try
            {
                using (LedgerAccountMngEntities context = CreateContext())
                {
                    LedgerAccount dbItem = context.LedgerAccount.FirstOrDefault(o => o.LedgerAccountID == id);
                    if (dbItem == null)
                    {
                        throw new Exception("Account not found !");
                    }
                    LedgerAccountMng_LedgerAccountSearchResult_View currentData = context.LedgerAccountMng_LedgerAccountSearchResult_View.FirstOrDefault(o => o.LedgerAccountID == id);
                    //LedgerAccount newData = new LedgerAccount();
                    dbItem.OpeningCredit = currentData.ClosingCredit;
                    dbItem.OpeningDebit  = currentData.ClosingDebit;
                    //context.LedgerAccount.Add(newData);

                    dbItem.UpdatedDate = DateTime.Now;
                    dbItem.UpdatedBy   = userId;
                    context.SaveChanges();
                    dtoItem = GetData(dbItem.LedgerAccountID, out notification).Data;
                    return(true);
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                return(false);
            }
        }
        public bool CloseEntry(int userId, object dtoItem, out Library.DTO.Notification notification)
        {
            //DTO.LedgerAccount dtoLedgerAccount = ((Newtonsoft.Json.Linq.JObject)dtoItem).ToObject<DTO.LedgerAccount>();
            List <DTO.LedgerAccount> dtoLedgerAccount = ((Newtonsoft.Json.Linq.JArray)dtoItem).ToObject <List <DTO.LedgerAccount> >();

            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };

            try
            {
                foreach (DTO.LedgerAccount dtoAccount in dtoLedgerAccount)
                {
                    using (LedgerAccountMngEntities context = CreateContext())
                    {
                        LedgerAccount dbItem = context.LedgerAccount.FirstOrDefault(o => o.LedgerAccountID == dtoAccount.LedgerAccountID);
                        if (dbItem == null)
                        {
                            throw new Exception("Account not found !");
                        }
                        if (dbItem.AccountNo != "911")
                        {
                            LedgerAccountMng_LedgerAccountSearchResult_View currentData = context.LedgerAccountMng_LedgerAccountSearchResult_View.FirstOrDefault(o => o.LedgerAccountID == dtoAccount.LedgerAccountID);
                            dbItem.OpeningCredit = currentData.ClosingCredit;
                            dbItem.OpeningDebit  = currentData.ClosingDebit;

                            dbItem.UpdatedDate = DateTime.Now;
                            context.SaveChanges();
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                return(false);
            }
        }