コード例 #1
0
        public ActionResult First()
        {
            @ViewBag.Message = "Blance";

            IMAccDetailLogRepository<MAccDetailLog> repo = new MAccDetailLogRepository();


            IList<String> listCustomer = repo.getListAllCutomer();
            //
            IRepository<VFS_MAccDetailLogBlance> VFS_MAccDetailLogBlance = new VFS_MAccDetailLogBlanceRepository();

            //

            repo.truncateTable(); // xoa tat cac cac hop dong
           
            try
            {
                foreach (var itemCustomer in listCustomer)
                {
                    decimal blance = 0;
                    IList<MAccDetailLog> listMAccDetailLog = repo.getListFromCustomer(itemCustomer);
                    foreach (var item in listMAccDetailLog)
                    {
                        if (item.Status == "B")
                        {
                            blance = blance + item.AmountCalInterest;
                        }
                        else
                        {
                            blance = blance - item.AmountCalInterest;
                        }
                        VFS_MAccDetailLogBlance itemInsert = new VFS_MAccDetailLogBlance();
                        itemInsert.LogId = item.LogId;
                        itemInsert.Balance = blance;

                        VFS_MAccDetailLogBlance.Save(itemInsert);
                    }
                }
                @ViewBag.Status = "Sucessfull";
            }
            catch (Exception)
            {

                throw;
            }
            return View();
        }
コード例 #2
0
ファイル: Ultility.cs プロジェクト: Soucre/Working_git_vfs
        public static void syncBalanceNoKyQuy()
        {
            #region Lay danh sach khach hang
            IMAccDetailLogRepository<MAccDetailLog> repo = new MAccDetailLogRepository();
            IList<String> listCustomer = repo.getListAllCutomer();

            #endregion

            IRepository<VFS_MAccDetailLogBlance> VFS_MAccDetailLogBlance = new VFS_MAccDetailLogBlanceRepository();

            //

            repo.truncateTable(); // xoa tat cac cac hop dong

            try
            {
                foreach (var itemCustomer in listCustomer)
                {
                    decimal blance = 0;
                    IList<MAccDetailLog> listMAccDetailLog = repo.getListFromCustomer(itemCustomer);
                    foreach (var item in listMAccDetailLog)
                    {
                        if (item.Status == "B")
                        {
                            blance = blance + item.AmountCalInterest;
                        }
                        else
                        {
                            blance = blance - item.AmountCalInterest;
                        }

                        VFS_MAccDetailLogBlance itemInsert = new VFS_MAccDetailLogBlance();
                        itemInsert.LogId = item.LogId;
                        itemInsert.Balance = blance;

                        VFS_MAccDetailLogBlance.Save(itemInsert);
                    }
                }                
            }
            catch (Exception)
            {

                throw;
            }
        }