コード例 #1
0
ファイル: Ultility.cs プロジェクト: Soucre/Working_git_vfs
        public static void syncQuyen()
        {
            IRepository<SecuritiesHist> repoSecuritieshist = new SecuritiesHistRepository();
            IRepository<RightExec> repoExec = new RightExecRepository();
            ISecuritiesHistRepository iSecuritiesHistRepository = new SecuritiesHistRepository();
            iSecuritiesHistRepository.truncateTable();
            //IList<SecuritiesHist> listSecuritiesHist = repoSecuritieshist.GetAll();

            IList<RightExec> listRightExec = repoExec.GetAll();
            IRepository<VFS_RightExecDetailCustomer> repoDetailCustomerRightExec = new VFS_RightExecDetailCustomerRepository();
            foreach (var item in listRightExec)
            {
                IList<SecuritiesHist> sHist = iSecuritiesHistRepository.getSecuritiesHistByStockCodeAndTransactionDate(item.StockCode, item.DateOwnerConfirm);
                if (sHist.Count > 0)
                {
                    foreach (var itemHist in sHist)
                    {
                        VFS_RightExecDetailCustomer itemInsert = new VFS_RightExecDetailCustomer();

                        itemInsert.IdRightExec = item.Id;
                        itemInsert.StockCode = item.StockCode;
                        itemInsert.StockType = item.StockType;
                        itemInsert.BoardType = item.BoardType;
                        itemInsert.DateNoRight = item.DateNoRight;
                        itemInsert.DateOwnerConfirm = item.DateOwnerConfirm;
                        itemInsert.DatePay = item.DatePay;
                        itemInsert.BeginRegisterDate = item.BeginRegisterDate;
                        itemInsert.EndRegisterDate = item.EndRegisterDate;
                        itemInsert.EndTransferDate = item.EndTransferDate;
                        itemInsert.Description = item.Description;
                        itemInsert.RateA = item.RateA;
                        itemInsert.RateB = item.RateB;
                        //if (item.RightType == "S")
                        //{
                        //    itemInsert.RightType = "K";
                        //}
                        //else
                        //{//K = stock
                        itemInsert.RightType = item.RightType;
                        //}
                        itemInsert.Difference = item.Difference;
                        itemInsert.Posted = item.Posted;
                        itemInsert.RightExecPrice = item.RightExecPrice;
                        itemInsert.RoundType = item.RoundType;
                        itemInsert.RoundPrice = item.RoundPrice;

                        itemInsert.BranchCode = itemHist.BranchCode;
                        itemInsert.BankGl = itemHist.BankGl;
                        itemInsert.SectionGl = itemHist.SectionGl;
                        itemInsert.AccountId = itemHist.AccountId;
                        itemInsert.AccountName = itemHist.AccountName;
                        itemInsert.StockCodeCurrent = itemHist.StockCode;
                        itemInsert.QuantityCurrent = itemHist.Quantity;
                        itemInsert.PendingDebitQuantity = itemHist.PendingDebitQuantity;
                        itemInsert.TransactionDate = itemHist.TransactionDate;

                        repoDetailCustomerRightExec.Save(itemInsert);
                    }

                }
            }

        }
