public BasicResponse AddEmergencyLinkHistoryAndAss(AddEmergencyLinkHistoryAndAssRequest request)
        {
            var primaryId = IdHelper.CreateLongId().ToString();

            request.EmergencyLinkHistoryInfo.Id = primaryId;
            foreach (var item in request.LinkageHistoryMasterPointAssInfoList)
            {
                item.Id = IdHelper.CreateLongId().ToString();
                item.EmergencyLinkHistoryId = primaryId;
            }
            var model =
                ObjectConverter.Copy <EmergencyLinkHistoryInfo, EmergencyLinkHistoryModel>(
                    request.EmergencyLinkHistoryInfo);
            var models =
                ObjectConverter
                .CopyList <EmergencyLinkageHistoryMasterPointAssInfo, EmergencyLinkageHistoryMasterPointAssModel>(
                    request.LinkageHistoryMasterPointAssInfoList);

            TransactionsManager.BeginTransaction(() =>
            {
                _Repository.AddEmergencyLinkHistory(model);
                foreach (var item in models)
                {
                    _emergencyLinkageHistoryMasterPointAssRepository.AddEmergencyLinkageHistoryMasterPointAss(item);
                }
            });
            return(new BasicResponse());
        }
Example #2
0
        //To create the Invoice
        public static long InsertProformaInvoices(string obj)
        {
            long inv = 0;
            JavaScriptSerializer jss = new JavaScriptSerializer();

            TransactionsModel.CreateInvoice ob = new TransactionsModel.CreateInvoice();
            ob = jss.Deserialize <TransactionsModel.CreateInvoice>(obj);
            if (HttpContext.Current.Session["UserID"].ToString() == null)
            {
                HttpContext.Current.Response.Redirect(ConfigurationManager.AppSettings["SiteUrl"] + "/MemberLogin.aspx", false);
            }
            ob.CreatedBy = new Guid(HttpContext.Current.Session["UserId"].ToString());
            ob.Status    = (byte)EntrebatorEnumandConstants.Enumbers.InvoiceStatus.Sent;
            // ob.CreatedOn = DateTime.Now;
            ob.ItemID      = Guid.NewGuid();
            ob.Currency    = "INR";
            ob.InvoiceType = 1;
            inv            = TransactionsManager.InsertProformaInvoices(ob);
            if (inv != 0)
            {
                ob.InvoiceID = inv;
                int xx = TransactionsManager.InsertProformaInvoiceItems(ob);
                //1 means performainvoice table values
                SendMail(inv, 1);
            }
            return(inv);
        }
Example #3
0
        public BasicResponse <JC_AlarmNotificationPersonnelConfigInfo> UpdateJC_AlarmNotificationPersonnelConfig(AlarmNotificationPersonnelConfigUpdateRequest jC_Alarmnotificationpersonnelconfigrequest)
        {
            var _jC_Alarmnotificationpersonnelconfig = ObjectConverter.Copy <JC_AlarmNotificationPersonnelConfigInfo, JC_AlarmnotificationpersonnelconfigModel>(jC_Alarmnotificationpersonnelconfigrequest.JC_AlarmNotificationPersonnelConfigInfo);

            var _jC_AlarmNotificationPersonnel = ObjectConverter.CopyList <JC_AlarmNotificationPersonnelInfo, JC_AlarmNotificationPersonnelModel>
                                                     (jC_Alarmnotificationpersonnelconfigrequest.JC_AlarmNotificationPersonnelInfoList);

            TransactionsManager.BeginTransaction(() =>
            {
                _Repository.UpdateJC_AlarmNotificationPersonnelConfig(_jC_Alarmnotificationpersonnelconfig);

                _AlarmNotificationPersonnelRepository.DeleteJC_AlarmNotificationPersonnelByAlarmConfigId(_jC_Alarmnotificationpersonnelconfig.Id);

                _AlarmNotificationPersonnelRepository.AddJC_AlarmNotificationPersonnelList(_jC_AlarmNotificationPersonnel.ToList());
            });

            if (Basic.Framework.Data.PlatRuntime.Items.ContainsKey(DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey))
            {
                Basic.Framework.Data.PlatRuntime.Items[DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey] = DateTime.Now;
            }
            else
            {
                Basic.Framework.Data.PlatRuntime.Items.Add(DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey, DateTime.Now);
            }

            var jC_Alarmnotificationpersonnelconfigresponse = new BasicResponse <JC_AlarmNotificationPersonnelConfigInfo>();

            jC_Alarmnotificationpersonnelconfigresponse.Data = jC_Alarmnotificationpersonnelconfigrequest.JC_AlarmNotificationPersonnelConfigInfo;
            return(jC_Alarmnotificationpersonnelconfigresponse);
        }
