Exemplo n.º 1
0
        public List <DBResponse> InsertLedger(LedgerInsertRequest request)
        {
            using (var _context = new AccountsEntities())
            {
                List <GeneralLedger> objLedger = request.ledgerList;

                var xmlLedger = new XElement("ArrayOfLedger", objLedger.Select(x => new XElement("ChildList",
                                                                                                 new XElement("Id", x.Id),
                                                                                                 new XElement("TransactionDate", x.TransactionDate),
                                                                                                 new XElement("VoucherNo", x.VoucherNo),
                                                                                                 new XElement("VoucherType", x.VoucherType),
                                                                                                 new XElement("VoucherName", x.VoucherName),
                                                                                                 new XElement("AccountCode", x.AccountCode),
                                                                                                 new XElement("Debit", x.Debit),
                                                                                                 new XElement("Credit", x.Credit),
                                                                                                 new XElement("Description", x.Description),
                                                                                                 new XElement("Narration", x.Narration),
                                                                                                 new XElement("Reference", x.Reference),
                                                                                                 new XElement("Creator", x.Creator)
                                                                                                 )));

                request.ledgerXML = xmlLedger.ToString();

                string dataList = "[Acc_InsertLedgerInfo] '" + request.ledgerXML + "'";
                var    list     = _context.Database.SqlQuery <DBResponse>(dataList).ToList <DBResponse>();
                return(list);
            }
        }
Exemplo n.º 2
0
 public string DeleteCompany(string companyId)
 {
     if (!String.IsNullOrEmpty(companyId))
     {
         try
         {
             int _companyId = Int32.Parse(companyId);
             using (AccountsEntities contextObj = new AccountsEntities())
             {
                 var _company = contextObj.Companies.Find(_companyId);
                 contextObj.Companies.Remove(_company);
                 contextObj.SaveChanges();
                 return("Selected companies record deleted sucessfully");
             }
         }
         catch (Exception)
         {
             return("Company details not found");
         }
     }
     else
     {
         return("Invalid operation");
     }
 }
Exemplo n.º 3
0
        public List <DBResponse> InsertVoucher(VoucherInsertRequest request)
        {
            using (var _context = new AccountsEntities())
            {
                List <VoucherList> objVoucher = request.voucherList;

                var xmlLedger = new XElement("ArrayOfVoucher", objVoucher.Select(x => new XElement("ChildList",
                                                                                                   new XElement("Id", x.Id),
                                                                                                   new XElement("VoucherNo", x.VoucherNo),
                                                                                                   new XElement("VoucherType", x.VoucherType),
                                                                                                   new XElement("VoucherName", x.VoucherName),
                                                                                                   new XElement("CashOfAccountType", x.CashOfAccountType),
                                                                                                   new XElement("Payable", x.Payable),
                                                                                                   new XElement("Note", x.Note),
                                                                                                   new XElement("AccountCode", x.AccountCode),
                                                                                                   new XElement("Description", x.Description),
                                                                                                   new XElement("Quantity", x.Quantity),
                                                                                                   new XElement("UnitPrice", x.UnitPrice),
                                                                                                   new XElement("Amount", x.Amount)
                                                                                                   )));

                request.voucherXml = xmlLedger.ToString();

                string dataList = "[Acc_InsertVoucherInfo] '" + request.voucherXml + "'";
                var    list     = _context.Database.SqlQuery <DBResponse>(dataList).ToList <DBResponse>();
                return(list);
            }
        }
Exemplo n.º 4
0
 public List <AccountType> TypeList()
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "Acc_GetTypeList";
         var    list     = _context.Database.SqlQuery <AccountType>(dataList).ToList <AccountType>();
         return(list);
     }
 }
Exemplo n.º 5
0
 //GET: Company by Id
 public Company GetCompanyById(string id)
 {
     using (AccountsEntities contextObj = new AccountsEntities())
     {
         var Id             = Convert.ToInt32(id);
         var getCompanyById = contextObj.Companies.Find(Id);
         return(getCompanyById);
     }
 }
Exemplo n.º 6
0
 public List <LedgerListForView> LedgerListForView(LedgerListViewRequest request)
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "[Acc_LedgerInfoForView] '" + request.fromDate + "','" + request.toDate + "','" + request.voucherType + "'";
         var    list     = _context.Database.SqlQuery <LedgerListForView>(dataList).ToList <LedgerListForView>();
         return(list);
     }
 }
Exemplo n.º 7
0
 public List <TrialBalance_View> ReportBalanceSheet(LedgerListViewRequest request)
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "[Rpt_BalanceSheet] '" + request.fromDate + "','" + request.toDate + "'";
         var    list     = _context.Database.SqlQuery <TrialBalance_View>(dataList).ToList <TrialBalance_View>();
         return(list);
     }
 }
Exemplo n.º 8
0
 public List <LoanInformationGet_View> LoanInformationView()
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "[Loan_GetLoanInformation]";
         var    list     = _context.Database.SqlQuery <LoanInformationGet_View>(dataList).ToList <LoanInformationGet_View>();
         return(list);
     }
 }
