Exemplo n.º 1
0
 private void BT_AddVersion_Click(object sender, EventArgs e)
 {
     if (List_VersionInfo.Where(P => P.Version_Name == TB_Name.Text && P.Shop_ID == ShopID).Count() != 0)
     {
         MessageBox.Show("已经存在此种车型!");
         return;
     }
     //判断选择框都不为空
     if (TB_BaseKM.IsEmpty() &&
         TB_Count.IsEmpty() &&
         TB_Name.IsEmpty() &&
         TB_Person.IsEmpty() &&
         TB_PriceOver.IsEmpty() &&
         TB_PriceMemberCatch.IsEmpty() &&
         TB_PriceMemberRental.IsEmpty() &&
         TB_PriceNormalCatch.IsEmpty() &&
         TB_PriceNormalRental.IsEmpty() &&
         TB_PriceOverRiding.IsEmpty() &&
         TB_PriceRiding.IsEmpty() &&
         TB_PriceDeposit.IsEmpty() &&
         CB_Brand.SelectedIndex > 0 &&
         CB_Type.SelectedIndex > 0
         )
     {
         if (Version_Client.AddVersion(new VersionService.Car_Version()
         {
             Version_Shop = ShopID,
             Version_BaseKM = Convert.ToInt32(TB_BaseKM.Text),
             Version_Brand = List_Brand.Where(P => P.Brand_Name == CB_Brand.SelectedItem.ToString()).Single().Brand_ID,
             Version_Count = Convert.ToInt32(TB_Count.Text),
             Version_IMG = imgString,
             Version_Info = TB_Info.Text,
             Version_Name = TB_Name.Text,
             Version_Type = List_Type.Where(P => P.Type_Name == CB_Type.SelectedItem.ToString()).Single().Type_ID,
             Version_Person = Convert.ToInt32(TB_Person.Text),
             Version_Price_Deposit = Convert.ToDecimal(TB_PriceDeposit.Text),
             Version_Price_Member_Catch = Convert.ToDecimal(TB_PriceMemberCatch.Text),
             Version_Price_Member_Rental = Convert.ToDecimal(TB_PriceMemberRental.Text),
             Version_Price_Normal_Catch = Convert.ToDecimal(TB_PriceNormalCatch.Text),
             Version_Price_Normal_Rental = Convert.ToDecimal(TB_PriceNormalRental.Text),
             Version_Price_Over = Convert.ToDecimal(TB_PriceOver.Text),
             Version_Price_Over_Riding = Convert.ToDecimal(TB_PriceOverRiding.Text),
             Version_Price_Riding = Convert.ToDecimal(TB_PriceRiding.Text),
         }
                                       ))
         {
             MessageBox.Show("添加车型成功!");
             List_VersionInfo = CarSummery_Client.SelectAllCar().ToList();
             LB_VersionBind();
         }
         else
         {
             MessageBox.Show("添加车型失败,请检查拼写,如错误依旧,请联系管理员!", "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         }
     }
 }
Exemplo n.º 2
0
 private void BT_UpdateVersion_Click(object sender, EventArgs e)
 {
     if (LB_Version.SelectedIndex < 0)
     {
         MessageBox.Show("您想要修改神马!!");
     }
     if (TB_BaseKM.IsEmpty() &&
         TB_Count.IsEmpty() &&
         TB_Name.IsEmpty() &&
         TB_Person.IsEmpty() &&
         TB_PriceOver.IsEmpty() &&
         TB_PriceMemberCatch.IsEmpty() &&
         TB_PriceMemberRental.IsEmpty() &&
         TB_PriceNormalCatch.IsEmpty() &&
         TB_PriceNormalRental.IsEmpty() &&
         TB_PriceOverRiding.IsEmpty() &&
         TB_PriceRiding.IsEmpty() &&
         TB_PriceDeposit.IsEmpty() &&
         CB_Brand.SelectedIndex > 0 &&
         CB_Type.SelectedIndex > 0
         )
     {
         List <Car_ViewModel> List_Temp = List_VersionInfo.Where(
             P => P.Province_Name == CB_Province.SelectedItem.ToString() &&
             P.City_Name == CB_City.SelectedItem.ToString() &&
             P.Shop_Name == CB_Shop.SelectedItem.ToString()
             ).ToList();
         List <WFpart.ShopService.Car_Shop> Temp = List_Shop.Where(
             P => P.Shop_City == List_City.Where(
                 T => T.City_Name == CB_City.SelectedItem.ToString() &&
                 T.City_Province == List_Car_Province.Where(
                     K => K.Province_Name == CB_Province.SelectedItem.ToString()).Single().Province_ID).Single().City_ID
             ).ToList();
         if (Version_Client.UpdateVersion(new VersionService.Car_Version()
         {
             Version_ID = List_Temp.Where(P => P.Version_Name == LB_Version.SelectedItem.ToString()).Single().Version_ID,
             Version_Shop = Temp.Where(P => P.Shop_Name == CB_Shop.SelectedItem.ToString()).Single().Shop_ID,
             Version_BaseKM = Convert.ToInt32(TB_BaseKM.Text),
             Version_Brand = List_Brand.Where(P => P.Brand_Name == CB_Brand.SelectedItem.ToString()).Single().Brand_ID,
             Version_Count = Convert.ToInt32(TB_Count.Text),
             Version_IMG = imgString,
             Version_Info = TB_Info.Text,
             Version_Name = TB_Name.Text,
             Version_Type = List_Type.Where(P => P.Type_Name == CB_Type.SelectedItem.ToString()).Single().Type_ID,
             Version_Person = Convert.ToInt32(TB_Person.Text),
             Version_Price_Deposit = Convert.ToDecimal(TB_PriceDeposit.Text),
             Version_Price_Member_Catch = Convert.ToDecimal(TB_PriceMemberCatch.Text),
             Version_Price_Member_Rental = Convert.ToDecimal(TB_PriceMemberRental.Text),
             Version_Price_Normal_Catch = Convert.ToDecimal(TB_PriceNormalCatch.Text),
             Version_Price_Normal_Rental = Convert.ToDecimal(TB_PriceNormalRental.Text),
             Version_Price_Over = Convert.ToDecimal(TB_PriceOver.Text),
             Version_Price_Over_Riding = Convert.ToDecimal(TB_PriceOverRiding.Text),
             Version_Price_Riding = Convert.ToDecimal(TB_PriceRiding.Text)
         }))
         {
             MessageBox.Show("修改车型成功!");
             List_VersionInfo = CarSummery_Client.SelectAllCar().ToList();
             LB_VersionBind();
         }
         else
         {
             MessageBox.Show("修改车型失败,请检查拼写,如错误依旧,请联系管理员!", "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         }
     }
 }