Example #4
0
        public void AddTrans(TransactionsViewModel transviewmodel)
        {
            try
            {
                tbl_Transactions tbltrans = new tbl_Transactions();

                tbltrans.HighLevelTxnID   = transviewmodel.HighLevelTxnID;
                tbltrans.HighLevelTxnDesc = transviewmodel.HighLevelTxnDesc;
                tbltrans.LifeCycleID      = transviewmodel.LifeCycleID;
                if (transviewmodel.ReqReference != null)
                {
                    tbltrans.ReqReference = transviewmodel.ReqReference;
                }
                tbltrans.daId = transviewmodel.daId;

                tbltrans.EntityState = DA.DomainModel.EntityState.Added;

                TransactionsManager transmanager = new TransactionsManager();
                transmanager.AddTransaction(tbltrans);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #5
0
 public ConsumerBuilder(ILoggerFactory loggerFactory, TransactionsManager transactionsManager, Session session)
 {
     _loggerFactory       = loggerFactory;
     _transactionsManager = transactionsManager;
     _session             = session;
     _tcs = new TaskCompletionSource <bool>(TaskCreationOptions.RunContinuationsAsynchronously);
 }
 private IList <Transaction> GetAllTransactions(DataSource dataSource)
 {
     using (ITransactionManager trManager = new TransactionsManager(new UnitOfWork(), null))
     {
         return(trManager.Get(dataSource));
     }
 }
Example #7
0
        //public DAViewModel FindDA(int? daID)
        //{
        //    DAViewModel dAViewModel = new DAViewModel();
        //    DAManager daManager = new DAManager();
        //    var da = daManager.FindDA(daID);
        //    dAViewModel.DAID = da.daid;
        //    dAViewModel.DAName = da.daName;
        //    dAViewModel.ModuleId = (int)da.ModuleId;
        //    return dAViewModel;
        //}

        public TransactionsViewModel FindTrans(int?Transq)
        {
            try
            {
                TransactionsViewModel transvm      = new TransactionsViewModel();
                TransactionsManager   transmanager = new TransactionsManager();

                var trans1 = transmanager.FindTransaction(Transq);
                var daId1  = trans1.daId;

                LifeCycleManager LCManager = new LifeCycleManager();
                transvm.lstLifeCycle     = LCManager.GetLifeCycles(daId1);
                transvm.TransactionSeq   = trans1.TransactionSeq;
                transvm.HighLevelTxnID   = trans1.HighLevelTxnID;
                transvm.HighLevelTxnDesc = trans1.HighLevelTxnDesc;
                transvm.ReqReference     = trans1.ReqReference;
                transvm.LifeCycleID      = trans1.LifeCycleID;
                transvm.LifeCycleDesc    = transvm.lstLifeCycle.Where(e => e.LifeCycleID.Equals(trans1.LifeCycleID)).First().LifeCycleDesc;
                transvm.daId             = trans1.daId;

                //transvm.lstTransactions = (IList<tbl_Transactions>)trans1;

                return(transvm);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #8
0
        /// <summary>
        /// 批量新增
        /// </summary>
        /// <param name="jC_AlarmNotificationPersonnelrequest"></param>
        /// <returns></returns>
        public BasicResponse <List <JC_AlarmNotificationPersonnelInfo> > AddJC_AlarmNotificationPersonnelList(AlarmNotificationPersonnelAddRequest jC_AlarmNotificationPersonnelrequest)
        {
            DataTable dataTable = _Repository.QueryTable("global_AlarmNotificationPersonnelService_GetAlarmNotificationPersonnelListByAnalysisModelId", jC_AlarmNotificationPersonnelrequest.AnalysisModelId);

            List <JC_AlarmNotificationPersonnelModel> listResult = ObjectConverter.Copy <JC_AlarmNotificationPersonnelModel>(dataTable);
            var _jC_AlarmNotificationPersonnel = ObjectConverter.CopyList <JC_AlarmNotificationPersonnelInfo, JC_AlarmNotificationPersonnelModel>
                                                     (jC_AlarmNotificationPersonnelrequest.JC_AlarmNotificationPersonnelInfoList);

            try
            {
                TransactionsManager.BeginTransaction(() =>
                {
                    _Repository.DeleteJC_AlarmNotificationPersonnelList(listResult);

                    _Repository.AddJC_AlarmNotificationPersonnelList(_jC_AlarmNotificationPersonnel.ToList());
                });
            }
            catch
            {
            }

            var jC_AlarmNotificationPersonnelresponse = new BasicResponse <List <JC_AlarmNotificationPersonnelInfo> >();

            jC_AlarmNotificationPersonnelresponse.Data = jC_AlarmNotificationPersonnelrequest.JC_AlarmNotificationPersonnelInfoList;
            return(jC_AlarmNotificationPersonnelresponse);
        }
Example #9
0
        //public IList<tbl_AttributeValues> lstAttributeValues { get; set; }

        //public IList<tbl_Attribute> lstCriticalAttributes { get; set; }

        //public IList<tbl_Transactions> lstHighLevelTransactions { get; set; }

        #endregion

        public IList <ScenarioBuilderViewModel> GetTransactions(int?daId)
        {
            try
            {
                ScenarioBuilderViewModel sbVM           = new ScenarioBuilderViewModel();
                TransactionsManager      transManager   = new TransactionsManager();
                MappingManager           mappingmanager = new MappingManager();

                lstHighLevelTransactions = transManager.GetAllTransactions(daId);

                List <ScenarioBuilderViewModel> lstScenarioBuilderVM = new List <ScenarioBuilderViewModel>();

                sbVM.lstHighLevelTransactions = lstHighLevelTransactions;

                var transactionAttributeMapping = mappingmanager.GetMappingDetails(daId);

                for (int j = 0; j < transactionAttributeMapping.Count(); j++)
                {
                    ScenarioBuilderViewModel scenarioBuilderViewModel = new ScenarioBuilderViewModel();
                    scenarioBuilderViewModel.TransactionDesc = transactionAttributeMapping[j].tbl_Transactions.HighLevelTxnDesc;
                }

                lstScenarioBuilderVM.Add(sbVM);
                return(lstScenarioBuilderVM);
            }
            catch (Exception)
            {
                throw;
            }
        }
 protected ProducerBase(ILoggerFactory loggerFactory, SenderLink senderLink, TransactionsManager transactionsManager, IBaseProducerConfiguration configuration)
 {
     _logger              = loggerFactory.CreateLogger(GetType());
     _senderLink          = senderLink;
     _transactionsManager = transactionsManager;
     _configuration       = configuration;
 }
Example #11
0
 public ProducerBuilder(ILoggerFactory loggerFactory, TransactionsManager transactionsManager, Session session, Func <IMessageIdPolicy> messageIdPolicyFactory)
 {
     _loggerFactory          = loggerFactory;
     _transactionsManager    = transactionsManager;
     _session                = session;
     _messageIdPolicyFactory = messageIdPolicyFactory;
     _tcs = new TaskCompletionSource <bool>(TaskCreationOptions.RunContinuationsAsynchronously);
 }
Example #12
0
        /// <summary>
        /// 批量添加\更新\删除接口
        /// </summary>
        /// <param name="NetworkModuleRequest"></param>
        /// <returns></returns>
        public BasicResponse BatchOperationManualCrossControls(ManualCrossControlsRequest manualCrossControlRequest)
        {
            BasicResponse        Result = new BasicResponse();
            List <Jc_JcsdkzInfo> ManualCrossControlInfos = manualCrossControlRequest.ManualCrossControlInfos;

            //向网关同步数据
            List <Jc_JcsdkzInfo> SendItemList = ManualCrossControlInfos;
            var resultSync = SynchronousDataToGateway(SendItemList);

            if (!resultSync)
            {
                Result.Code    = 1;
                Result.Message = "向网关同步数据失败!";
                return(Result);
            }
            TransactionsManager.BeginTransaction(() =>
            {
                foreach (Jc_JcsdkzInfo item in ManualCrossControlInfos)
                {
                    if (item.InfoState == InfoState.AddNew)
                    {
                        //数据库操作
                        var _jc_Jcsdkz      = ObjectConverter.Copy <Jc_JcsdkzInfo, Jc_JcsdkzModel>(item);
                        var resultjc_Jcsdkz = _Repository.AddManualCrossControl(_jc_Jcsdkz);
                        //缓存操作
                        ManualCrossControlCacheAddRequest AddManualCrossControlCacheRequest = new ManualCrossControlCacheAddRequest();
                        AddManualCrossControlCacheRequest.ManualCrossControlInfo            = item;
                        _ManualCrossControlCacheService.AddManualCrossControlCache(AddManualCrossControlCacheRequest);
                    }
                    else if (item.InfoState == InfoState.Modified)
                    {
                        //数据库操作
                        var _jc_Jcsdkz = ObjectConverter.Copy <Jc_JcsdkzInfo, Jc_JcsdkzModel>(item);
                        _Repository.UpdateManualCrossControl(_jc_Jcsdkz);
                        //缓存操作
                        ManualCrossControlCacheUpdateRequest UpdateManualCrossControlCacheRequest = new ManualCrossControlCacheUpdateRequest();
                        UpdateManualCrossControlCacheRequest.ManualCrossControlInfo = item;
                        _ManualCrossControlCacheService.UpdateManualCrossControlCache(UpdateManualCrossControlCacheRequest);
                    }
                    else if (item.InfoState == InfoState.Delete)
                    {
                        //数据库操作
                        _Repository.DeleteManualCrossControl(item.ID);
                        //缓存操作
                        ManualCrossControlCacheDeleteRequest DeleteManualCrossControlCacheRequest = new ManualCrossControlCacheDeleteRequest();
                        DeleteManualCrossControlCacheRequest.ManualCrossControlInfo = item;
                        _ManualCrossControlCacheService.DeleteManualCrossControlCache(DeleteManualCrossControlCacheRequest);
                    }
                }
            });

            //调用驱动重新加载控制信息
            DriverManualCrossControlReLoadRequest reLoadRequest = new DriverManualCrossControlReLoadRequest();

            _DriverManualCrossControlService.ReLoad(reLoadRequest);

            return(Result);
        }
Example #13
0
 public Connection(ILoggerFactory loggerFactory, Endpoint endpoint, Amqp.Connection connection, Func <IMessageIdPolicy> messageIdPolicyFactory)
 {
     _loggerFactory          = loggerFactory;
     Endpoint                = endpoint;
     _connection             = connection;
     _messageIdPolicyFactory = messageIdPolicyFactory;
     _connection.AddClosedCallback(OnConnectionClosed);
     _transactionsManager = new TransactionsManager(this);
 }
        private void LoadTransactions(DataSource dataSource)
        {
            ITransactionFileReader fileReader = new GenericCsvReader();

            using (ITransactionManager trManager = new TransactionsManager(new UnitOfWork(), fileReader))
            {
                trManager.Insert(dataSource, GlobalSettings.GetResourceFilePath(resourceFile));
            }
        }
Example #15
0
        /// <summary>
        /// 批量删除手动/交叉控制
        /// </summary>
        /// <param name="ManualCrossControlRequest"></param>
        /// <returns></returns>
        public BasicResponse DeleteManualCrossControls(ManualCrossControlsRequest ManualCrossControlRequest)
        {
            BasicResponse        Result = new BasicResponse();
            List <Jc_JcsdkzInfo> DeleteManualCrossControlInfos = ManualCrossControlRequest.ManualCrossControlInfos;

            ManualCrossControlCacheGetAllRequest manualCrossControlCacheRequest = new ManualCrossControlCacheGetAllRequest();
            var result = _ManualCrossControlCacheService.GetAllManualCrossControlCache(manualCrossControlCacheRequest);
            List <Jc_JcsdkzInfo> DeleteManualCrossControlCaches = result.Data;

            if (DeleteManualCrossControlInfos.Count < 1)
            {
                Result.Code    = 1;
                Result.Message = "当前删除列表中无数据!";
                return(Result);
            }
            foreach (Jc_JcsdkzInfo item in DeleteManualCrossControlInfos)
            {
                Jc_JcsdkzInfo olditem = DeleteManualCrossControlCaches.Find(a => a.ID == item.ID);
                //增加重复判断
                if (olditem == null)
                { //缓存中存在此测点
                    Result.Code    = 1;
                    Result.Message = "当前删除列表中的数据不存在!";
                    return(Result);
                }
            }
            //向网关同步数据
            List <Jc_JcsdkzInfo> SendItemList = DeleteManualCrossControlInfos;
            var resultSync = SynchronousDataToGateway(SendItemList);

            if (!resultSync)
            {
                Result.Code    = 1;
                Result.Message = "向网关同步数据失败!";
                return(Result);
            }
            TransactionsManager.BeginTransaction(() =>
            {
                foreach (Jc_JcsdkzInfo item in DeleteManualCrossControlInfos)
                {
                    //数据库操作
                    _Repository.DeleteManualCrossControl(item.ID);

                    //缓存操作
                    ManualCrossControlCacheDeleteRequest DeleteManualCrossControlCacheRequest = new ManualCrossControlCacheDeleteRequest();
                    DeleteManualCrossControlCacheRequest.ManualCrossControlInfo = item;
                    _ManualCrossControlCacheService.DeleteManualCrossControlCache(DeleteManualCrossControlCacheRequest);
                }
            });

            //调用驱动重新加载控制信息
            DriverManualCrossControlReLoadRequest reLoadRequest = new DriverManualCrossControlReLoadRequest();

            _DriverManualCrossControlService.ReLoad(reLoadRequest);

            return(Result);
        }
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="NetworkModuleRequest"></param>
        /// <returns></returns>
        public BasicResponse AddNetworkModules(NetworkModulesRequest NetworkModuleRequest)
        {
            BasicResponse     Result = new BasicResponse();
            List <Jc_MacInfo> items  = NetworkModuleRequest.NetworkModulesInfo;
            List <Jc_MacInfo> NetworkModuleCaches = new List <Jc_MacInfo>();
            Jc_MacInfo        olditem             = null;

            NetworkModuleCacheGetAllRequest NetworkModuleCacheRequest = new NetworkModuleCacheGetAllRequest();
            var result = _NetworkModuleCacheService.GetAllNetworkModuleCache(NetworkModuleCacheRequest);

            NetworkModuleCaches = result.Data;

            foreach (Jc_MacInfo item in items)
            {
                olditem = NetworkModuleCaches.Find(a => a.MAC == item.MAC);
                //增加重复判断
                if (olditem != null)
                { //缓存中存在此测点
                    Result.Code    = 1;
                    Result.Message = "当前添加列表中的数据在数据库中已经存在!";
                    return(Result);
                }
            }

            //向网关同步数据
            List <Jc_MacInfo> SendItemList = items;
            var resultSync = SynchronousDataToGateway(SendItemList);

            if (!resultSync)
            {
                Result.Code    = 1;
                Result.Message = "向网关同步数据失败!";
                return(Result);
            }

            TransactionsManager.BeginTransaction(() =>
            {
                foreach (Jc_MacInfo item in items)
                {
                    item.IsMemoryData = false;
                    //保存数据库
                    var _jc_Mac = ObjectConverter.Copy <Jc_MacInfo, Jc_MacModel>(item);
                    //保存数据库不存连接号  20170713
                    _jc_Mac.NetID    = 0;
                    var resultjc_Def = _Repository.AddNetworkModule(_jc_Mac);
                }


                //添加到缓存
                NetworkModuleCacheBatchAddRequest BatchAddNetworkModuleCacheRequest = new NetworkModuleCacheBatchAddRequest();
                BatchAddNetworkModuleCacheRequest.NetworkModuleInfos = items;
                _NetworkModuleCacheService.BacthAddNetworkModuleCache(BatchAddNetworkModuleCacheRequest);
            });

            return(Result);
        }
        public static int DeleteInvoiceByInvoiceID(long InvoiceId, byte InvoiceType)
        {
            byte Status = 0;
            JavaScriptSerializer jss = new JavaScriptSerializer();

            Status = (byte)EntrebatorEnumandConstants.Enumbers.InvoiceStatus.Canceled;
            int r = TransactionsManager.DeleteInvoiceByInvoiceID(InvoiceId, InvoiceType, Status);

            return(r);
        }
Example #18
0
        public static string EB_Fetch_ETRMemberShips()
        {
            Guid   UserID            = new Guid(HttpContext.Current.Session["UserID"].ToString());
            string strRet            = "";
            JavaScriptSerializer jss = new JavaScriptSerializer();
            List <TransactionsModel.MemberShips> listData = TransactionsManager.EB_Fetch_ETRMemberShips();

            strRet = jss.Serialize(listData);
            return(strRet);
        }
Example #19
0
        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="jc_Defrequest"></param>
        /// <returns></returns>
        public BasicResponse UpdatePointDefines(PointDefinesUpdateRequest PointDefineRequest)
        {
            BasicResponse     Result       = new BasicResponse();
            List <Jc_DefInfo> items        = PointDefineRequest.PointDefinesInfo;
            List <Jc_DefInfo> Jc_DefCaches = new List <Jc_DefInfo>();     //人员定位测点缓存
            Jc_DefInfo        olditem      = null;

            B_DefCacheGetByConditionRequest bDefCacheRequest = new B_DefCacheGetByConditionRequest();

            bDefCacheRequest.predicate = a => a.Activity == "1";
            var result = _b_DefCacheService.Get(bDefCacheRequest);

            Jc_DefCaches = result.Data;

            foreach (Jc_DefInfo item in items)
            {
                olditem = Jc_DefCaches.Find(a => a.Point == item.Point && a.Activity == "1");

                //增加重复判断
                if (olditem == null)
                { //缓存中存在此测点
                    Result.Code    = 1;
                    Result.Message = "当前更新列表中的数据在数据库中不存在!";
                    return(Result);
                }
            }
            //向网关同步数据
            List <Jc_DefInfo> SendItemList = items;
            var resultSync = SynchronousDataToGateway(SendItemList);

            if (!resultSync)
            {
                Result.Code    = 1;
                Result.Message = "向网关同步数据失败!";
                return(Result);
            }
            TransactionsManager.BeginTransaction(() =>
            {
                foreach (Jc_DefInfo item in items)
                {
                    olditem = Jc_DefCaches.Find(a => a.Point == item.Point && a.Activity == "1");
                    //保存数据库
                    var _jc_Def = ObjectConverter.Copy <Jc_DefInfo, B_DefModel>(item);
                    _repository.UpdateDef(_jc_Def);

                    //置下发初始化标记
                    PointInitializes(item, olditem);

                    //更新缓存
                    UpdatePointDefineCacheByProperty(item);
                }
            });

            return(Result);
        }
Example #20
0
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="ManualCrossControlRequest"></param>
        /// <returns></returns>
        public BasicResponse AddManualCrossControls(ManualCrossControlsRequest ManualCrossControlRequest)
        {
            BasicResponse        Result = new BasicResponse();
            List <Jc_JcsdkzInfo> items  = ManualCrossControlRequest.ManualCrossControlInfos;
            List <Jc_JcsdkzInfo> ManualCrossControlCaches = new List <Jc_JcsdkzInfo>();

            ManualCrossControlCacheGetAllRequest manualCrossControlCacheRequest = new ManualCrossControlCacheGetAllRequest();
            var result = _ManualCrossControlCacheService.GetAllManualCrossControlCache(manualCrossControlCacheRequest);

            ManualCrossControlCaches = result.Data;

            foreach (Jc_JcsdkzInfo item in items)
            {
                Jc_JcsdkzInfo itemCache = ManualCrossControlCaches.Find(a => a.ID == item.ID);
                if (itemCache != null)
                {
                    //缓存中存在此测点
                    Result.Code    = 1;
                    Result.Message = "当前添加的手动/交叉控制信息已存在!";
                    return(Result);
                }
            }
            //向网关同步数据
            List <Jc_JcsdkzInfo> SendItemList = items;
            var resultSync = SynchronousDataToGateway(SendItemList);

            if (!resultSync)
            {
                Result.Code    = 1;
                Result.Message = "向网关同步数据失败!";
                return(Result);
            }

            TransactionsManager.BeginTransaction(() =>
            {
                foreach (Jc_JcsdkzInfo item in items)
                {
                    //数据库操作
                    var _jc_Jcsdkz      = ObjectConverter.Copy <Jc_JcsdkzInfo, Jc_JcsdkzModel>(item);
                    var resultjc_Jcsdkz = _Repository.AddManualCrossControl(_jc_Jcsdkz);

                    //缓存操作
                    ManualCrossControlCacheAddRequest AddManualCrossControlCacheRequest = new ManualCrossControlCacheAddRequest();
                    AddManualCrossControlCacheRequest.ManualCrossControlInfo            = item;
                    _ManualCrossControlCacheService.AddManualCrossControlCache(AddManualCrossControlCacheRequest);
                }
            });

            //调用驱动重新加载控制信息
            DriverManualCrossControlReLoadRequest reLoadRequest = new DriverManualCrossControlReLoadRequest();

            _DriverManualCrossControlService.ReLoad(reLoadRequest);

            return(Result);
        }
Example #21
0
        public static string EB_Fetch_GetFutureEvents()
        {
            Guid   UserID             = new Guid(HttpContext.Current.Session["UserID"].ToString());
            string strRet             = "";
            JavaScriptSerializer jss  = new JavaScriptSerializer();
            DateTime             date = DateTime.Now;
            List <TransactionsModel.GetFutureEvents> Listdata = TransactionsManager.EB_Fetch_GetFutureEvents(date);

            strRet = jss.Serialize(Listdata);
            return(strRet);
        }
Example #22
0
        public ActionResult Create(TranCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                TransactionsManager manager = new TransactionsManager(db);

                var result = manager.AddTranFromUserInput(model);

                return(RedirectToAction("Index"));
            }

            return(Content("false"));
        }
Example #23
0
        public IList <tbl_Transactions> GetReqRef(int id)
        {
            try
            {
                TransactionsManager      TxnManager = new TransactionsManager();
                IList <tbl_Transactions> TxnReqRef  = TxnManager.FindReqRef(id);

                return(TxnReqRef);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public BasicResponse EndAll(EndAllRequest request)
        {
            var notEndRec = _Repository.GetNotEndEmergencyLinkHistory();

            TransactionsManager.BeginTransaction(() =>
            {
                foreach (var item in notEndRec)
                {
                    item.EndTime = request.EndTime;
                    _Repository.UpdateEmergencyLinkHistory(item);
                }
            });
            return(new BasicResponse());
        }
Example #25
0
        public IList <tbl_Transactions> GetTransactions(int?daId)
        {
            try
            {
                TransactionsManager      transManager    = new TransactionsManager();
                IList <tbl_Transactions> lstTransactions = transManager.GetAllTransactions(daId);

                return(lstTransactions);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #26
0
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="DeviceDefineRequest"></param>
        /// <returns></returns>
        public BasicResponse AddDeviceDefines(DeviceDefinesRequest DeviceDefineRequest)
        {
            BasicResponse     Result       = new BasicResponse();
            List <Jc_DevInfo> items        = DeviceDefineRequest.Jc_DevsInfo;
            List <Jc_DevInfo> Jc_DevCaches = new List <Jc_DevInfo>();
            Jc_DevInfo        olditem      = null;

            DeviceDefineCacheGetAllRequest DeviceDefineCacheRequest = new DeviceDefineCacheGetAllRequest();
            var result = _DeviceDefineCacheService.GetAllPointDefineCache(DeviceDefineCacheRequest);

            Jc_DevCaches = result.Data;

            foreach (Jc_DevInfo item in items)
            {
                olditem = Jc_DevCaches.Find(a => a.Devid == item.Devid);
                //增加重复判断
                if (olditem != null)
                { //缓存中存在此测点
                    Result.Code    = 1;
                    Result.Message = "当前添加列表中的数据在数据库中已经存在!";
                    return(Result);
                }
            }
            //向网关同步数据
            List <Jc_DevInfo> SendItemList = items;
            var resultSync = SynchronousDataToGateway(SendItemList);

            if (!resultSync)
            {
                Result.Code    = 1;
                Result.Message = "向网关同步数据失败!";
                return(Result);
            }
            TransactionsManager.BeginTransaction(() =>
            {
                foreach (Jc_DevInfo item in items)
                {
                    //保存数据库
                    var _Jc_Dev      = ObjectConverter.Copy <Jc_DevInfo, Jc_DevModel>(item);
                    var resultJc_Dev = _Repository.AddDeviceDefine(_Jc_Dev);
                }

                //添加到缓存
                DeviceDefineCacheBatchAddRequest BacthAddPointDefineRequest = new DeviceDefineCacheBatchAddRequest();
                BacthAddPointDefineRequest.DeviceDefineInfos = items;
                _DeviceDefineCacheService.BacthAddPointDefineCache(BacthAddPointDefineRequest);
            });

            return(Result);
        }
Example #27
0
        // GET: tblTransactions
        public ActionResult AllTransactions()
        {
            if (Session["user"] == null || Session["userName"] == null)
            {
                return(Redirect("~/Login.aspx"));
            }
            var     us = Session["user"] as tblUser;
            tblUser u  = manager.StpDBEntities.tblUsers.Find(us.uid);

            ViewBag.fname = u.fname;
            ViewBag.lname = u.lname;
            TransactionsManager model = new TransactionsManager();

            return(View(model));
        }
        public BasicResponse BatchAddEmergencyLinkHistory(BatchAddEmergencyLinkHistoryRequest request)
        {
            var lisModel =
                ObjectConverter.CopyList <EmergencyLinkHistoryInfo, EmergencyLinkHistoryModel>(
                    request.LisEmergencyLinkHistoryInfo);

            TransactionsManager.BeginTransaction(() =>
            {
                foreach (var itmem in lisModel)
                {
                    _Repository.AddEmergencyLinkHistory(itmem);
                }
            });
            return(new BasicResponse());
        }
        public void AddTheSameTransactionsAgain()
        {
            // Arrange
            const string           resourceFile = "Inquiry_statements.csv";
            const string           clientId     = "1";
            const int              dataSourceId = 5;
            const string           cultureStr   = "en-US";
            ITransactionFileReader reader       = new GenericCsvReader();

            if (reader.Read(GlobalSettings.GetResourceFilePath(resourceFile), new CultureInfo(cultureStr)).Count == 0)
            {
                Assert.Inconclusive("Zero transactions read from file");
            }
            var moqTrRepo    = new Mock <IRepository <Transaction> >();
            var transactions = reader.Read(GlobalSettings.GetResourceFilePath(resourceFile), new CultureInfo(cultureStr));

            foreach (var tr in transactions)
            {
                tr.DataSourceId = dataSourceId;
            }
            moqTrRepo.SetupGet(inst => inst.Set).Returns(transactions.AsQueryable());

            var moqDsRepo = new Mock <IRepository <DataSource> >();

            moqDsRepo.Setup(inst => inst.GetById(It.Is <int>(id => id == dataSourceId)))
            .Returns(new DataSource {
                ClientName = clientId, Id = dataSourceId, Culture = cultureStr
            });
            var moqUnitOfWork = new Mock <IUnitOfWork>();

            moqUnitOfWork.SetupGet(inst => inst.DataSourceRepository).Returns(moqDsRepo.Object);
            moqUnitOfWork.SetupGet(inst => inst.TransactionRepository).Returns(moqTrRepo.Object);


            var transactionManager = new TransactionsManager(moqUnitOfWork.Object, new GenericCsvReader());

            // Act
            var response = transactionManager.Insert(new DataSource {
                Id = dataSourceId, ClientName = clientId
            },
                                                     GlobalSettings.GetResourceFilePath(resourceFile));

            // Assert
            moqTrRepo.Verify(inst => inst.Set, Times.AtLeastOnce);
            moqTrRepo.Verify(inst => inst.Insert(It.IsAny <Transaction>()), Times.Never);
            moqDsRepo.Verify(inst => inst.GetById(It.Is <int>(id => id == dataSourceId)), Times.AtLeastOnce);
            Assert.IsTrue(response.Status == ActionResponseCode.Success);
        }
Example #30
0
        public BasicResponse DeleteJC_AlarmNotificationPersonnelConfig(AlarmNotificationPersonnelConfigDeleteRequest jC_Alarmnotificationpersonnelconfigrequest)
        {
            TransactionsManager.BeginTransaction(() =>
            {
                if (!string.IsNullOrWhiteSpace(jC_Alarmnotificationpersonnelconfigrequest.Id))
                {
                    //删除报警推送信息的时候将存在的报警处理记录填上EndTime
                    JC_AlarmnotificationpersonnelconfigModel alarmnotificationpersonnelconfigModel = _Repository.GetJC_AlarmNotificationPersonnelConfigById(jC_Alarmnotificationpersonnelconfigrequest.Id);
                    _AlarmHandleService.CloseUnclosedAlarmHandleByAnalysisModelId(new Sys.Safety.Request.AlarmHandle.AlarmHandleGetByAnalysisModelIdRequest()
                    {
                        AnalysisModelId = alarmnotificationpersonnelconfigModel.AnalysisModelId
                    });

                    _Repository.DeleteJC_AlarmNotificationPersonnelConfig(jC_Alarmnotificationpersonnelconfigrequest.Id);
                    _AlarmNotificationPersonnelRepository.DeleteJC_AlarmNotificationPersonnelByAlarmConfigId(jC_Alarmnotificationpersonnelconfigrequest.Id);
                }
                else
                {
                    foreach (var item in jC_Alarmnotificationpersonnelconfigrequest.ids)
                    {
                        //删除报警推送信息的时候将存在的报警处理记录填上EndTime
                        JC_AlarmnotificationpersonnelconfigModel alarmnotificationpersonnelconfigModel = _Repository.GetJC_AlarmNotificationPersonnelConfigById(item);
                        _AlarmHandleService.CloseUnclosedAlarmHandleByAnalysisModelId(new Sys.Safety.Request.AlarmHandle.AlarmHandleGetByAnalysisModelIdRequest()
                        {
                            AnalysisModelId = alarmnotificationpersonnelconfigModel.AnalysisModelId
                        });

                        _Repository.DeleteJC_AlarmNotificationPersonnelConfig(item);
                        _AlarmNotificationPersonnelRepository.DeleteJC_AlarmNotificationPersonnelByAlarmConfigId(item);
                    }
                }
            });

            if (Basic.Framework.Data.PlatRuntime.Items.ContainsKey(DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey))
            {
                Basic.Framework.Data.PlatRuntime.Items[DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey] = DateTime.Now;
            }
            else
            {
                Basic.Framework.Data.PlatRuntime.Items.Add(DataContract.UserRoleAuthorize.KeyConst.AlarmNotificationChangedKey, DateTime.Now);
            }

            var jC_Alarmnotificationpersonnelconfigresponse = new BasicResponse();

            return(jC_Alarmnotificationpersonnelconfigresponse);
        }