Ejemplo n.º 1
0
        public override bool Equals(Object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is TypedDependency))
            {
                return(false);
            }

            var typedDep = (TypedDependency)o;

            if (Reln != null ? !Reln.Equals(typedDep.Reln) : typedDep.Reln != null)
            {
                return(false);
            }
            if (Gov != null ? !Gov.Equals(typedDep.Gov) : typedDep.Gov != null)
            {
                return(false);
            }
            if (Dep != null ? !Dep.Equals(typedDep.Dep) : typedDep.Dep != null)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            DepRule rule   = new DepRule();
            Dep     entity = EntityGet();

            rule.RUpdate(entity);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                Dep MasterEntity = (Dep)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Data_Dep WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Ejemplo n.º 4
0
        public IActionResult StudentList()
        {
            try
            {
                var stdList = from a in _Db.tbl_Student
                              join b in _Db.tbl_Departments
                              on a.DeptID equals b.ID
                              into Dep
                              from b in Dep.DefaultIfEmpty()

                              select new Student
                {
                    ID          = a.ID,
                    Name        = a.Name,
                    fname       = a.fname,
                    Mobile      = a.Mobile,
                    Email       = a.Email,
                    Description = a.Description,
                    DeptID      = a.DeptID,

                    Department = b == null ? "" : b.Department
                };

                return(View(stdList));
            }
            catch (Exception ex)
            {
                throw ex;
                // return View();
            }
        }
Ejemplo n.º 5
0
        private void BuildParent(Dep depParent)
        {
            ConsoleWriter.WriteInfo("Checking parent " + depParent);
            if (new Get().Run(new[] { "get", depParent.Name, "-c", depParent.Configuration }) != 0)
            {
                throw new CementException("Failed get module " + depParent.Name);
            }
            ConsoleWriter.ResetProgress();
            if (new Get().Run(new[] { "get", moduleName, branch }) != 0)
            {
                throw new CementException("Failed get current module " + moduleName);
            }
            ConsoleWriter.ResetProgress();

            using (new DirectoryJumper(Path.Combine(workspace, depParent.Name)))
            {
                if (new BuildDeps().Run(new[] { "build-deps", "-c", depParent.Configuration }) != 0)
                {
                    throw new CementException("Failed to build deps for " + depParent.Name);
                }
                ConsoleWriter.ResetProgress();
                if (new Build().Run(new[] { "build" }) != 0)
                {
                    throw new CementException("Failed to build " + depParent.Name);
                }
                ConsoleWriter.ResetProgress();
            }
            ConsoleWriter.WriteOk($"{depParent} build fine");
            Console.WriteLine();
        }
