public IHandlerBuilder Index()
        {
            var model = new SystemModel(_Systems);

            return(ModScriban.Page(Resource.FromAssembly("system_index.html"), (r, h) => new ViewModel <SystemModel>(r, h, model))
                   .Title("Systems"));
        }
 private void ConfirmationEmail(Data.Models.Payment.Order order, SystemModel settings, string name, bool isCustomer = true)
 {
     try
     {
         var subject = $"{settings.Get(SettingName.Title)} - Order Confirmation {order.Id}";
         if (isCustomer)
         {
             EmailSender.Send(_azureSettings.SendgridApiKey, subject, GetBody(order, name, settings, true), order.Email, settings.Get(SettingName.ContactEmail));
         }
         else
         {
             var emailsString = settings.Get(SettingName.OrderNotificationEmails);
             if (!string.IsNullOrWhiteSpace(emailsString))
             {
                 var emails = emailsString.Split(new[] { ',', ' ', ';' }, StringSplitOptions.RemoveEmptyEntries).Where(x => x.Length > 5 && x.Contains("@"));
                 foreach (var email in emails)
                 {
                     try { EmailSender.Send(_azureSettings.SendgridApiKey, subject, GetBody(order, name, settings, false), email, settings.Get(SettingName.ContactEmail)); }
                     catch (Exception ex) { Log(ex); }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log(ex);
         if (isCustomer)
         {
             throw new Exception("Order placed successfully but there was an error sending confirmation email - don't worry, your food will be ready!");
         }
     }
 }
Ejemplo n.º 3
0
 private static void AssertSystem(SystemModel expected, SystemModel actual)
 {
     Assert.AreEqual(expected.Name, actual.Name);
     Assert.AreEqual(expected.X, actual.X);
     Assert.AreEqual(expected.Y, actual.Y);
     Assert.AreEqual(expected.Z, actual.Z);
 }
Ejemplo n.º 4
0
        /// <summary>
        ///Algorithm for computing multiple-fault diagnoses using stochstic search.
        ///Return a set of minimal diagnoses.
        /// </summary>
        /// <param name="DS">The system model that describe the system.</param>
        /// <param name="obs">The given observation.</param>
        /// <param name="M">Represent the number of returns in improve diagnosis section.</param>
        /// <param name="N">Represent the number of return time of the algorithm.</param>
        public Trie <Diagnosis> safari(SystemModel DS, Observation obs, int M, int N)
        {
            int       n     = 0;
            int       m     = 0;
            Diagnosis W     = new Diagnosis();
            Diagnosis new_W = new Diagnosis();

            while (n < N)
            {
                W = tools.RandomDiagnosis(DS, obs);
                m = 0;
                while (m < M)
                {
                    Diagnosis tmp = new Diagnosis(W.TheDiagnosis);
                    new_W = tools.ImproveDiagnosis(tmp, tools.GetRandomTerm(W));
                    if (tools.isConsistency(obs, new_W.TheDiagnosis))
                    {
                        W = new_W;
                        m = 0;
                    }
                    else
                    {
                        m++;
                    }
                }
                if (!tools.IsSubsumed(setOfMinimalDiagnoses, W))
                {
                    tools.AddToTrie(setOfMinimalDiagnoses, W);
                    tools.RemoveSubsumed(setOfMinimalDiagnoses, W);
                }
                n++;
            }
            return(setOfMinimalDiagnoses);
        }
Ejemplo n.º 5
0
        // GET: Assets/Edit/5
        public ActionResult Edit(int?id)
        {
            if (AclHelper.hasAccess(User, currentAction, currentController))
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                rs_assets rs_assets = db.rs_assets.Find(id);
                if (rs_assets == null)
                {
                    return(HttpNotFound());
                }
                SystemModel model = new SystemModel();

                model.System         = rs_assets;
                ViewBag.OriginLocId  = new SelectList(db.rs_locations, "LocationId", "LocationName", rs_assets.OriginLocId);
                ViewBag.CurrentLocId = new SelectList(db.rs_locations, "LocationId", "LocationName", rs_assets.CurrentLocId);
                ViewBag.OwnerId      = new SelectList(db.rs_user, "UserId", "Username", rs_assets.OwnedBy);
                ViewBag.DivId        = new SelectList(db.rs_division, "DivId", "DivisionNo", rs_assets.DivId);
                ViewBag.OwnerShipId  = new SelectList(db.rs_ownership, "OwnerShipId", "OwnerType", rs_assets.OwnerShipId);
                ViewBag.Availability = new SelectList(db.rs_assetstatus, "StatusId", "Status", rs_assets.Availability);
                return(View(model));
            }
            else
            {
                return(RedirectToAction("NotAuthenticated", "Home"));
            }
        }
        public int EditTask(SystemModel aSystem)
        {
            Query = "UPDATE SystemTable SET Name = @aName, Description = @aDescription, DateCreated = @aDateCreated, DateUpdated= @aDateUpdated WHERE Id = @aId";

            Command = new SqlCommand();
            Command = new SqlCommand(Query, Connection);

            Command.Parameters.Clear();

            Command.Parameters.Add("aId", SqlDbType.VarChar);
            Command.Parameters["aId"].Value = aSystem.Id;

            Command.Parameters.Add("aName", SqlDbType.VarChar);
            Command.Parameters["aName"].Value = aSystem.Name;
            Command.Parameters.Add("aDescription", SqlDbType.VarChar);
            Command.Parameters["aDescription"].Value = aSystem.Description;

            Command.Parameters.Add("aDateCreated", SqlDbType.DateTime);
            Command.Parameters["aDateCreated"].Value = aSystem.DateCreated;

            Command.Parameters.Add("aDateUpdated", SqlDbType.DateTime);
            Command.Parameters["aDateUpdated"].Value = aSystem.DateUpdated;

            Connection.Open();

            int rowAffected = Command.ExecuteNonQuery();

            Connection.Close();

            return(rowAffected);
        }
 public static YamlSystemModel FromModel(SystemModel model)
 {
     return(new YamlSystemModel(
                model.Roles.Select(YamlRole.FromModel).ToArray().NullIfEmpty(),
                model.Tenants.Select(YamlTenant.FromModel).ToArray().NullIfEmpty(),
                model.TenantTags.Select(YamlTenantTag.FromModel).ToArray().NullIfEmpty()));
 }
        public void Uploader_should_not_be_case_sensitive()
        {
            var caseSensitiveModel = new SystemModel(new[]
            {
                new Role("api", new List <string> {
                    "DEV1", "Dev2"
                }),
                new Role("csapi", new List <string> {
                    "dev1", "dev2"
                }),
                new Role("service", new List <string> {
                    "dev3"
                })
            }, new[]
            {
                new Tenant("a", new List <string> {
                    "dev1"
                }),
            }, new[]
            {
                new TenantTag("a", new List <string> {
                    "dev1"
                })
            });

            _uploader.UploadModel(caseSensitiveModel);
            var actual = _downloader.DownloadModel();

            actual.AssertDeepEqualsTo(_model);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 增加
 /// </summary>
 /// <param name="entity">系统数据</param>
 public void Insert(SystemModel entity)
 {
     using (var conn = new Npgsql.NpgsqlConnection(ConnectionString))
     {
         conn.Insert(entity);
     }
 }
Ejemplo n.º 10
0
    /// <summary>
    /// 打印日志
    /// </summary>
    /// <param name="systemModel">功能模块</param>
    /// <param name="level">日志级别</param>
    /// <param name="format">日志格式:"{0},{1}"</param>
    /// <param name="args">日志格式化参数</param>
    public static void Log(SystemModel systemModel, TraceLevel level, string format, params object[] args)
    {
        if (CommonDefineManager.Instance == null)
        {
            return;
        }
        if (!CommonDefineManager.Instance.TraceConfigDataBase.PassToTrace(systemModel, level))
        {
            return;
        }
        switch (level)
        {
        case TraceLevel.Info:
        case TraceLevel.Verbose:
            Debug.Log(string.Format(format, args));
            break;

        case TraceLevel.Error:
            Debug.LogError(string.Format(format, args));
            break;

        case TraceLevel.Warning:
            Debug.LogWarning(string.Format(format, args));
            break;

        case TraceLevel.Exception:
            Debug.LogException(new Exception(string.Format(format, args)));
            break;
        }
    }
        public void It_should_move_known_role()
        {
            _model = new SystemModel(new[]
            {
                new Role("api", new List <string> {
                    "dev3", "dev2"
                }),
            }, new[]
            {
                new Tenant("a", new List <string> {
                    "dev1"
                }),
            }, new[]
            {
                new TenantTag("a", new List <string> {
                    "dev1"
                })
            });

            _uploader.UploadModel(_model);
            var actual = _downloader.DownloadModel();

            Assert.That(actual.Roles.Single(x => x.Name == "api").Machines.Contains("dev3"));
            Assert.That(actual.Roles.Single(x => x.Name == "api").Machines.Contains("dev2"));
            Assert.That(!actual.Roles.Single(x => x.Name == "api").Machines.Contains("dev1"));
        }
Ejemplo n.º 12
0
        private BaseActionResult UpdateGridColumnOptionTable(SystemModel oModel, string strListName)
        {
            DataSetActionResult result = new DataSetActionResult();

            try
            {
                bool bResult = systemProfileService.UpdateGridColumnOptionTable(oModel, strListName);
                if (bResult)
                {
                    result.Result      = bResult;
                    result.DataSetData = null;
                }
                else
                {
                    result.Result = !bResult;
                }
            }
            catch (Exception ex)
            {
                result.Result        = false;
                result.ReturnMessage = ex.Message;
            }

            return(result);
        }
Ejemplo n.º 13
0
        private BaseActionResult UpdateWarningTime(SystemModel oModel)
        {
            DataSetActionResult result = new DataSetActionResult();

            try
            {
                bool bResult = systemProfileService.UpdateWarningTime(oModel);
                if (bResult)
                {
                    result.Result      = bResult;
                    result.DataSetData = null;
                }
                else
                {
                    result.Result = !bResult;
                }
            }
            catch (Exception ex)
            {
                result.Result        = false;
                result.ReturnMessage = ex.Message;
            }

            return(result);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Получает содержимое страницы.
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var model = new SystemModel();

            var token = GetToken();

            var currentDomain = RemontinkaServer.Instance.DataStore.GetUserDomain(token.User.UserDomainID);

            model.RegistrationInfoModel = new RegistrationInfoModel
            {
                Address   = currentDomain.Address,
                Email     = currentDomain.RegistredEmail,
                LegalName = currentDomain.LegalName,
                Login     = currentDomain.UserLogin,
                Trademark = currentDomain.Trademark
            };

            model.ExportModel = new ExportModel
            {
                BeginDate = DateTime.Today,
                EndDate   = DateTime.Today
            };

            return(View(model));
        }
        public List <SystemModel> ListAllTasks()
        {
            Query = "SELECT * FROM SystemTable";

            Command = new SqlCommand(Query, Connection);

            Connection.Open();

            Reader = Command.ExecuteReader();

            List <SystemModel> systems = new List <SystemModel>();

            while (Reader.Read())
            {
                SystemModel aSystem = new SystemModel();

                aSystem.Id          = Reader["Id"].ToString();
                aSystem.Name        = Reader["Name"].ToString();
                aSystem.Description = Reader["Description"].ToString();
                aSystem.DateCreated = (DateTime)Reader["DateCreated"];
                aSystem.DateUpdated = (DateTime)Reader["DateUpdated"];


                systems.Add(aSystem);
            }

            Reader.Close();
            Connection.Close();

            return(systems);
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="entity">系统数据</param>
 public void Update(SystemModel entity)
 {
     using (var conn = new Npgsql.NpgsqlConnection(ConnectionString))
     {
         conn.Update(entity);
     }
 }
        public int CreateTask(SystemModel aSystem)
        {
            Query = "INSERT INTO SystemTable VALUES (@aId, @aName ,  @aDescription ,@aDateCreated, @aDateUpdated)";

            Command = new SqlCommand(Query, Connection);
            Command.Parameters.Clear();

            Command.Parameters.Add("aId", SqlDbType.VarChar);
            Command.Parameters["aId"].Value = aSystem.Id;
            Command.Parameters.Add("aName", SqlDbType.VarChar);
            Command.Parameters["aName"].Value = aSystem.Name;
            Command.Parameters.Add("aDescription", SqlDbType.VarChar);
            Command.Parameters["aDescription"].Value = aSystem.Description;

            Command.Parameters.Add("aDateCreated", SqlDbType.DateTime);
            Command.Parameters["aDateCreated"].Value = aSystem.DateCreated;

            Command.Parameters.Add("aDateUpdated", SqlDbType.DateTime);
            Command.Parameters["aDateUpdated"].Value = aSystem.DateUpdated;

            Connection.Open();
            int effectedRow = Command.ExecuteNonQuery();

            Connection.Close();
            return(effectedRow);
        }
Ejemplo n.º 18
0
        // GET: Assets/SystemDetails/5
        public ActionResult SystemDetails(int?id)
        {
            SystemModel model = null;

            if (AclHelper.hasAccess(User, currentAction, currentController))
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                rs_assets rs_assets = db.rs_assets.Find(id);
                if (rs_assets == null)
                {
                    return(HttpNotFound());
                }
                if (rs_assets.IsSystem)
                {
                    model = AssetHelper.GetSystemModel(rs_assets.AssetId);
                }
                else
                {
                    model.System = rs_assets;
                    model.Assets = null;
                }
                return(View(rs_assets));
            }
            else
            {
                return(RedirectToAction("NotAuthenticated", "Home"));
            }
        }
Ejemplo n.º 19
0
 public LtmsAlgorithm(SystemModel sm, Observation obs)
 {
     this.cnf = new Cnf(sm);
     this.sm  = sm;
     cnf.assign_diagnose(obs);
     //this.cnf = new Cnf(build_example());
 }
Ejemplo n.º 20
0
        // GET: Assets/Create
        public ActionResult Create()
        {
            if (AclHelper.hasAccess(User, currentAction, currentController))
            {
                ViewBag.OriginLocId  = new SelectList(db.rs_locations, "LocationId", "LocationName");
                ViewBag.CurrentLocId = new SelectList(db.rs_locations, "LocationId", "LocationName");
                ViewBag.OwnerId      = new SelectList(db.rs_user, "UserId", "Username");
                ViewBag.DivId        = new SelectList(db.rs_division, "DivId", "DivisionNo");
                ViewBag.OwnerShipId  = new SelectList(db.rs_ownership, "OwnerShipId", "OwnerType");
                ViewBag.Availability = new SelectList(db.rs_assetstatus, "StatusId", "Status");

                if (AclHelper.IsAdmin(User.Identity.Name))
                {
                    ViewBag.SubAssetId = new SelectList(db.rs_assets.Where(x => x.IsSystem == false), "AssetId", "Model");
                }
                else
                {
                    ViewBag.SubAssetId = new SelectList(db.rs_assets.Where(x => x.IsSystem == false && x.OwnedBy == AclHelper.GetUserId(User.Identity.Name)), "AssetId", "Model");
                }
                SystemModel model = new SystemModel();

                model.Step = 1;
                return(View("Assets", model));
            }
            else
            {
                return(RedirectToAction("NotAuthenticated", "Home"));
            }
        }
Ejemplo n.º 21
0
        // Machines will be updated with roles defined in the definitions folder.
        // If machine is missing defined role it will be added.
        // If machine has known(we have definition for it in repository) role,
        // but in repo it doesn't point to this particular machine - it will be removed.
        // However we do not touch unknown roles (roles we are not aware of eg: they are not defined in a repository)
        // for tenants and tags logic is the same
        public void UploadModel(SystemModel model)
        {
            var knownRoles   = model.Roles.Select(x => x.Name).ToList();
            var knownTenants = model.Tenants.Select(x => x.Name).ToList();
            var knownTags    = model.TenantTags.Select(x => x.Name).ToList();

            var machines = _repository.Machines.FindAll();

            CheckMachinesExistence(machines.Select(x => x.Name).ToList(), model.Roles.SelectMany(x => x.Machines).Distinct(_comparer).ToList());
            Logger.Info("\n\tUploading roles");

            foreach (var machineResource in machines)
            {
                UploadRoleMappingForMachine(machineResource, model.Roles, knownRoles);
            }

            CheckMachinesExistence(machines.Select(x => x.Name).ToList(), model.Tenants.SelectMany(x => x.Machines).Distinct(_comparer).ToList());
            Logger.Info("\n\tUploading tenants");

            foreach (var machineResource in machines)
            {
                UploadTenantMappingForMachine(machineResource, model.Tenants, knownTenants);
            }

            CheckMachinesExistence(machines.Select(x => x.Name).ToList(), model.TenantTags.SelectMany(x => x.Machines).Distinct(_comparer).ToList());
            Logger.Info("\n\tUploading tags");

            foreach (var machineResource in machines)
            {
                UploadTenantTagsMappingForMachine(machineResource, model.TenantTags, knownTags);
            }
        }
Ejemplo n.º 22
0
 public ActionResult Edit(SystemModel model)
 {
     if (AclHelper.hasAccess(User, currentAction, currentController))
     {
         if (ModelState.IsValid)
         {
             model.System.UpdatedDate     = DateTime.Now;
             model.System.CurrentLocId    = model.CurrentLocId;
             model.System.OriginLocId     = model.OriginLocId;
             model.System.OwnedBy         = model.OwnerId;
             model.System.DivId           = model.DivId;
             model.System.OwnerShipId     = model.OwnerShipId;
             model.System.Availability    = model.Availability;
             db.Entry(model.System).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.OriginLocId  = new SelectList(db.rs_locations, "LocationId", "LocationName", model.System.OriginLocId);
         ViewBag.CurrentLocId = new SelectList(db.rs_locations, "LocationId", "LocationName", model.System.CurrentLocId);
         ViewBag.OwnerId      = new SelectList(db.rs_user, "UserId", "Username", model.System.OwnedBy);
         ViewBag.DivId        = new SelectList(db.rs_division, "DivId", "DivisionNo", model.System.DivId);
         ViewBag.OwnerShipId  = new SelectList(db.rs_ownership, "OwnerShipId", "OwnerType", model.System.OwnerShipId);
         ViewBag.Availability = new SelectList(db.rs_assetstatus, "StatusId", "Status", model.System.Availability);
         return(View(model));
     }
     else
     {
         return(RedirectToAction("NotAuthenticated", "Home"));
     }
 }
Ejemplo n.º 23
0
        // GET: Backlog
        public ActionResult Index()
        {
            try
            {
                var paymentTypes          = this.PaymentTypeService.GetAll();
                var paymentTypesViewModel = Mapper.Map <List <IdDescriptionViewModel> >(paymentTypes);

                var laboralUnions          = this.LaboralUnionService.GetAll();
                var laboralUnionsViewModel = Mapper.Map <List <IdDescriptionViewModel> >(laboralUnions);

                var cities          = this.CityService.GetAll();
                var citiesViewModel = Mapper.Map <List <IdDescriptionViewModel> >(cities);

                var provinces          = this.ProvinceService.GetAllProvinces();
                var provincesViewModel = Mapper.Map <List <IdDescriptionViewModel> >(provinces);

                var SystemModel = new SystemModel()
                {
                    Cities        = citiesViewModel,
                    Provinces     = provincesViewModel,
                    LaboralUnions = laboralUnionsViewModel,
                    PaymentTypes  = paymentTypesViewModel
                };

                return(View("Index", SystemModel));
            }
            catch (Exception ex)
            {
                return(View("../Shared/Error"));
            }
        }
Ejemplo n.º 24
0
        public ActionResult AddAccessories(SystemModel model)
        {
            rs_accessories acc = model.Accessories;

            if (AclHelper.hasAccess(User, currentAction, currentController))
            {
                if (ModelState.IsValid)
                {
                    rs_assets system = db.rs_assets.Find(model.System.AssetId);
                    if (system != null)
                    {
                        acc.AssetId = model.System.AssetId;
                        db.rs_accessories.Add(acc);
                        db.SaveChanges();

                        return(RedirectToAction("Details", new { id = model.System.AssetId }));
                    }
                    else
                    {
                        return(RedirectToAction("Details", new { id = model.System.AssetId }));
                    }
                }
                else
                {
                    return(RedirectToAction("NotAuthenticated", "Home"));
                }
            }
            else
            {
                return(RedirectToAction("NotAuthenticated", "Home"));
            }
        }
Ejemplo n.º 25
0
 public IList <ContainerModel> GetEmptyContainers(SystemModel system)
 {
     return(system.Components
            .Where(p => p.ComponentType == ComponentTypeEnum.Container &&
                   !(p as ContainerModel).HasBall)
            .Select(p => p as ContainerModel)
            .ToList());
 }
Ejemplo n.º 26
0
 public ActionResult <SystemModel> Post([FromBody] SystemModel system)
 {
     if (null != _systemService.Get(s => s.Name == system.Name).FirstOrDefault())
     {
         return(Conflict(new { error = "System alredy exist!" }));
     }
     return(Created("", _systemService.Create(system)));
 }
Ejemplo n.º 27
0
 public void Save(SystemModel model, string modelDirectory)
 {
     Directory.CreateDirectory(modelDirectory);
     foreach (var splitModel in model.SplitModel().Select(YamlOctopusModel.FromModel))
     {
         SaveModel(splitModel, GetModelPath(splitModel, modelDirectory));
     }
 }
Ejemplo n.º 28
0
        public void TryParseShouldReturnTrue()
        {
            string line = "{20:06:10} machines=6&numturnlinks=1&backlogtotal=0&backlogmax=0&avgsrtt=107&loss=0.008&&jit=2.020";

            SystemModel actual = NetLogLine.Parse(line);

            Assert.IsNull(actual);
        }
Ejemplo n.º 29
0
        public ActionResult AddAsset(SystemModel model, HttpPostedFileBase file)
        {
            rs_assets    rs_assets = model.SubAsset;
            JSonResponse result    = new JSonResponse();

            if (AclHelper.hasAccess(User, currentAction, currentController))
            {
                if (ModelState.IsValid)
                {
                    rs_assets system = db.rs_assets.Find(model.System.AssetId);
                    if (system != null)
                    {
                        rs_assets.CreatedDate  = DateTime.Now;
                        rs_assets.UpdatedDate  = DateTime.Now;
                        rs_assets.CurrentLocId = model.CurrentLocId;
                        rs_assets.OriginLocId  = model.OriginLocId;
                        rs_assets.OwnedBy      = model.OwnerId;
                        rs_assets.DivId        = model.DivId;
                        rs_assets.OwnerShipId  = model.OwnerShipId;
                        rs_assets.Availability = model.Availability;
                        string ownerShip = db.rs_ownership.Find(model.OwnerShipId).OwnerType;
                        int    divNo     = db.rs_division.Find(model.DivId).DivisionNo;

                        rs_assets.TrackingNo = AssetHelper.GenerateTrackingNo(ownerShip, divNo,
                                                                              rs_assets.IsSystem, rs_assets.PurchaseDate);

                        if (AssetHelper.IsImage(file))
                        {
                            file.SaveAs(HttpContext.Server.MapPath("~/AssetsImg/")
                                        + file.FileName);
                            rs_assets.ImageLink = file.FileName;
                        }
                        db.rs_assets.Add(rs_assets);
                        db.SaveChanges();

                        rs_assets_rel rel = new rs_assets_rel();
                        rel.AssetId = rs_assets.AssetId;
                        rel.SysId   = model.System.AssetId;
                        db.rs_assets_rel.Add(rel);
                        db.SaveChanges();

                        return(RedirectToAction("Details", new { id = model.System.AssetId }));
                    }
                    else
                    {
                        return(RedirectToAction("Details", new { id = model.System.AssetId }));
                    }
                }
                else
                {
                    return(RedirectToAction("NotAuthenticated", "Home"));
                }
            }
            else
            {
                return(RedirectToAction("NotAuthenticated", "Home"));
            }
        }
Ejemplo n.º 30
0
        public bool UserValidate(string controllerName, string actionName, string empNo, string systemName)
        {
            SystemControllerBll controller     = new SystemControllerBll();
            SystemModelBll      model          = new SystemModelBll();
            SystemActionBll     action         = new SystemActionBll();
            SystemPowerBll      systemPowerBll = new SystemPowerBll();


            try
            {
                lock (new object())
                {
                    SystemModel modelEntity =
                        (model.Count(c => c.ModelName == systemName) < 1)
                               ?
                        model.AddEntity(new SystemModel()
                    {
                        ModelName = systemName,
                        ModelUrl  = "~/" + systemName
                    })
                               :
                        model.Single(c => c.ModelName == systemName);

                    Entity.MANAGER.SystemController controllerEntity =
                        (controller.Count(c => c.ControllerName == controllerName) < 1)
                            ?
                        controller.AddEntity(new Entity.MANAGER.SystemController
                    {
                        ModelId        = modelEntity.ModelId,
                        ControllerName = controllerName,
                        CreateTime     = DateTime.Now,
                        IsDisplay      = true,
                    })
                            :
                        controller.Single(c => c.ControllerName == controllerName);

                    SystemAction actionEntity = (
                        action.Count(
                            c => c.ControllerId == controllerEntity.ControllerId && c.ActionName == actionName) < 1)
                            ?
                                                action.AddEntity(new SystemAction()
                    {
                        ControllerId  = controllerEntity.ControllerId,
                        ActionName    = actionName,
                        ActionDetails = "系统自动添加",
                    })
                            :
                                                action.Single(
                        c => c.ControllerId == controllerEntity.ControllerId && c.ActionName == actionName);

                    return(systemPowerBll.Count(c => c.ActionId == actionEntity.ActionId && c.EmpNo == empNo) > 0);
                }
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 31
0
 public ShipDestinationInfo(SystemModel system, Vector3 fstOffset) {
     Target = system;
     _fstOffset = fstOffset;
     _closeEnoughDistance = system.Radius;
     _progressCheckDistance = system.Radius;
 }