Exemplo n.º 9
0
 public List <LedgerListForView> VoucherListByType(VoucherReportViewRequest request)
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "[Acc_LedgerInfoForEdit] '" + request.voucherNo + "','" + request.voucherType + "'";
         var    list     = _context.Database.SqlQuery <LedgerListForView>(dataList).ToList <LedgerListForView>();
         return(list);
     }
 }
Exemplo n.º 10
0
 public List <ChartOfAccount> ChartOfAccountList()
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "[Acc_GetChartOfAccountList]";
         var    list     = _context.Database.SqlQuery <ChartOfAccount>(dataList).ToList <ChartOfAccount>();
         return(list);
     }
 }
Exemplo n.º 11
0
 public List <CompanyInfo> CompanyList()
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "Acc_GetCompanyList";
         var    list     = _context.Database.SqlQuery <CompanyInfo>(dataList).ToList <CompanyInfo>();
         return(list);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// Gets all entities of a given type asynchronously
 /// </summary>
 public static void List <TModel>(Action <IList <TModel> > callback, Action <bool> isBusy, Action <Exception> exceptionCallback = null) where TModel : class
 {
     ExecuteAsync(() =>
     {
         using (var context = new AccountsEntities())
         {
             return(context.Set <TModel>().ToList());
         }
     }, callback, isBusy, exceptionCallback);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Find an entity by type and id asynchronously
 /// </summary>
 public static void Find <TModel>(object[] keyValues, Action <TModel> callback, Action <bool> isBusy, Action <Exception> exceptionCallback = null) where TModel : class
 {
     ExecuteAsync(() =>
     {
         using (var context = new AccountsEntities())
         {
             return(context.Set <TModel>().Find(keyValues));
         }
     }, callback, isBusy, exceptionCallback);
 }
Exemplo n.º 14
0
 public List <DBResponse> InsertChartOfAccount(ChartOfAccount chart)
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "[Acc_InsertChartOfAccount]'" + chart.Id + "','" + chart.GroupId +
                           "','" + chart.TypeId + "','" + chart.Name + "'";
         var list = _context.Database.SqlQuery <DBResponse>(dataList).ToList <DBResponse>();
         return(list);
     }
 }
Exemplo n.º 15
0
 public List <DBResponse> InsertLoanPaymentHistory(LoanPayment loan)
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "[Loan_InsertLoanPayment_History] '" + loan.Id + "','" + loan.LoanBaseId + "','" + loan.CashIn +
                           "','" + loan.CashOut + "','" + loan.TransactionDate + "'";
         var list = _context.Database.SqlQuery <DBResponse>(dataList).ToList <DBResponse>();
         return(list);
     }
 }
Exemplo n.º 16
0
 public List <DBResponse> InsertLoanBase_t(LoanBase_t loan)
 {
     using (var _context = new AccountsEntities())
     {
         string dataList = "[Loan_InsertIntoLoanBase_t] '" + loan.Id + "','" + loan.LoanInformation +
                           "','" + loan.ReferenceNo + "','" + loan.Amount + "','" + loan.Interest + "','" + loan.NetPayable + "'";
         var list = _context.Database.SqlQuery <DBResponse>(dataList).ToList <DBResponse>();
         return(list);
     }
 }
Exemplo n.º 17
0
 /// <summary>
 /// Get a list of filtered entities asynchronously
 /// </summary>
 public static void Where <TModel, TProperty>(Func <TModel, bool> predicate, Expression <Func <TModel, TProperty> > includePath, Action <IEnumerable <TModel> > callback, Action <bool> isBusy, Action <Exception> exceptionCallback = null) where TModel : class
 {
     ExecuteAsync(() =>
     {
         using (var context = new AccountsEntities())
         {
             return(context.Set <TModel>().Include(includePath).Where <TModel>(predicate));
         }
     }, callback, isBusy, exceptionCallback);
 }
Exemplo n.º 18
0
 public List <VoucherNo> GetMaxVoucherNo(int VoucherType)
 {
     using (var _context = new AccountsEntities())
     {
         //int VoucherCode = 0;
         var query = "[Acc_GetMaxVoucherNo] '" + VoucherType + "'";
         var list  = _context.Database.SqlQuery <VoucherNo>(query).ToList <VoucherNo>();
         return(list);
         //VoucherCode = Convert.ToInt32(list.FirstOrDefault().voucherNo);
         //return VoucherCode;
     }
 }
Exemplo n.º 19
0
 private List <User> GetUsersList(GridSettings objGrdSettings)
 {
     try
     {
         string[] conditions = getCondition(objGrdSettings);
         //sql query result
         string           sSql       = string.Format("select  * from (select ROW_NUMBER() OVER({0}) as rowid ,c.* from Users c {1}) as temp {2} ", conditions[0], conditions[1], conditions[2]);
         AccountsEntities objContext = new AccountsEntities();
         var list = objContext.Users.SqlQuery(sSql).ToList();
         return(list);
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
 }
Exemplo n.º 20
0
 public Repository(AccountsEntities context)
 {
     _ctx = context;
     _set = _ctx.Set <T>();
 }
Exemplo n.º 21
0
 public DDRepository(AccountsEntities context)
     : base(context)
 {
 }