Ejemplo n.º 6
0
        public void Setup()
        {
            engine = new SinglethreadEngine();
            state  = new State(engine);

            state.Setup(cd, engine);

            Common.Binders.Label(cd, engine,
                                 map.GetComponent <Text>("user_id"), state.UserId,
                                 i => string.Format("User ID: {0}", i.HasValue ? i.Value.ToString() : "<none>")
                                 );
            Common.Binders.Label(cd, engine,
                                 map.GetComponent <Text>("repo_count"), state.RepoCount,
                                 i => string.Format("{0} repositories", i.HasValue ? i.Value.ToString() : "<none>")
                                 );
            Common.Binders.InputField(cd, engine,
                                      map.GetComponent <InputField>("user_name"), state.UserName,
                                      s => s
                                      );
            Common.Binders.Enabled(cd, engine,
                                   map.Get("is_busy"), state.IsBusy
                                   );

            engine.Mainer(cd, Dep.On(state.HttpUserId.Error), () =>
            {
                HttpError error;
                if (state.HttpUserId.Error.TryRead(out error))
                {
                    Debug.Log(error);
                }
            });
        }
        public IActionResult EmployeeList()
        {
            try
            {
                var EmployeeList = from a in _Db.tbl_Employee
                                   join b in _Db.tbl_Department
                                   on a.ID equals b.ID
                                   into Dep
                                   from b in Dep.DefaultIfEmpty()

                                   select new Employee
                {
                    ID           = a.ID,
                    Name         = a.Name,
                    Mobile       = a.Mobile,
                    Email        = a.Email,
                    DepartmentID = a.DepartmentID,
                    Description  = a.Description,
                    Department   = b == null?"":b.Department
                };

                return(View(EmployeeList));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Ejemplo n.º 8
0
        public void SetupUnity(CompositeDisposable cd, IEngine engine)
        {
            Dialog.SetupUnity(cd, engine);

            engine.Mainer(cd, Dep.On(Dialog.Root), () =>
            {
                var root = Dialog.Root.Read();
                if (!root)
                {
                    return;
                }
                var map = root.GetComponent <Common.Map>();
                var scd = root.GetComponent <Common.DisposeOnDestroy>().cd;

                map.GetComponent <Text>("message").text = messageFormatter(Current);

                Common.Binders.ButtonClick(scd, engine,
                                           map.GetComponent <Button>("yes"), Yes,
                                           () => Current
                                           );
                Common.Binders.Interactable(scd, engine,
                                            map.GetComponent <Button>("yes"), Status,
                                            b => b
                                            );
                Common.Binders.ButtonClick(scd, engine,
                                           map.GetComponent <Button>("no"), No,
                                           () => Current
                                           );
            });
        }
Ejemplo n.º 9
0
        private void GetAndBuild(Dep module)
        {
            using (new DirectoryJumper(Helper.CurrentWorkspace))
            {
                ConsoleWriter.WriteInfo("cm get " + module);
                if (new Get().Run(new[] { "get", module.ToYamlString() }) != 0)
                {
                    throw new CementException("Failed get module " + module);
                }
                ConsoleWriter.ResetProgress();
            }

            module.Configuration = module.Configuration ?? Yaml.ConfigurationParser(module.Name).GetDefaultConfigurationName();

            using (new DirectoryJumper(Path.Combine(Helper.CurrentWorkspace, module.Name)))
            {
                ConsoleWriter.WriteInfo("cm build-deps " + module);
                if (new BuildDeps().Run(new[] { "build-deps", "-c", module.Configuration }) != 0)
                {
                    throw new CementException("Failed to build deps for " + dep);
                }
                ConsoleWriter.ResetProgress();
                ConsoleWriter.WriteInfo("cm build " + module);
                if (new Build().Run(new[] { "build", "-c", module.Configuration }) != 0)
                {
                    throw new CementException("Failed to build " + dep);
                }
                ConsoleWriter.ResetProgress();
            }
            Console.WriteLine();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            DepRule rule   = new DepRule();
            Dep     entity = EntityGet();

            rule.RAdd(entity);
            return(entity.ID);
        }
Ejemplo n.º 11
0
        public async Task <bool> InsertDepartamento(Dep departamento)
        {
            var db     = dbConnection();
            var sql    = @"INSERT INTO [dbo].[Departamentos] ([nombreDep]) VALUES (@nombreDep)";
            var result = await db.ExecuteAsync(sql.ToString(), new { departamento.nombreDep });

            return(result > 0);
        }
Ejemplo n.º 12
0
        public void TestSlashAndAtChars()
        {
            var dep = new Dep(@"module/config\/1\@a@branch\/1");

            Assert.AreEqual("module", dep.Name);
            Assert.AreEqual("config/1@a", dep.Configuration);
            Assert.AreEqual("branch/1", dep.Treeish);
        }
Ejemplo n.º 13
0
        public void TestSlashInBranch2()
        {
            var dep = new Dep(@"module@branch\/1/config");

            Assert.AreEqual("module", dep.Name);
            Assert.AreEqual("config", dep.Configuration);
            Assert.AreEqual("branch/1", dep.Treeish);
        }
Ejemplo n.º 14
0
        public override int GetHashCode()
        {
            int result = (Reln != null ? Reln.GetHashCode() : 17);

            result = 29 * result + (Gov != null ? Gov.GetHashCode() : 0);
            result = 29 * result + (Dep != null ? Dep.GetHashCode() : 0);
            return(result);
        }
Ejemplo n.º 15
0
        public void TestTreeishConfigFirst()
        {
            var dep = new Dep("module/config@branch");

            Assert.AreEqual("module", dep.Name);
            Assert.AreEqual("config", dep.Configuration);
            Assert.AreEqual("branch", dep.Treeish);
        }
Ejemplo n.º 16
0
        public async Task <bool> DeleteDepartamento(Dep idDep)
        {
            var db  = dbConnection();
            var sql = @"DELETE FROM [dbo].[Departamentos] WHERE idDep=@idDep";

            var result = await db.ExecuteAsync(sql.ToString(), new { idDep = idDep });

            return(result > 0);
        }
Ejemplo n.º 17
0
        public static List <string> GetChildrenConfiguration(Dep dep)
        {
            var parser            = ConfigurationParser(dep.Name);
            var configs           = parser.GetConfigurations();
            var manager           = new ConfigurationManager(dep.Name, configs);
            var processedChildren = manager.ProcessedChildrenConfigurations(dep).Concat(new[] { dep.Configuration }).Distinct().ToList();

            return(processedChildren);
        }
Ejemplo n.º 18
0
        private List <Dep> GetUpdatedModules(Dep moduleToBuild)
        {
            List <Dep> modulesToUpdate;
            Dictionary <string, string> currentCommitHashes;
            List <Dep> topSortedDeps;

            new BuildPreparer(Log).GetModulesOrder(moduleToBuild.Name, moduleToBuild.Configuration, out topSortedDeps, out modulesToUpdate, out currentCommitHashes);
            return(modulesToUpdate);
        }
Ejemplo n.º 19
0
        public void SetupUnity(CompositeDisposable cd, IEngine engine, State state)
        {
            Scene.SetupUnity(cd, engine);
            UpgradeItem.SetupUnity(cd, engine);
            SellItem.SetupUnity(cd, engine);

            engine.Mainer(cd, Dep.On(Scene.Root), () =>
            {
                var root = Scene.Root.Read();
                if (!root)
                {
                    return;
                }
                var map = root.GetComponent <Common.Map>();
                var scd = root.GetComponent <Common.DisposeOnDestroy>().cd;

                Common.Binders.Label(scd, engine,
                                     map.GetComponent <Text>("gold"), state.Gold,
                                     i => string.Format("Gold: {0}", i)
                                     );
                Common.Binders.Click(scd, engine,
                                     map.GetComponent <Common.Clickable>("upgrade"), UpgradeItem.Trigger,
                                     () => SelectedItem.Read()
                                     );
                Common.Binders.Interactable(scd, engine,
                                            map.GetComponent <Button>("upgrade"), UpgradeItem.Status,
                                            b => b
                                            );
                Common.Binders.List(scd, engine,
                                    map.GetComponent <Transform>("items"),
                                    map.GetComponent <Common.Map>("item"),
                                    Items, (icd, imap, item) =>
                {
                    Common.Binders.Label(icd, engine,
                                         imap.GetComponent <Text>("level"), item.Level,
                                         i => string.Format("Lv.{0}", i)
                                         );
                    Common.Binders.Image(icd, engine,
                                         imap.GetComponent <Image>("image"), item.Image
                                         );
                    Common.Binders.ButtonClick(icd, engine,
                                               imap.GetComponent <Button>("view_details"),
                                               () => ItemDetails.CreateAndShow(engine, state, item)
                                               );
                    Common.Binders.Click(icd, engine,
                                         imap.GetComponent <Common.Clickable>("select"),
                                         () => SelectedItem.Raw.Write(
                                             SelectedItem.Raw == item.Id ? null : item.Id)
                                         );
                    Common.Binders.Enabled(icd, engine,
                                           imap.Get("is_selected"), SelectedItem,
                                           it => it == item
                                           );
                }
                                    );
            });
        }
Ejemplo n.º 20
0
    void Start()
    {
        Deform = G.Engine.Op <Ops.Deform>();

        deformingMesh    = GetComponent <MeshFilter>().mesh;
        originalVertices = deformingMesh.vertices;
        {
            var tmp = new Vector3[originalVertices.Length];
            Array.Copy(originalVertices, tmp, originalVertices.Length);
            displacedVertices = new Ar <Vector3>(G.Engine, tmp);
        }
        vertexVelocities = new Ar <Vector3>(G.Engine, new Vector3[originalVertices.Length]);
        uniformScale     = transform.localScale.x;

        G.Engine.Computer(cd, Dep.On(Deform, G.Tick), () =>
        {
            if (Deform.Count <= 0 && isStill(this.vertexVelocities.Read()))
            {
                return;
            }
            var vertexVelocities  = this.vertexVelocities.AsWrite();
            var displacedVertices = this.displacedVertices.Read();
            float dt = G.Tick.Reduced;

            for (int i = 0, n = Deform.Count; i < n; ++i)
            {
                var d = Deform[i];
                AddDeformingForce(d.Point, d.Force, displacedVertices, vertexVelocities, dt);
            }

            for (int i = 0, n = displacedVertices.Length; i < n; i++)
            {
                UpdateVelocity(i, displacedVertices, vertexVelocities, dt);
            }
        });
        G.Engine.Computer(cd, Dep.On(G.Tick), () =>
        {
            if (isStill(this.vertexVelocities.Read()))
            {
                return;
            }
            var vertexVelocities  = this.vertexVelocities.Read();
            var displacedVertices = this.displacedVertices.AsWrite();
            float dt = G.Tick.Reduced;

            for (int i = 0, n = displacedVertices.Length; i < n; i++)
            {
                UpdateVertex(i, displacedVertices, vertexVelocities, dt);
            }
        });

        G.Engine.Reader(cd, Dep.On(G.Tick), () =>
        {
            deformingMesh.vertices = displacedVertices.Read();
            deformingMesh.RecalculateNormals();
        });
    }
Ejemplo n.º 21
0
        public void ResolveDependencies()
        {
            if (DependenciesResolved)
            {
                return;
            }


            foreach (PeImportDll DllImport in Imports)
            {
                string ModuleFilepath = null;
                ModuleSearchStrategy Strategy;


                // Find Dll in "paths"
                Tuple <ModuleSearchStrategy, PE> ResolvedModule = Root.ResolveModule(DllImport.Name);
                Strategy = ResolvedModule.Item1;

                if (Strategy != ModuleSearchStrategy.NOT_FOUND)
                {
                    ModuleFilepath = ResolvedModule.Item2?.Filepath;
                }



                bool             IsAlreadyCached = Root.isModuleCached(DllImport.Name, ModuleFilepath);
                PeDependencyItem DependencyItem  = Root.GetModuleItem(DllImport.Name, ModuleFilepath, Strategy, RecursionLevel + 1);

                // do not add twice the same imported module
                if (ResolvedImports.Find(ri => ri.ModuleName == DllImport.Name) == null)
                {
                    ResolvedImports.Add(DependencyItem);
                }

                // Do not process twice a dependency. It will be displayed only once
                if (!IsAlreadyCached)
                {
                    Debug.WriteLine("[{0:d}] [{1:s}] Adding dep {2:s}", RecursionLevel, ModuleName, ModuleFilepath);
                    Dependencies.Add(DependencyItem);
                }
            }

            DependenciesResolved = true;
            if ((Root.MaxRecursion > 0) && ((RecursionLevel + 1) >= Root.MaxRecursion))
            {
                return;
            }


            // Recursively resolve dependencies
            foreach (var Dep in Dependencies)
            {
                Dep.LoadPe();
                Dep.ResolveDependencies();
            }
        }
Ejemplo n.º 22
0
        protected override int Execute()
        {
            var currentModuleDirectory = Helper.GetModuleDirectory(Directory.GetCurrentDirectory());
            var currentModule = Path.GetFileName(currentModuleDirectory);

            if (!File.Exists(project))
            {
                var all = Yaml.GetCsprojsList(currentModule);
                var maybe = all.FirstOrDefault(f =>
                    string.Equals(Path.GetFileName(f), project, StringComparison.CurrentCultureIgnoreCase));
                if (maybe != null)
                    project = maybe;
            }

            if (!File.Exists(project))
            {
                ConsoleWriter.WriteError($"Project file '{project}' does not exist.");
                return -1;
            }

            var moduleToInsert = Helper.TryFixModuleCase(dep.Name);
            dep = new Dep(moduleToInsert, dep.Treeish, dep.Configuration);
            var configuration = dep.Configuration;

            if (!Helper.HasModule(moduleToInsert))
            {
                ConsoleWriter.WriteError($"Can't find module '{moduleToInsert}'");
                return -1;
            }

            if (!Directory.Exists(Path.Combine(Helper.CurrentWorkspace, moduleToInsert)))
                GetAndBuild(dep);

            Log.Debug(
                $"{moduleToInsert + (configuration == null ? "" : Helper.ConfigurationDelimiter + configuration)} -> {project}");

            CheckBranch();

            Log.Info("Getting install data for " + moduleToInsert + Helper.ConfigurationDelimiter + configuration);
            var installData = InstallParser.Get(moduleToInsert, configuration);
            if (!installData.BuildFiles.Any())
            {
                ConsoleWriter.WriteWarning($"No install files found in '{moduleToInsert}'");
                return 0;
            }

            AddModuleToCsproj(installData);
            if (testReplaces)
                return hasReplaces ? -1 : 0;

            if (!File.Exists(Path.Combine(currentModuleDirectory, Helper.YamlSpecFile)))
                throw new CementException(
                    "No module.yaml file. You should patch deps file manually or convert old spec to module.yaml (cm convert-spec)");
            DepsPatcherProject.PatchDepsForProject(currentModuleDirectory, dep, project);
            return 0;
        }
Ejemplo n.º 23
0
 private static bool NoNeedToBuild(Dep dep, List <Dep> modulesToBuild)
 {
     if (!modulesToBuild.Contains(dep))
     {
         Log.LogDebug($"{dep.ToBuildString(),-40} *build skipped");
         ConsoleWriter.WriteSkip($"{dep.ToBuildString(),-40}");
         return(true);
     }
     return(false);
 }
Ejemplo n.º 24
0
        private void GetWithoutDependencies(Dep dep, List <Module> modules)
        {
            var getter = new ModuleGetter(
                modules,
                dep,
                LocalChangesPolicy.FailOnLocalChanges,
                null);

            getter.GetModule();
        }
Ejemplo n.º 25
0
        public async Task <IActionResult> Createdepartament(Dep dep)
        {
            if (ModelState.IsValid && dep != null)
            {
                await _db.Insert(dep);

                return(RedirectToAction("Index"));
            }
            return(View(dep));
        }
Ejemplo n.º 26
0
        public async Task <bool> UpdateDepartamento(Dep departamento)
        {
            var db     = dbConnection();
            var sql    = @" UPDATE [dbo].[Departamentos] 
                        SET nombreDep = @nombreDep
                    WHERE idDep=@idDep";
            var result = await db.ExecuteAsync(sql.ToString(), new { departamento.nombreDep, departamento.idDep });

            return(result > 0);
        }
Ejemplo n.º 27
0
        public Dep allocate_staff(Nurse[] list)
        {
            Dep dep = dep_list[i++];

            for (int i = 0; i < dep_list.Length; i++)
            {
                list[i].set_address(dep);
            }
            return(dep);
        }
Ejemplo n.º 28
0
 public void Setup(CompositeDisposable cd, IEngine engine, State state)
 {
     engine.OpWorker(cd, Dep.On(state.Inventory.UpgradeItem.Yes), () =>
     {
         if (state.Inventory.UpgradeItem.Yes.Unwrap == this)
         {
             Level.Write(Level + 1);
         }
     });
 }
 public MyPage()
 {
     AllDeps = new ObservableCollection <Foo>();
     InitializeComponent();
     // initialize Dep
     foreach (var d in Dep.GetAll())
     {
         AllDeps.Add(d);
     }
 }
Ejemplo n.º 30
0
        protected override void Seed(GridEntities context)
        {
            Dep dep = new Dep()
            {
                Name = "Math",
            };

            context.Deps.Add(dep);
            context.SaveChanges();
            base.Seed(context);
        }
Ejemplo n.º 31
0
 public Startable(Dep d)
 {
 }