public async Task CreateElementsAsync() { if (MainSql.UserHasOffice()) { OreOfficeButton.IsVisible = true; } _elements = await StandardElements.CreateAsync(new GetDate()); }
}//右 private void FormMain_Load(object sender, EventArgs e) { PictureBox[,] pb = new PictureBox[11, 11] { { pictureBox1_1, pictureBox1_2, pictureBox1_3, pictureBox1_4, pictureBox1_5, pictureBox1_6, pictureBox1_7, pictureBox1_8, pictureBox1_9, pictureBox1_10, pictureBox1_11 }, { pictureBox2_1, pictureBox2_2, pictureBox2_3, pictureBox2_4, pictureBox2_5, pictureBox2_6, pictureBox2_7, pictureBox2_8, pictureBox2_9, pictureBox2_10, pictureBox2_11 }, { pictureBox3_1, pictureBox3_2, pictureBox3_3, pictureBox3_4, pictureBox3_5, pictureBox3_6, pictureBox3_7, pictureBox3_8, pictureBox3_9, pictureBox3_10, pictureBox3_11 }, { pictureBox4_1, pictureBox4_2, pictureBox4_3, pictureBox4_4, pictureBox4_5, pictureBox4_6, pictureBox4_7, pictureBox4_8, pictureBox4_9, pictureBox4_10, pictureBox4_11 }, { pictureBox5_1, pictureBox5_2, pictureBox5_3, pictureBox5_4, pictureBox5_5, pictureBox5_6, pictureBox5_7, pictureBox5_8, pictureBox5_9, pictureBox5_10, pictureBox5_11 }, { pictureBox6_1, pictureBox6_2, pictureBox6_3, pictureBox6_4, pictureBox6_5, pictureBox6_6, pictureBox6_7, pictureBox6_8, pictureBox6_9, pictureBox6_10, pictureBox6_11 }, { pictureBox7_1, pictureBox7_2, pictureBox7_3, pictureBox7_4, pictureBox7_5, pictureBox7_6, pictureBox7_7, pictureBox7_8, pictureBox7_9, pictureBox7_10, pictureBox7_11 }, { pictureBox8_1, pictureBox8_2, pictureBox8_3, pictureBox8_4, pictureBox8_5, pictureBox8_6, pictureBox8_7, pictureBox8_8, pictureBox8_9, pictureBox8_10, pictureBox8_11 }, { pictureBox9_1, pictureBox9_2, pictureBox9_3, pictureBox9_4, pictureBox9_5, pictureBox9_6, pictureBox9_7, pictureBox9_8, pictureBox9_9, pictureBox9_10, pictureBox9_11 }, { pictureBox10_1, pictureBox10_2, pictureBox10_3, pictureBox10_4, pictureBox10_5, pictureBox10_6, pictureBox10_7, pictureBox10_8, pictureBox10_9, pictureBox10_10, pictureBox10_11 }, { pictureBox11_1, pictureBox11_2, pictureBox11_3, pictureBox11_4, pictureBox11_5, pictureBox11_6, pictureBox11_7, pictureBox11_8, pictureBox11_9, pictureBox11_10, pictureBox11_11 } }; Label[] label = new Label[] { labelChenshu, labelLV, labelShenming, labelGongji, labelFangyu, labelJingyan, labelJingbi, labelKeyYellow, labelKeyBlue, labelKeyRed, labelKeyQin, label3, label11 }; for (int j = 0; j <= 18; j++) { string map = "map" + j; MainSql.mapxytable(j, map); for (int i = 0; i < Int32.Parse(MyMeans.dt.Rows.Count.ToString()); i++) { pb[Int32.Parse(MyMeans.dt.Rows[i][1].ToString()) - 1, Int32.Parse(MyMeans.dt.Rows[i][0].ToString()) - 1].Image = imageList1.Images[j]; } } int uid = User.Id; MyMeans.sqlstr = "select number,lv,life,attack,defense,experience,gold,keyyellow,keyblue,keyred,keyqing,x,y from tb_game where uid ='" + uid + "'"; MyMeans.get_cmd(); if (MyMeans.reader.HasRows) { if (MyMeans.reader.Read()) { for (int m = 0; m < 13; m++) { label[m].Text = MyMeans.reader.GetInt32(m).ToString(); } pictureBoxPeople.Left = pictureBoxPeople.Left + ((People.X - 1) * 45); pictureBoxPeople.Top = pictureBoxPeople.Top - ((People.Y - 1) * 45); MyMeans.cmd_close(); } } else { MessageBox.Show("找不到数据"); MyMeans.cmd_close(); } }
public override string ToString() { return(MainSql.ToLower()); }
public ActionResult PackagesPartialView(ServiceTypeEnum?st, IEnumerable <int> CatID, IEnumerable <int> ActID, int?Gsize, int?diff, int?dur, int?GuideLanguageID, IEnumerable <int> AttractID, IEnumerable <int> FacilityID, decimal?maxPrice, decimal?minPrice, int?NoPax, int?large, int?small, int?hasAc, int?HasCarrier, IEnumerable <int> DestIds, int?IsBike) { string Dests = ""; if (DestIds != null) { Dests = string.Join(",", DestIds.ToArray()); } PetaPoco.Sql MainSql = new PetaPoco.Sql(); PetaPoco.Sql FromSql = new PetaPoco.Sql(); PetaPoco.Sql WhereSql = new PetaPoco.Sql(); ViewBag.st = st; if (st == ServiceTypeEnum.Accomodation) { ViewBag.ServiceTitle = "Accomodations"; MainSql = new PetaPoco.Sql(" Select Count(rv.ReviewID) as TotalReview,Avg(rv.Value) as AvgReview,a.AccomodationID as ServiceId,@0 as ServiceTypeId, " + "a.AccomName as ServiceName, substring(a.Description, 0, 100) + '...' as ServiceDescription," + "g.geoName as ServiceGeoName, min(pr.price) as price ", (int)ServiceTypeEnum.Accomodation); FromSql = new PetaPoco.Sql("from Accomodation a left join Review rv on rv.ServiceID = a.AccomodationID " + $"left join GeoTree g on a.geoTreeId = g.GeoTreeId and a.GeoTreeID in (SELECT GeoTreeID FROM STRING_SPLIT('{Dests}', ',') CROSS APPLY dbo.GetChildGeos(value))" + "left join Prices pr on pr.PriceID = (select top 1 PriceID from Prices where a.AccomodationID = Prices.ServiceID and Prices.WEF < GetDate() order by Prices.WEF desc) " + "left join OptionType ot on ot.OptionTypeID = pr.OptionTypeID " + "left join Facility_Accomodation fa on a.AccomodationID = fa.AccomodationID " + "left join Facility f on f.FacilityID = fa.FacilityID "); WhereSql = new PetaPoco.Sql($"where ot.ServiceTypeID=@0 ", ServiceTypeEnum.Accomodation); if (maxPrice != null && minPrice != null) { WhereSql.Append(" and Price Between @0 and @1", minPrice, maxPrice); } if (FacilityID != null) { WhereSql.Append(" and fa.FacilityID in (@0)", FacilityID.ToArray()); } MainSql.Append(FromSql); MainSql.Append(WhereSql); MainSql.Append(" Group by a.AccomodationID, a.AccomName, [Description], g.geoName "); var accom = db.Query <AccomodationDets>(MainSql); accom = accom.OrderBy(a => a.AccomName); } if (st == ServiceTypeEnum.CarBike) { ViewBag.ServiceTitle = "Car And Bikes Rental"; MainSql = new PetaPoco.Sql("Select Count(rv.ReviewID) as TotalReview,Avg(rv.Value) as AvgReview,[CarBikeID] as ServiceId, [CarBikeName] as ServiceName,@0 as ServiceTypeId, g.geoName as ServiceGeoName, " + "substring(description, 0, 100) + '...' as ServiceDescription, min(pr.price) as price ", (int)ServiceTypeEnum.CarBike); FromSql = new PetaPoco.Sql("From CarBike c left join Review rv on rv.ServiceID = c.CarBikeID " + "left join GeoTree g on c.geoTreeId=c.GeoTreeId " + "left join Prices pr on pr.PriceID = (select top 1 PriceID from Prices where c.CarBikeID = Prices.ServiceID " + "and Prices.WEF < GetDate() order by Prices.WEF desc) " + "left join OptionType ot on ot.OptionTypeID = pr.OptionTypeID "); WhereSql = new PetaPoco.Sql($"where ot.ServiceTypeID=@0 and c.GeoTreeID in (SELECT GeoTreeID " + $"FROM STRING_SPLIT('{Dests}', ',') CROSS APPLY dbo.GetChildGeos(value)) ", ServiceTypeEnum.CarBike); if (maxPrice != null && minPrice != null) { WhereSql.Append(" and Price Between @0 and @1 ", minPrice, maxPrice); } if (NoPax != null) { WhereSql.Append(" and c.NoPax<=@0", NoPax); } if (large != null) { WhereSql.Append(" and c.NoLargeBags<=@0", large); } if (small != null) { WhereSql.Append(" and c.NoSmallBags<=@0", small); } if (hasAc != null) { WhereSql.Append(" and c.HasAc=@0", hasAc); } if (HasCarrier != null) { WhereSql.Append(" and c.Hascarrier=@0", HasCarrier); } if (IsBike != null) { WhereSql.Append(" and c.IsBike=@0", IsBike); } MainSql.Append(FromSql); MainSql.Append(WhereSql); MainSql.Append(" Group by c.CarBikeID, c.CarBikeName, [Description], g.geoName "); } if (st == ServiceTypeEnum.Packages || st == ServiceTypeEnum.SightSeeing || st == ServiceTypeEnum.Cruise) { ViewBag.ServiceTitle = "Our Best Tours And Excursions"; MainSql = new PetaPoco.Sql("Select Count(rv.ReviewID) as TotalReview,Avg(rv.Value) as AvgReview," + " pv.PackageID as ServiceId,pv.ServiceTypeID ,pv.PackageName as ServiceName, " + "substring(pv.Description, 0, 100) + '...' as ServiceDescription, min(coalesce(pr.price, 0)) as price "); FromSql = new PetaPoco.Sql("from Package pv left join Review rv on rv.ServiceID = pv.PackageID " + "left join Prices pr on pr.PriceID = (select top 1 PriceID from Prices " + "where pv.PackageID = Prices.ServiceID and Prices.WEF < GetDate() order by Prices.WEF desc) " + "left join OptionType ot on ot.OptionTypeID = pr.OptionTypeID " + "left join Package_Category pc on pc.PackageID = pv.PackageID " + "left join Category c on c.CategoryID = pc.CategoryID " + "left join Package_Activity pa on pa.PackageID = pv.PackageID " + "left join Activity a on a.ActivityID = pa.ActivityID " + "left join Package_Attraction pat on pat.PackageID = pv.PackageID " + "left join Attraaction at on at.AttractionID = pat.AttractionID " + "left join Package_Language pl on pl.PackageId = pv.PackageID " + "left join GuideLanguage gl on gl.GuideLanguageID = pl.GuideLanguageId " + "left join Package_GeoTree pg on pg.PackageID = pv.PackageID"); WhereSql = new PetaPoco.Sql(" where pv.ServiceTypeID=@0", (int)st); //WhereSql.Append(" and p.PackageID = pr.ServiceID and ot.OptionTypeID = pr.OptionTypeID and pr.PriceID = (select top 1 PriceID from Prices where p.PackageID = Prices.ServiceID and ot.OptionTypeID = Prices.OptionTypeID and Prices.WEF<GetDate() order by Prices.WEF desc) "); if (maxPrice != null && minPrice != null) { WhereSql.Append(" and Price Between @0 and @1 ", minPrice, maxPrice); } if (CatID != null) { WhereSql.Append(" and pc.CategoryID in (@0)", CatID.ToArray()); } if (ActID != null) { WhereSql.Append(" and pa.ActivityID in (@0)", ActID.ToArray()); } if (AttractID != null) { WhereSql.Append(" and pat.AttractionID in (@0)", AttractID.ToArray()); } if (Gsize != null) { WhereSql.Append(" and pv.GroupSize <= @0", Gsize); } if (diff != null) { WhereSql.Append(" and pv.Dificulty <= @0", diff); } if (dur != null) { WhereSql.Append(" and pv.Duration <= @0", dur); } if (GuideLanguageID != null) { WhereSql.Append(" and pl.GuideLanguageId =@0 ", GuideLanguageID); } //Filter for destination WhereSql.Append($" and pg.GeoTreeId in (SELECT GeoTreeID FROM STRING_SPLIT('{Dests}', ',') CROSS APPLY dbo.GetChildGeos(value))"); MainSql.Append(FromSql); MainSql.Append(WhereSql); MainSql.Append(" Group by pv.PackageID, pv.ServiceTypeID,pv.PackageName, pv.[Description] "); } MainSql.Append(" order by min(pr.price)"); var apc = db.Fetch <AccomPackCarBike>(MainSql); foreach (var i in apc) { i.ServicePic = db.FirstOrDefault <PictureDets>("Select Top 1 * From Picture Where ServiceID=@0 and ServiceTypeID=@1", i.ServiceID, i.ServiceTypeID)?.PictureName ?? ""; if (string.IsNullOrWhiteSpace(i.ServiceGeoName)) { i.ServiceGeoName = db.First <string>("Select GeoName From GeoTree g,Package_GeoTree pg where pg.PackageID=@0 and g.GeoTreeID = pg.GeoTreeID", i.ServiceID); } i.Attributes = db.Fetch <Attribute>("Select * from Attribute a, Package_attribute pa where a.attributeID=pa.attributeID and pa.packageID=@0 and pa.serviceTypeId=@1", i.ServiceID, i.ServiceTypeID); i.Icons = db.Fetch <string>("select IconPath from Icons where ServiceId=@0 and ServiceTypeId=@1", i.ServiceID, i.ServiceTypeID); } return(PartialView(apc)); }
}//左 private void buttonRight_Click(object sender, EventArgs e) //右 { PictureBox[,] pb = new PictureBox[11, 11] { { pictureBox1_1, pictureBox1_2, pictureBox1_3, pictureBox1_4, pictureBox1_5, pictureBox1_6, pictureBox1_7, pictureBox1_8, pictureBox1_9, pictureBox1_10, pictureBox1_11 }, { pictureBox2_1, pictureBox2_2, pictureBox2_3, pictureBox2_4, pictureBox2_5, pictureBox2_6, pictureBox2_7, pictureBox2_8, pictureBox2_9, pictureBox2_10, pictureBox2_11 }, { pictureBox3_1, pictureBox3_2, pictureBox3_3, pictureBox3_4, pictureBox3_5, pictureBox3_6, pictureBox3_7, pictureBox3_8, pictureBox3_9, pictureBox3_10, pictureBox3_11 }, { pictureBox4_1, pictureBox4_2, pictureBox4_3, pictureBox4_4, pictureBox4_5, pictureBox4_6, pictureBox4_7, pictureBox4_8, pictureBox4_9, pictureBox4_10, pictureBox4_11 }, { pictureBox5_1, pictureBox5_2, pictureBox5_3, pictureBox5_4, pictureBox5_5, pictureBox5_6, pictureBox5_7, pictureBox5_8, pictureBox5_9, pictureBox5_10, pictureBox5_11 }, { pictureBox6_1, pictureBox6_2, pictureBox6_3, pictureBox6_4, pictureBox6_5, pictureBox6_6, pictureBox6_7, pictureBox6_8, pictureBox6_9, pictureBox6_10, pictureBox6_11 }, { pictureBox7_1, pictureBox7_2, pictureBox7_3, pictureBox7_4, pictureBox7_5, pictureBox7_6, pictureBox7_7, pictureBox7_8, pictureBox7_9, pictureBox7_10, pictureBox7_11 }, { pictureBox8_1, pictureBox8_2, pictureBox8_3, pictureBox8_4, pictureBox8_5, pictureBox8_6, pictureBox8_7, pictureBox8_8, pictureBox8_9, pictureBox8_10, pictureBox8_11 }, { pictureBox9_1, pictureBox9_2, pictureBox9_3, pictureBox9_4, pictureBox9_5, pictureBox9_6, pictureBox9_7, pictureBox9_8, pictureBox9_9, pictureBox9_10, pictureBox9_11 }, { pictureBox10_1, pictureBox10_2, pictureBox10_3, pictureBox10_4, pictureBox10_5, pictureBox10_6, pictureBox10_7, pictureBox10_8, pictureBox10_9, pictureBox10_10, pictureBox10_11 }, { pictureBox11_1, pictureBox11_2, pictureBox11_3, pictureBox11_4, pictureBox11_5, pictureBox11_6, pictureBox11_7, pictureBox11_8, pictureBox11_9, pictureBox11_10, pictureBox11_11 } }; Label[] lb = new Label[4] { labelKeyYellow, labelKeyBlue, labelKeyRed, labelKeyQin }; int x = People.X + 1; MainSql.mapxy(18, x, People.Y); MyMeans.reader.Read(); if (Int32.Parse(labelShenming.Text) > 0) //生命大于0 { pb[People.Y - 1, People.X - 1].Image = imageList1.Images[15]; for (int j = 0; j < 15; j++) { string map = "map" + j; MainSql.mapxytable(j, map); for (int i = 0; i < Int32.Parse(MyMeans.dt.Rows.Count.ToString()); i++) { if (People.X + 1 == Int32.Parse(MyMeans.dt.Rows[i][0].ToString()) & People.Y == Int32.Parse(MyMeans.dt.Rows[i][1].ToString())) { if (Count.Cs[People.Y - 1, People.X - 1] == 0) { if (j < 11) { labelShenming.Text = (Int32.Parse(labelShenming.Text) + ClassShuXing.Sx[j, 0]).ToString(); labelGongji.Text = (Int32.Parse(labelGongji.Text) + ClassShuXing.Sx[j, 1]).ToString(); labelFangyu.Text = (Int32.Parse(labelFangyu.Text) + ClassShuXing.Sx[j, 2]).ToString(); labelJingyan.Text = (Int32.Parse(labelJingyan.Text) + ClassShuXing.Sx[j, 3]).ToString(); labelJingbi.Text = (Int32.Parse(labelJingbi.Text) + ClassShuXing.Sx[j, 4]).ToString(); labelKeyYellow.Text = (Int32.Parse(labelKeyYellow.Text) + ClassShuXing.Sx[j, 5]).ToString(); labelKeyBlue.Text = (Int32.Parse(labelKeyBlue.Text) + ClassShuXing.Sx[j, 6]).ToString(); labelKeyRed.Text = (Int32.Parse(labelKeyRed.Text) + ClassShuXing.Sx[j, 7]).ToString(); labelKeyQin.Text = (Int32.Parse(labelKeyQin.Text) + ClassShuXing.Sx[j, 8]).ToString(); Count.Cs[People.Y - 1, People.X - 1] = 1; } else { if (Int32.Parse(lb[j - 11].Text) > 0) { labelShenming.Text = (Int32.Parse(labelShenming.Text) + ClassShuXing.Sx[j, 0]).ToString(); labelGongji.Text = (Int32.Parse(labelGongji.Text) + ClassShuXing.Sx[j, 1]).ToString(); labelFangyu.Text = (Int32.Parse(labelFangyu.Text) + ClassShuXing.Sx[j, 2]).ToString(); labelJingyan.Text = (Int32.Parse(labelJingyan.Text) + ClassShuXing.Sx[j, 3]).ToString(); labelJingbi.Text = (Int32.Parse(labelJingbi.Text) + ClassShuXing.Sx[j, 4]).ToString(); labelKeyYellow.Text = (Int32.Parse(labelKeyYellow.Text) + ClassShuXing.Sx[j, 5]).ToString(); labelKeyBlue.Text = (Int32.Parse(labelKeyBlue.Text) + ClassShuXing.Sx[j, 6]).ToString(); labelKeyRed.Text = (Int32.Parse(labelKeyRed.Text) + ClassShuXing.Sx[j, 7]).ToString(); labelKeyQin.Text = (Int32.Parse(labelKeyQin.Text) + ClassShuXing.Sx[j, 8]).ToString(); Count.Cs[People.Y - 1, People.X - 1] = 1; } else { MessageBox.Show("没有钥匙"); People.X = People.X - 1; pictureBoxPeople.Left = pictureBoxPeople.Left - 45; } } } } } } if (People.X + 1 >= 12) //不能超过右边界 { } else { if (MyMeans.reader.HasRows) //不能通过墙 { MyMeans.cmd_close(); } else { People.X = People.X + 1; pictureBoxPeople.Left = pictureBoxPeople.Left + 45; } } } else { MessageBox.Show("game over"); } label3.Text = People.X.ToString(); label11.Text = People.Y.ToString(); }//右