コード例 #2
0
        public ActionResult Sync()
        {
            ViewBag.Message = "Your contact page.";
            IRepository<SecuritiesHist> repoSecuritieshist = new SecuritiesHistRepository();
            IRepository<RightExec> repoExec = new RightExecRepository();
            ISecuritiesHistRepository iSecuritiesHistRepository = new SecuritiesHistRepository();
            
            //IList<SecuritiesHist> listSecuritiesHist = repoSecuritieshist.GetAll();

            IList<RightExec> listRightExec = repoExec.GetAll();
            IRepository<VFS_RightExecDetailCustomer> repoDetailCustomerRightExec = new VFS_RightExecDetailCustomerRepository();
            foreach (var item in listRightExec)
            {
                IList<SecuritiesHist> sHist = iSecuritiesHistRepository.getSecuritiesHistByStockCodeAndTransactionDate(item.StockCode, item.DateOwnerConfirm);
                if (sHist.Count > 0)
                {
                    foreach (var itemHist in sHist)
                    {
                        VFS_RightExecDetailCustomer itemInsert = new VFS_RightExecDetailCustomer();
                        itemInsert.IdRightExec = item.Id;
                        itemInsert.StockCode = item.StockCode;
                        itemInsert.StockType = item.StockType;
                        itemInsert.BoardType = item.BoardType;
                        itemInsert.DateNoRight = item.DateNoRight;
                        itemInsert.DateOwnerConfirm = item.DateOwnerConfirm;
                        itemInsert.DatePay = item.DatePay;
                        itemInsert.BeginRegisterDate = item.BeginRegisterDate;
                        itemInsert.EndRegisterDate = item.EndRegisterDate;
                        itemInsert.EndTransferDate = item.EndTransferDate;
                        itemInsert.Description = item.Description;
                        itemInsert.RateA = item.RateA;
                        itemInsert.RateB = item.RateB;
                        itemInsert.RightType = item.RightType;
                        itemInsert.Difference = item.Difference;
                        itemInsert.Posted = item.Posted;
                        itemInsert.RightExecPrice = item.RightExecPrice;
                        itemInsert.RoundType = item.RoundType;
                        itemInsert.RoundPrice = item.RoundPrice;

                        itemInsert.BranchCode = itemHist.BranchCode;
                        itemInsert.BankGl = itemHist.BankGl;
                        itemInsert.SectionGl = itemHist.SectionGl;
                        itemInsert.AccountId = itemHist.AccountId;
                        itemInsert.AccountName = itemHist.AccountName;
                        itemInsert.StockCodeCurrent = itemHist.StockCode;
                        itemInsert.QuantityCurrent = itemHist.Quantity;
                        itemInsert.PendingDebitQuantity = itemHist.PendingDebitQuantity;
                        itemInsert.TransactionDate = itemHist.TransactionDate;

                        repoDetailCustomerRightExec.Save(itemInsert);
                    }
                    
                }
            }         

            return View();
        }
コード例 #3
0
        public ActionResult Update(string id)
        {
            
            //
            IRepository<RightExec> repoRightExec = new RightExecRepository();
            RightExec rightExec = repoRightExec.GetById(Convert.ToInt32(id)); //lay 1 quyen vào Id
            //
            IVFS_RightExecDetailCustomerRepository<VFS_RightExecDetailCustomer> repoVFS_RightExecDetailCustomer = new VFS_RightExecDetailCustomerRepository();
            IList<VFS_RightExecDetailCustomer> listVFS_RightExecDetailCustomer = repoVFS_RightExecDetailCustomer.getListRightExecDetailCustomerFromIdRightExec(Convert.ToInt32(id));
            //
            ISecuritiesHistRepository iSecuritiesHistRepository = new SecuritiesHistRepository(); // lay so du chung khoan
             IRepository<VFS_RightExecDetailCustomer> repoDetailCustomerRightExec = new VFS_RightExecDetailCustomerRepository();
            //

            if (listVFS_RightExecDetailCustomer.Count == 0 )
            {
                IList<SecuritiesHist> sHist = iSecuritiesHistRepository.getSecuritiesHistByStockCodeAndTransactionDate(rightExec.StockCode, rightExec.DateOwnerConfirm);
                foreach (var item in sHist)
                {
                    VFS_RightExecDetailCustomer itemInsert = new VFS_RightExecDetailCustomer();

                    itemInsert.IdRightExec = rightExec.Id;
                    itemInsert.StockCode = rightExec.StockCode;
                    itemInsert.StockType = rightExec.StockType;
                    itemInsert.BoardType = rightExec.BoardType;
                    itemInsert.DateNoRight = rightExec.DateNoRight;
                    itemInsert.DateOwnerConfirm = rightExec.DateOwnerConfirm;
                    itemInsert.DatePay = rightExec.DatePay;
                    itemInsert.BeginRegisterDate = rightExec.BeginRegisterDate;
                    itemInsert.EndRegisterDate = rightExec.EndRegisterDate;
                    itemInsert.EndTransferDate = rightExec.EndTransferDate;
                    itemInsert.Description = rightExec.Description;
                    itemInsert.RateA = rightExec.RateA;
                    itemInsert.RateB = rightExec.RateB;
                    itemInsert.RightType = rightExec.RightType;
                    itemInsert.Difference = rightExec.Difference;
                    itemInsert.Posted = rightExec.Posted;
                    itemInsert.RightExecPrice = rightExec.RightExecPrice;
                    itemInsert.RoundType = rightExec.RoundType;
                    itemInsert.RoundPrice = rightExec.RoundPrice;

                    itemInsert.BranchCode = item.BranchCode;
                    itemInsert.BankGl = item.BankGl;
                    itemInsert.SectionGl = item.SectionGl;
                    itemInsert.AccountId = item.AccountId;
                    itemInsert.AccountName = item.AccountName;
                    itemInsert.StockCodeCurrent = item.StockCode;
                    itemInsert.QuantityCurrent = item.Quantity;
                    itemInsert.PendingDebitQuantity = item.PendingDebitQuantity;
                    itemInsert.TransactionDate = item.TransactionDate;

                    repoDetailCustomerRightExec.Save(itemInsert);
                }

            }
            else
            {
                foreach (var item in listVFS_RightExecDetailCustomer)
                {               

                    item.DatePay = rightExec.DatePay;                    

                    repoDetailCustomerRightExec.Update(item);
                }
            }


            ViewBag.Message = "Cập nhật quyền";
          
            return RedirectToAction("Index");
        }
