Esempio n. 1
0
        public void calculateStart()
        {
            this.calculationStartTime_ = DateTime.Now;

            //List<AsynchronousClient> clients = new List<AsynchronousClient>();
            //List<string> messageXmls = new List<string>();

            List <Task> taskList = new List <Task>();

            // 여기서는 task 를 띄움( multi-thread 로 가도됨 )
            if (useLocalServerTF_)
            {
                for (int i = 0; i < this.BatchItemViewModelQueueList_.Count; i++)
                {
                    AsynchronousClient client = new AsynchronousClient();

                    MessageViewModel mvm = new MessageViewModel();

                    mvm.MessageHeaderViewModel_.CreationTimestamp_ = DateTime.Now.ToString();
                    mvm.MessageHeaderViewModel_.Item_code_         = this.BatchItemViewModelQueueList_[i].ItemCode_;
                    mvm.MessageHeaderViewModel_.MessageId_         = "testID";
                    mvm.MessageHeaderViewModel_.MessageType_       = "gridCalculation";
                    mvm.MessageHeaderViewModel_.SendTo_            = "localServer";
                    mvm.MessageHeaderViewModel_.SentBy_            = "localServer";
                    mvm.MessageHeaderViewModel_.SequenceNumber_    = "testSerialNum";

                    GridCalculationViewModel gcvm = new GridCalculationViewModel();

                    gcvm.mergeSetXml(this.BatchItemViewModelQueueList_[i].Excel_instrumentViewModel_, this.calculationDate_);

                    mvm.MessageBodyViewModel_ = gcvm;

                    //client.StartClient(mvm, localServerInfo_);

                    //messageXmls.Add(mvm.getMessegeStr());
                    //clients.Add(client);

                    Task taskA = new Task(() => client.StartClient(mvm.getMessegeStr(), localServerInfo_));

                    taskList.Add(taskA);

                    taskA.Start();
                }



                Task.WaitAll(taskList.ToArray());
            }
        }
Esempio n. 2
0
        public void calculate(List <Excel_instrumentViewModel> instList, DateTime refDate)
        {
            MessageManager messageManager = new MessageManager();

            messageManager.loadServerInformation();

            foreach (var item in instList)
            {
                item.loadBatchDetailContext();

                item.buildParameterFromInstrument(refDate);

                //item.calculateSavedXml(refDate);

                MessageViewModel mvm = new MessageViewModel();

                mvm.MessageHeaderViewModel_.MessageType_ = "ENQUEUE";

                GridCalculationViewModel gcvm = MessageBodyViewModel.CreateMessageBody("gridCalculation") as GridCalculationViewModel;

                gcvm.Inst_code_    = item.MasterInformationViewModel_.Item_code_;
                gcvm.Inst_name_    = item.MasterInformationViewModel_.Item_name_;
                gcvm.Inst_type_    = item.MasterInformationViewModel_.Booking_type_;
                gcvm.Para_refDate_ = item.Excel_parameterViewModel_.ReferenceDate_;

                gcvm.InnerXml_ = item.calculationXml();

                mvm.TargetCode_           = "gridCalculation";
                mvm.MessageBodyViewModel_ = gcvm;

                messageManager.send(mvm);
            }

            // 다 보냄 우선

            // 글고

            //MessageViewModel calStartMsgVM = new MessageViewModel();

            //calStartMsgVM.MessageHeaderViewModel_.MessageType_ = "GRIDCALCULATIONSTART";

            //GridCalculationStartViewModel gcsvm = new GridCalculationStartViewModel();

            //calStartMsgVM.MessageBodyViewModel_ = gcsvm;

            //calStartMsgVM.TargetCode_ = "gridCalculation";

            //messageManager.send(calStartMsgVM);
        }
        public void calculateStart()
        {
            this.calculationStartTime_ = DateTime.Now;
            
            //List<AsynchronousClient> clients = new List<AsynchronousClient>();
            //List<string> messageXmls = new List<string>();

            List<Task> taskList = new List<Task>();

            // 여기서는 task 를 띄움( multi-thread 로 가도됨 )
            if (useLocalServerTF_)
            {

                for (int i = 0; i < this.BatchItemViewModelQueueList_.Count; i++)
                {
                    AsynchronousClient client = new AsynchronousClient();

                    MessageViewModel mvm = new MessageViewModel();

                    mvm.MessageHeaderViewModel_.CreationTimestamp_ = DateTime.Now.ToString();
                    mvm.MessageHeaderViewModel_.Item_code_ = this.BatchItemViewModelQueueList_[i].ItemCode_;
                    mvm.MessageHeaderViewModel_.MessageId_ = "testID";
                    mvm.MessageHeaderViewModel_.MessageType_ = "gridCalculation";
                    mvm.MessageHeaderViewModel_.SendTo_ = "localServer";
                    mvm.MessageHeaderViewModel_.SentBy_ = "localServer";
                    mvm.MessageHeaderViewModel_.SequenceNumber_ = "testSerialNum";

                    GridCalculationViewModel gcvm = new GridCalculationViewModel();

                    gcvm.mergeSetXml(this.BatchItemViewModelQueueList_[i].Excel_instrumentViewModel_,this.calculationDate_);

                    mvm.MessageBodyViewModel_ = gcvm;

                    //client.StartClient(mvm, localServerInfo_);

                    //messageXmls.Add(mvm.getMessegeStr());
                    //clients.Add(client);

                    Task taskA = new Task(() => client.StartClient(mvm.getMessegeStr(), localServerInfo_));

                    taskList.Add(taskA);

                    taskA.Start();

                }



                Task.WaitAll(taskList.ToArray());

            }
        }