private int CadastroRaj(string raj) { using (capdeEntities context = new capdeEntities()) { RAJ newRaj = new RAJ { NomeRaj = raj.ToUpper(), IsExcluido = false, }; CJ cj = new CJ { RajId = newRaj.RajId, CjIdent = context.CJs.Count() + 1, CjNome = StringBase.TODOS.ToString() }; Cidade cidade = new Cidade { CjId = cj.CjId, NomeCidade = StringBase.TODOS.ToString(), }; context.RAJs.Add(newRaj); context.CJs.Add(cj); context.Cidades.Add(cidade); context.SaveChanges(); return(newRaj.RajId); } }
private int CadastroCJ(string cj, int raj) { using (capdeEntities context = new capdeEntities()) { CJ newCJ = new CJ { RajId = raj, CjNome = cj.ToUpper(), IsExcluido = false, }; Cidade cidade = new Cidade { CJ = newCJ, NomeCidade = StringBase.TODOS.ToString(), IsExcluido = false, }; context.CJs.Add(newCJ); context.Cidades.Add(cidade); context.SaveChanges(); return(newCJ.CjId); } }
public List <string> GetCompileScriptsData(string namespaceName) { List <string> list = new List <string>(); string text = "public "; if (!(base.Parent is LogicEntityClass)) { text += "static "; } if (this.ReturnType != typeof(void)) { text += CJ.TypeToCSharpString(this.ReturnType); } else { text += "void"; } text = text + " " + this.methodName; if (this.parameters.Count != 0) { text += "( "; for (int i = 0; i < this.parameters.Count; i++) { if (i != 0) { text += ", "; } text += CJ.TypeToCSharpString(this.parameters[i].ParameterType); if (!string.IsNullOrEmpty(this.parameters[i].ParameterName)) { text = text + " " + this.parameters[i].ParameterName; } else { text = text + " __emptyParam" + i.ToString(); } } text += " )"; } else { text += "()"; } list.Add(text); list.Add("{"); string[] compileScriptsBody = this.GetCompileScriptsBody(namespaceName); string[] array = compileScriptsBody; for (int j = 0; j < array.Length; j++) { string str = array[j]; list.Add("\t" + str); } list.Add("}"); return(list); }
protected virtual void GetCompileScriptsClassBody(string namespaceName, LogicClass.CompileScriptsData data) { if (this.CustomScriptCodeCreated && !string.IsNullOrEmpty(this.CustomScriptCode)) { data.LineNumbers.Add(data.Strings.Count); string[] array = this.CustomScriptCode.Split(new char[] { '\n' }, StringSplitOptions.None); for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("\r", ""); } string[] array2 = array; for (int j = 0; j < array2.Length; j++) { string str = array2[j]; data.Strings.Add("\t\t" + str); } data.Strings.Add(""); } foreach (LogicVariable current in this.Variables) { if (current.SupportSerialization) { data.Strings.Add("\t\t[Engine.EntitySystem.Entity.FieldSerialize]"); } string text = "\t\tpublic "; if (!(this is LogicEntityClass)) { text += "static "; } string text2 = text; text = string.Concat(new string[] { text2, CJ.TypeToCSharpString(current.VariableType), " ", current.VariableName, ";" }); data.Strings.Add(text); } data.Strings.Add("\t\t"); foreach (LogicMethod current2 in this.Methods) { data.LineNumbers.Add(data.Strings.Count + 1); List <string> compileScriptsData = current2.GetCompileScriptsData(namespaceName); foreach (string current3 in compileScriptsData) { data.Strings.Add("\t\t" + current3); } data.Strings.Add(""); } }
private void CadastroRAJ() { using (capdeEntities context = new capdeEntities()) { RAJ rajVerif = context.RAJs.Where(x => x.NomeRaj == textBox1.Text).FirstOrDefault(); if (isEditing) { RAJ raj = context.RAJs.Where(x => x.RajId == idEditing).FirstOrDefault(); raj.NomeRaj = textBox1.Text; raj.IsExcluido = false; } else if (rajVerif == null) { RAJ raj = new RAJ { NomeRaj = textBox1.Text, RajIdent = context.RAJs.Count() + 1, IsExcluido = false, }; CJ cj = new CJ { RajId = raj.RajId, CjIdent = context.CJs.Count() + 1, CjNome = StringBase.TODOS.ToString(), IsExcluido = false, }; Cidade cidade = new Cidade { CjId = cj.CjId, NomeCidade = StringBase.TODOS.ToString(), IsExcluido = false, }; context.RAJs.Add(raj); context.CJs.Add(cj); context.Cidades.Add(cidade); } if (isEditing || rajVerif == null) { common.SaveChanges_Database(context, true); OutEditing(); } else { MessageBox_AlreadyCadastrado(textBox1, TypeForm.RAJ.ToString()); } }; }
private void CadastroCJ() { using (capdeEntities context = new capdeEntities()) { CJ verifCJ = context.CJs.Where(x => x.CjNome == textBox1.Text).FirstOrDefault(); if (isEditing) { CJ cj = context.CJs.Where(x => x.CjId == idEditing).FirstOrDefault(); cj.CjNome = textBox1.Text; cj.IsExcluido = false; } else if (verifCJ == null) { CJ cj = new CJ { RajId = (int)comboBox1.SelectedValue, CjIdent = context.CJs.Count() + 1, CjNome = textBox1.Text, IsExcluido = false, }; Cidade cidade = new Cidade { CjId = cj.CjId, NomeCidade = StringBase.TODOS.ToString(), IsExcluido = false, }; context.CJs.Add(cj); context.Cidades.Add(cidade); } if (isEditing || verifCJ == null) { common.SaveChanges_Database(context, true); OutEditing(); } else { MessageBox_AlreadyCadastrado(textBox1, TypeForm.CJ.ToString()); } }; }
protected override string[] GetCompileScriptsBody(string namespaceName) { List <string> list = new List <string>(); list.Add(string.Format("Engine.EntitySystem.LogicClass __class = Engine.EntitySystem.LogicSystemManager.Instance.MapClassManager.GetByName( \"{0}\" );", base.ParentClass.ClassName)); list.Add(string.Format("Engine.EntitySystem.LogicSystem.LogicDesignerMethod __method = (Engine.EntitySystem.LogicSystem.LogicDesignerMethod)__class.GetMethodByName( \"{0}\" );", base.MethodName)); string text = ""; if (base.ReturnType != typeof(void)) { text += string.Format("return ({0})", CJ.TypeToCSharpString(base.ReturnType)); } text += "__method.Execute( "; if (base.ParentClass is LogicEntityClass) { text += "this"; } else { text += string.Format("EntitySystemWorld.Instance.GetLogicSystemScriptsAssemblyClassByClassName( \"{0}\" )", base.ParentClass.ClassName); } text += string.Format(", new object[ {0} ]", base.Parameters.Count.ToString()); text += "{ "; for (int i = 0; i < base.Parameters.Count; i++) { if (i != 0) { text += ", "; } LogicParameter logicParameter = base.Parameters[i]; if (!string.IsNullOrEmpty(logicParameter.ParameterName)) { text += logicParameter.ParameterName; } else { text = text + "__emptyParam" + i.ToString(); } } text += " } );"; list.Add(text); return(list.ToArray()); }
// Gets the ragdoll objects and their animation counterparts private void SetupRagdoll() { // Get the two bodies of the ragdoll if it isn't specified already AnimationObject = AnimationObject == null?transform.Find("Animated").gameObject : AnimationObject; PhysicalObject = PhysicalObject == null?transform.Find("Physical").gameObject : PhysicalObject; // Add the pelvis to rigidbodies RagdollRigidbodies.Add(RagdollRoot); // Get ragdoll joints foreach (ConfigurableJoint CJ in PhysicalObject.GetComponentsInChildren <ConfigurableJoint>()) { // Ignore the parent game object colliders if (CJ.gameObject != gameObject) { //C.isTrigger = true; RagdollJoints.Add(CJ); RagdollRigidbodies.Add(CJ.GetComponent <Rigidbody>()); } } // Get animation object corresponding to the physical ragdoll part foreach (Transform Child in AnimationObject.GetComponentsInChildren <Transform>()) { foreach (ConfigurableJoint CJ in RagdollJoints) { if (CJ.gameObject.name == Child.name) { AnimationObjects.Add(Child.gameObject); } } } // Save the inital rotation of the joints foreach (ConfigurableJoint CJ in RagdollJoints) { JointInitialRotation.Add(CJ.transform.rotation); } }
private void IncluirExcluirRegistro(string acao, bool isExcluido) { using (capdeEntities context = new capdeEntities()) { Object objToDel = WichObjectEditing(context); string registro = dataGridView1.CurrentRow.Cells[1].Value.ToString(); if (MessageBox.Show("Deseja " + acao + " o registro " + registro + "?", acao, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (objToDel is RAJ) { CJ cj = context.CJs.Where(x => x.RajId == idEditing && x.CjNome != StringBase.TODOS.ToString() && x.IsExcluido == false) .FirstOrDefault(); if ((cj == null && isExcluido) || !isExcluido) { (objToDel as RAJ).IsExcluido = isExcluido; } else { MessageBox_ExcludeValueImpossible(); } } else if (objToDel is CJ) { Cidade cidade = context.Cidades.Where(x => x.CjId == idEditing && x.NomeCidade != StringBase.TODOS.ToString() && x.IsExcluido == false).FirstOrDefault(); if ((cidade == null && isExcluido) || !isExcluido) { (objToDel as CJ).IsExcluido = isExcluido; } else { MessageBox_ExcludeValueImpossible(); } } else if (objToDel is Cidade) { Setor setor = context.Setors.Where(x => x.CidadeId == idEditing && x.NomeSetor != StringBase.TODOS.ToString() && x.IsExcluido == false).FirstOrDefault(); if ((setor == null && isExcluido) || !isExcluido) { (objToDel as Cidade).IsExcluido = isExcluido; } else { MessageBox_ExcludeValueImpossible(); } } else if (objToDel is Setor) { Pessoa pessoa = context.Pessoas.Where(x => x.SetorId == idEditing && x.IsExcluido == false).FirstOrDefault(); if ((pessoa == null && isExcluido) || !isExcluido) { (objToDel as Setor).IsExcluido = isExcluido; } else { MessageBox_ExcludeValueImpossible(); } } else if (objToDel is Cargo) { Pessoa pessoa = context.Pessoas.Where(x => x.CargoId == idEditing && x.IsExcluido == false).FirstOrDefault(); if ((pessoa == null && isExcluido) || !isExcluido) { (objToDel as Cargo).IsExcluido = isExcluido; } else { MessageBox_ExcludeValueImpossible(); } } else if (objToDel is Turma) { Capacitacao capacitacao = context.Capacitacaos.Where(x => x.TurmaId == idEditing).FirstOrDefault(); if ((capacitacao == null && isExcluido) || !isExcluido) { (objToDel as Turma).IsExcluido = isExcluido; } else { MessageBox_ExcludeValueImpossible(); } } try { common.SaveChanges_Database(context, true); } catch (Exception ex) { commonLog.SendLogError(thisAssemblyVersion.FileVersion, "Incluir / Excluir Registro", ex.Message + "\r\n" + ex.StackTrace, logedUser); } condicaoInicial(formAtual); OutEditing(); } } }
private DataTable VerifyRegistros(DataTable table) { using (capdeEntities context = new capdeEntities()) { foreach (DataRow row in table.Rows) { if (row.RowState != DataRowState.Deleted) { matricula = row[0].ToString(); nome = row[1].ToString(); email = row[2].ToString(); obs = row[8].ToString(); Pessoa pessoa = context.Pessoas.Where(x => x.Registro == matricula).FirstOrDefault(); string rajValue = row[4].ToString(); string cjValue = row[5].ToString(); string cidadeValue = row[6].ToString(); string setorValue = row[7].ToString(); raj = context.RAJs.Where(x => x.NomeRaj == rajValue).FirstOrDefault(); if (raj != null) { cj = context.CJs.Where(x => x.RajId == raj.RajId && x.CjNome == cjValue.ToUpper()).FirstOrDefault(); } if (cj != null && cj.CjNome != null) { cidade = context.Cidades.Where(x => x.CjId == cj.CjId && x.NomeCidade == cidadeValue.ToUpper()).FirstOrDefault(); } if (cidade != null && cidade.NomeCidade != null) { setor = context.Setors.Where(x => x.CidadeId == cidade.CidadeId && x.NomeSetor == setorValue.ToUpper()) .FirstOrDefault(); } string nomeCargo = row[3].ToString(); cargo = context.Cargoes.Where(x => x.NomeCargo == nomeCargo).FirstOrDefault(); if (String.IsNullOrEmpty(matricula)) { row[9] = "Matrícula não pode ser nula"; } else if (pessoa != null) { row[9] = "Matrícula existente. Registro não será cadastrado"; } else if (String.IsNullOrEmpty(nome)) { row[9] = "Nome não pode ser nulo"; } else if (String.IsNullOrEmpty(rajValue)) { row[9] = "RAJ não encontrada"; } else if (cj == null) { row[9] = "CJ não encontrada"; } else if (cidade == null) { row[9] = "Cidade não encontrada"; } else if (setor == null) { row[9] = "Setor não encontrado"; } else if (cargo == null) { row[9] = "Cargo não pode ser nulo"; } } } } btnVerificar.Enabled = true; return(table); }
protected override void GetCompileScriptsClassBody(string namespaceName, LogicClass.CompileScriptsData data) { string text = this.abe; if (this.EntityClassInfo != null) { text = CJ.TypeToCSharpString(this.EntityClassInfo.entityClassType); } data.Strings.Add(string.Format("\t\t{0} __ownerEntity;", text)); data.Strings.Add("\t\t"); data.Strings.Add(string.Format("\t\tpublic {0}( {1} ownerEntity )", base.ClassName, text)); data.Strings.Add("\t\t\t: base( ownerEntity )"); data.Strings.Add("\t\t{"); data.Strings.Add("\t\t\tthis.__ownerEntity = ownerEntity;"); foreach (LogicMethod current in base.Methods) { if (current.IsEntityEventMethod) { string text2 = "\t\t\townerEntity." + current.MethodName + " += "; EventInfo entityEventInfo = current.EntityEventInfo; if (entityEventInfo == null) { Log.Warning("LogicEntityClass: Compilation error: Method \"{0}\" EntityEventInfo = null", current.ToString()); return; } MethodInfo method = entityEventInfo.EventHandlerType.GetMethod("Invoke"); string arg = CJ.TypeToCSharpString(method.GetParameters()[0].ParameterType); text2 += string.Format("delegate( {0} __entity", arg); foreach (LogicParameter current2 in current.Parameters) { string text3 = text2; text2 = string.Concat(new string[] { text3, ", ", CJ.TypeToCSharpString(current2.ParameterType), " ", current2.ParameterName }); } text2 += " ) { "; text2 += "if( Engine.EntitySystem.LogicSystemManager.Instance != null )"; text2 = text2 + current.MethodName + "( "; for (int i = 0; i < current.Parameters.Count; i++) { if (i != 0) { text2 += ", "; } text2 += current.Parameters[i].ParameterName; } text2 += " ); };"; data.Strings.Add(text2); } } data.Strings.Add("\t\t}"); data.Strings.Add("\t\t"); data.Strings.Add(string.Format("\t\tpublic {0} Owner", text)); data.Strings.Add("\t\t{"); data.Strings.Add("\t\t\tget { return __ownerEntity; }"); data.Strings.Add("\t\t}"); data.Strings.Add("\t\t"); base.GetCompileScriptsClassBody(namespaceName, data); }
static void Main(string[] args) { Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.BufferHeight = 8192; Console.BufferWidth = 1024; Console.Clear(); Console.WriteLine("/***********************/"); Console.WriteLine("/*===== Milkshake =====*/"); Console.WriteLine("/***********************/"); Console.WriteLine(); /* LINKSHARE */ //Console.WriteLine("/* Loading Linkshare... */"); /* * Console.WriteLine(); * Linkshare ls = new Linkshare(); * dynamic token = ls.GetAccessToken(); * * Console.WriteLine("Access Token: " + token.access_token); * * ls.LoadAdvertisers(); * * foreach (LinkshareMerchant merc in Linkshare.Merchants) * { * Console.WriteLine(string.Format("Name: {0} MID: {1}", merc.Name, merc.MID)); * } */ //Console.WriteLine("/* Done. */"); //Console.WriteLine(); /* CJ AFFILIATE */ //Console.WriteLine("/* Loading CJ Affiliate... */"); //Console.WriteLine(); // TODO: Load CJ Affiliate //Console.WriteLine("/* Done. */"); //Console.WriteLine(); /* Pepperjam (eBay Enterprise) */ //Console.WriteLine("/* Loading Pepperjam (eBay Enterprise)... */"); //Console.WriteLine(); // TODO: Load Pepperjam //Console.WriteLine("/* Done. */"); // Console.WriteLine(); /* Parsing CJ Affiliate Product Catalogs */ Console.WriteLine("/* Parsing CJ Affiliate Product Catalogs... */"); Console.WriteLine(); CJ cj = new CJ(); if (args.Contains("fresh")) { cj.Reset(); } cj.ParseAll(); Console.WriteLine("Initial files parsed."); Console.WriteLine(); Console.WriteLine("CJ files parsed...press any key to continue"); Console.ReadKey(); /* Parsing LinkShare Affiliate Product Catalogs */ Console.WriteLine("/* Parsing LinkShare Affiliate Product Catalogs... */"); Console.WriteLine(); Linkshare ls = new Linkshare(); if (args.Contains("fresh")) { ls.Reset(); } ls.ParseAll(); Console.WriteLine("Initial files parsed."); Console.WriteLine(); Console.WriteLine("LinkShare files parsed...press any key to continue"); Console.ReadKey(); /* Parsing PepperJam Affiliate Product Catalogs */ Console.WriteLine("/* Parsing Pepperjam (eBay Enterprise) Affiliate Product Catalogs... */"); Console.WriteLine(); Pepperjam pj = new Pepperjam(); if (args.Contains("fresh")) { pj.Reset(); } pj.ParseAll(); Console.WriteLine("Initial files parsed."); Console.WriteLine(); Console.WriteLine("Pepperjam (eBay Enterprise) files parsed...press any key to continue"); Console.ReadKey(); /* Finished */ Console.Write("Watchdog waiting for files...press F4 to close"); while (Console.ReadKey().Key != ConsoleKey.F4) { Thread.Sleep(1); } //Milkshake.Aggregator agg = new Milkshake.Aggregator(); //while (true) //{ // Thread.Sleep(1); //} }