コード例 #4
0
ファイル: Ultility.cs プロジェクト: Soucre/Working_git_vfs
        public static void syncBalanceStockCluod() // so du Chung khoan
        {
            // kill all process of MS Excel
            KillProcess("EXCEL");

            ISecuritiesHistRepository iSecuritiesHistRepository = new SecuritiesHistRepository();

            //IList<SecuritiesHist> listSecuritiesHist = repoSecuritieshist.GetAll();

            DateTime datecurrent = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);


            IList<SecuritiesHist> sHist = iSecuritiesHistRepository.getSecuritiesHistByStockCodeAndTransactionDate();

            Excel.Application xlApp;
            Excel.Workbook xlWorkBook;
            Excel.Worksheet xlWorkSheet;
            object misValue = System.Reflection.Missing.Value;

            xlApp = new Excel.Application();
            string movefile = ApplicationHelper.movefile;
            xlWorkBook = xlApp.Workbooks.Add(Type.Missing);
            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
            //xlWorkSheet.get_Range("I6", Type.Missing).Value2 = StockCodeTxt.Text.ToUpper();
            // title
            xlWorkSheet.Rows[1].Cells[1] = "AccountId";
            xlWorkSheet.Rows[1].Cells[3] = "SectionGl";
            xlWorkSheet.Rows[1].Cells[4] = "BankGl";
            xlWorkSheet.Rows[1].Cells[5] = "AccountName";
            xlWorkSheet.Rows[1].Cells[6] = "StockCode";
            xlWorkSheet.Rows[1].Cells[7] = "Quantity";
            xlWorkSheet.Rows[1].Cells[8] = "TransactionDate";
            //end title

            int numberrow = 2;
            foreach (var item in sHist)
            {
                xlWorkSheet.Rows[numberrow].Cells[1] = item.AccountId;
                xlWorkSheet.Rows[numberrow].Cells[3] = item.SectionGl;
                xlWorkSheet.Rows[numberrow].Cells[4] = item.BankGl;                
                xlWorkSheet.Rows[numberrow].Cells[5] = item.AccountName;
                xlWorkSheet.Rows[numberrow].Cells[6] = item.StockCode;
                xlWorkSheet.Rows[numberrow].Cells[7] = item.Quantity;                
                xlWorkSheet.Rows[numberrow].Cells[8] = item.TransactionDate;

                numberrow += 1;
            }

          

            //MessageBox.Show(xlWorkSheet.get_Range("I6").Value2.ToString());
            string save = ApplicationHelper.movefile + DateTime.Now.ToString("yyyyMMdd");
            string fullDirectory = save + "_SoDuChungKhoan" + ".xls";
            checkExistFile(fullDirectory); // check exist directory

            xlWorkBook.SaveAs(fullDirectory, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
            xlWorkBook.Close(false, Type.Missing, Type.Missing);
            xlApp.Quit();


            releaseObject(xlWorkSheet);
            releaseObject(xlWorkBook);
            releaseObject(xlApp);


        }