public static string getTenantDatas(string score) { string result = ""; DataTable dtObj = Mydb.ExecuteReadertoDataTable("SELECT OBJECT_ADRESS,OBJECT_ID FROM OBJECT WHERE OBJECT_ID=(select OBJECT_ID from ROOM where ROOM_ID =(select ROOM_ID from PER_SCORE where IS_DELETED=0 and SCORE_ID=@s))", new SqlParameter[] { new SqlParameter("@s", score) }, CommandType.Text); List <ObjectS> os = new List <ObjectS>(); foreach (DataRow item in dtObj.Rows) { ObjectS o = new ObjectS(); o.ObjectAdress = item["OBJECT_ADRESS"].ToString(); o.Object_Id = Convert.ToInt32(item["OBJECT_ID"]); os.Add(o); } JavaScriptSerializer jsObj = new JavaScriptSerializer(); DataTable dt = Mydb.ExecuteReadertoDataTable("select * from IND_NAME where INDIVIDUAL_ID in (select INDIVIDUAL_ID from INDIVIDUAL_PERSCORE where SCORE_ID=@s)", new SqlParameter[] { new SqlParameter("@s", score) }, CommandType.Text); List <AccountDatas> ads = new List <AccountDatas>(); foreach (DataRow item in dt.Rows) { AccountDatas ad = new AccountDatas(); ad.FIRST_NAME = item["FIRST_NAME"].ToString(); ad.PHONE = item["PHONE"].ToString(); ad.SHARE = item["INDIVIDUAL_ID"].ToString(); ads.Add(ad); } JavaScriptSerializer jsad = new JavaScriptSerializer(); result = "{\"result\" : \"Ok\",\"ADatas\":" + jsad.Serialize(ads) + ",\"ObjDatas\":" + jsObj.Serialize(os) + "}"; return(result); }
public static string GetCheckedObjects(int DD, string Cl_Id) { DataTable dt = Mydb.ExecuteReadertoDataTable("select * from OBJECT where ISNULL(IS_DELETED,0)<>1 and CLIENT_ID=@C", new SqlParameter[] { new SqlParameter("@C", Cl_Id) }, CommandType.Text); List <ObjectS> os = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS o = new ObjectS(); int COuntCHecked = (int)Mydb.ExecuteScalar("select COUNT(*) from DISP_OBJECT where DISP_ID=@d and OBJECT_ID=@o", new SqlParameter[] { new SqlParameter("@d", DD), new SqlParameter("@o", Convert.ToInt32(item["OBJECT_ID"])) }, CommandType.Text); if (COuntCHecked == 1) { o.Object_Id = Convert.ToInt32(item["Object_Id"]); o.ObjectAdress = item["OBJECT_ADRESS"].ToString(); o.ObjectPhoto = "1"; } if (COuntCHecked == 0) { int IsOtherDispObj = (int)Mydb.ExecuteScalar("select COUNT(*) from DISP_OBJECT where OBJECT_ID=@o", new SqlParameter[] { new SqlParameter("@o", Convert.ToInt32(item["Object_Id"])) }, CommandType.Text); if (IsOtherDispObj == 0) { o.Object_Id = Convert.ToInt32(item["Object_Id"]); o.ObjectAdress = item["OBJECT_ADRESS"].ToString(); o.ObjectPhoto = "0"; } } os.Add(o); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(os)); }
public string GetStreetsBytext(string txt, string loc) { int prjId = 0; if (loc.Contains("/Fili/LoginF.aspx")) { prjId = 3; } if (loc.Contains("/Symbol/LoginS.aspx")) { prjId = 2; } DataTable dt = Mydb.ExecuteReadertoDataTable("select OBJECT_ID,OBJECT_ADRESS from OBJECT where OBJECT_ADRESS like '%'+@txt+'%' and PROJECT_ID=@prj", new SqlParameter[] { new SqlParameter("@txt", txt), new SqlParameter("prj", prjId) }, CommandType.Text); List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); obj.Object_Id = Convert.ToInt32(item["OBJECT_ID"]); objs.Add(obj); } return(JsonConvert.SerializeObject(objs)); }
public static string GetStreetsBytext(string txt, string score) { DataTable dt = null; if (score == "0") { dt = Mydb.ExecuteReadertoDataTable("select OBJECT_ID,OBJECT_ADRESS from OBJECT where OBJECT_ADRESS like '%'+@txt+'%'", new SqlParameter[] { new SqlParameter("@txt", txt) }, CommandType.Text); } else { dt = Mydb.ExecuteReadertoDataTable("select OBJECT_ID,OBJECT_ADRESS from OBJECT where OBJECT_ID=(select OBJECT_ID from PER_SCORE where SCORE_ID=@score)", new SqlParameter[] { new SqlParameter("@score", score) }, CommandType.Text); } List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); obj.Object_Id = Convert.ToInt32(item["OBJECT_ID"]); objs.Add(obj); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(objs)); }
public static string getObjById(int objId) { System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("select OBJECT_ADRESS from OBJECT where OBJECT_ID=@obj", new SqlParameter[] { new SqlParameter("@obj", objId) }, CommandType.Text); List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); objs.Add(obj); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(objs)); }
public static string GetNotSelObj(int ClId) { DataTable dt = Mydb.ExecuteReadertoDataTable("select o.OBJECT_ID,o.OBJECT_ADRESS from OBJECT o where ISNULL(o.IS_DELETED,0)<>1 and CLIENT_ID=@C and o.OBJECT_ID not in(select OBJECT_ID From DISP_OBJECT)", new SqlParameter[] { new SqlParameter("@C", ClId) }, CommandType.Text); List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.Object_Id = Convert.ToInt32(item["OBJECT_ID"]); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); objs.Add(obj); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(objs)); }
public static string GetObjcurrentdsp(int lg) { DataTable dt = Mydb.ExecuteReadertoDataTable("select OBJECT_ADRESS,OBJECT_ID from OBJECT where OBJECT_ID in (select OBJECT_ID from DISP_OBJECT where DISP_ID in (select DISP_ID from DISP_ACC where LOG_IN_ID =@lg))", new SqlParameter[] { new SqlParameter("@lg", lg) }, CommandType.Text); List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.Object_Id = Convert.ToInt32(item["OBJECT_ID"]); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); objs.Add(obj); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(objs)); }
public static string getObjForman(int cl, int uo) { DataTable dt = Mydb.ExecuteReadertoDataTable("select o.*,mc.NAME from OBJECT o,MAN_COMPANY mc where o.CLIENT_ID=@c and o.MAN_COMP_ID=@uo and o.MAN_COMP_ID=mc.MAN_COMPANY_ID and ISNULL(o.IS_DELETED,0)<>1 order by [OBJECT_ID] desc", new SqlParameter[] { new SqlParameter("@c", cl), new SqlParameter("@uo", uo) }, CommandType.Text); List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.Object_Id = Convert.ToInt32(item["OBJECT_ID"]); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); obj.ObjectPhoto = item["OBJECT_PHOTO"].ToString(); obj.MAN_COMP_NAME = item["NAME"].ToString(); objs.Add(obj); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(objs)); }
public static string GetObjgectForInd(int ind) { System.Data.DataTable dt = Mydb.ExecuteReadertoDataTable("select OBJECT_ID, OBJECT_ADRESS from OBJECT where OBJECT_ID in (select OBJECT_ID from ROOM where ROOM_ID in (select ROOM_ID from PER_SCORE where SCORE_ID in (select SCORE_ID from INDIVIDUAL_PERSCORE where INDIVIDUAL_ID=@ind)))", new SqlParameter[] { new SqlParameter("@ind", ind) }, CommandType.Text); string ROOM_NUMBER = Mydb.ExecuteScalar("(select ROOM_NUMBER from ROOM where ROOM_ID in (select ROOM_ID from PER_SCORE where SCORE_ID in (select SCORE_ID from INDIVIDUAL_PERSCORE where INDIVIDUAL_ID=@ind)))", new SqlParameter[] { new SqlParameter("@ind", ind) }, CommandType.Text).ToString(); List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); obj.ObjectPhoto = ROOM_NUMBER; objs.Add(obj); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(objs)); }
public LobbyState(Game1 game, GraphicsDevice graphicsDevice, ContentManager content) : base(game, graphicsDevice, content) { // mob generation game.defColor = Color.CornflowerBlue; for (int i = 0; i < 50; i++) { ZombieS tmpZ = new ZombieS(_game.textures.Zombie_1, _game._world); tmpZ.RandPos(); _game.zombielist.Add(tmpZ); } for (int i = 0; i < 200; i++) { ObjectS tmpO = new ObjectS(_game.textures.Box_2); Thread.Sleep(20); Random random = new Random(); int x = random.Next(-7400, 7400); int y = random.Next(-1100 * 6, 1100 * 6); //int size = random.Next(5,80); int size = 30; int rotation = random.Next(0, 359); tmpO.body = BodyConstructor.CreateBody(TipTela.Box_2, _game._world, null, size * 0.1f, (float)rotation); tmpO._Size = new Vector2(size * 0.1f, size * 0.1f); tmpO.body.Position = new Vector2(ConvertUnits.ToSimUnits(x), ConvertUnits.ToSimUnits(y)); _game.solidlist.Add(tmpO); } for (int i = 0; i < 20; i++) { СannonS tmpC = new СannonS(_game.textures.Сannon_1, _game.textures.Bullet_Сannon, _game._world); tmpC.body = BodyConstructor.CreateBody(TipTela.Mob_2, _game._world, tmpC, 0.2f); //tmpC.body.Position = new Vector2(15f, 5f*i); tmpC.RandPos(); _game.Cannonlist.Add(tmpC); } //map generation game.defColor = Color.Red; }
public static string GetObjAdr(string Pth) { int ObjId = (int)Mydb.ExecuteScalar("GetObjId", new SqlParameter[] { new SqlParameter("@pth", Pth) }, CommandType.StoredProcedure); DataTable dt = Mydb.ExecuteReadertoDataTable("select o.OBJECT_ADRESS,o.OBJECT_NAME, (a.ACCOUNT_NAME + ' > '+a.PHONE_NUMBER+' > '+a.E_MAIL) as Acc from OBJECT o, ACCOUNT a where o.OBJECT_ID=@oid and o.LOG_IN_ID=a.LOG_IN_ID", new SqlParameter[] { new SqlParameter("@oid", ObjId) }, CommandType.Text); List <ObjectS> objs = new List <ObjectS>(); foreach (DataRow item in dt.Rows) { ObjectS obj = new ObjectS(); obj.ObjectAdress = item["OBJECT_ADRESS"].ToString(); obj.ObjectPhoto = item["OBJECT_NAME"].ToString(); obj.KladrObjectId = item["Acc"].ToString(); obj.Object_Id = ObjId; objs.Add(obj); } JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(objs)); }
public static Body CreateBody(TipTela _type, World _world, ObjectS obj = null, float _Size = 1f, float _Rotation = 0f) { Body body; switch (_type) { case TipTela.Player_1: { Vertices bodyvert = new Vertices(8); bodyvert.Add(ConvertUnits.ToSimUnits(new Vector2(-90, 51)) * _Size); bodyvert.Add(ConvertUnits.ToSimUnits(new Vector2(-59, -49)) * _Size); bodyvert.Add(ConvertUnits.ToSimUnits(new Vector2(22, -104)) * _Size); bodyvert.Add(ConvertUnits.ToSimUnits(new Vector2(60, -63)) * _Size); bodyvert.Add(ConvertUnits.ToSimUnits(new Vector2(86, 4)) * _Size); bodyvert.Add(ConvertUnits.ToSimUnits(new Vector2(77, 81)) * _Size); bodyvert.Add(ConvertUnits.ToSimUnits(new Vector2(9, 105)) * _Size); bodyvert.Add(ConvertUnits.ToSimUnits(new Vector2(-44, 109)) * _Size); PolygonShape playershape = new PolygonShape(bodyvert, 2f); body = BodyFactory.CreateBody(_world); body.CreateFixture(playershape); body.BodyType = BodyType.Dynamic; body.UserData = "Player"; body.Restitution = 0.3f; body.Friction = 0.5f; } break; case TipTela.Player_2: body = null; break; case TipTela.Player_3: body = null; break; case TipTela.Mob_1: { body = BodyFactory.CreateCircle(_world, ConvertUnits.ToSimUnits(obj.texture.Width / 2 * _Size), 0.2f, ConvertUnits.ToSimUnits(new Vector2(0, 0)), BodyType.Dynamic); body.Restitution = 0.3f; body.Friction = 0.5f; body.UserData = "Zombie"; } break; case TipTela.Mob_2: { body = BodyFactory.CreateCircle(_world, ConvertUnits.ToSimUnits(obj.texture.Width / 2 * _Size), 0.01f, ConvertUnits.ToSimUnits(new Vector2(0, 0)), BodyType.Static); body.Restitution = 0.3f; body.Friction = 0.5f; body.UserData = "Cannon"; } break; case TipTela.Mob_3: body = null; break; case TipTela.Box_1: body = null; break; case TipTela.Box_2: { Vertices vertices1 = new Vertices(4); vertices1.Add(ConvertUnits.ToSimUnits(new Vector2(-72, -29)) * _Size); vertices1.Add(ConvertUnits.ToSimUnits(new Vector2(-24, -60)) * _Size); vertices1.Add(ConvertUnits.ToSimUnits(new Vector2(19, -8)) * _Size); vertices1.Add(ConvertUnits.ToSimUnits(new Vector2(-37, 29)) * _Size); Vertices vertices2 = new Vertices(4); vertices2.Add(ConvertUnits.ToSimUnits(new Vector2(56, -14)) * _Size); vertices2.Add(ConvertUnits.ToSimUnits(new Vector2(81, 42)) * _Size); vertices2.Add(ConvertUnits.ToSimUnits(new Vector2(22, 64)) * _Size); vertices2.Add(ConvertUnits.ToSimUnits(new Vector2(-6, 12)) * _Size); List <Vertices> boxlist = new List <Vertices>(2); boxlist.Add(vertices1); boxlist.Add(vertices2); body = BodyFactory.CreateCompoundPolygon(_world, boxlist, 2f); body.BodyType = BodyType.Static; body.UserData = "Box_2"; body.Rotation = _Rotation; } break; case TipTela.Box_3: body = null; break; case TipTela.Box_4: body = null; break; case TipTela.Box_5: body = null; break; case TipTela.Box_6: body = null; break; case TipTela.Bush_1: body = null; break; case TipTela.Bush_2: body = null; break; case TipTela.Bush_3: body = null; break; case TipTela.Tree_1: body = null; break; case TipTela.Tree_2: body = null; break; case TipTela.Tree_3: body = null; break; case TipTela.Brevna: body = null; break; case TipTela.Bullet_1: { body = BodyFactory.CreateCircle(_world, ConvertUnits.ToSimUnits(obj.texture.Width / 2 * _Size), 1000f, ConvertUnits.ToSimUnits(new Vector2(0, 0)), BodyType.Dynamic); body.Restitution = 0f; body.Friction = 0f; body.UserData = "Bullet_1"; } break; default: { body = null; } break; } return(body); }