Inheritance: System.Data.Objects.DataClasses.EntityObject
コード例 #1
0
 private Automobile InitAutomobile(Automobile auto, string vin, string chassisNumber, string engineNumber,
     int? engineCub, string make, string model, DateTime? makeYear, string owner, string phoneNumber,
     string colour, string description)
 {
     auto.Vin = vin;
     auto.ChassisNumber = chassisNumber;
     auto.EngineNumber = engineNumber;
     auto.EngineCub = engineCub;
     auto.MakeYear = makeYear;
     auto.Make = string.IsNullOrEmpty(make) ? null : make;
     auto.Model = string.IsNullOrEmpty(model) ? null : model;
     auto.Owner = string.IsNullOrEmpty(owner) ? null : owner;
     auto.PhoneNumber = string.IsNullOrEmpty(phoneNumber) ? null : phoneNumber;
     auto.Colour = string.IsNullOrEmpty(colour) ? null : colour;
     auto.Description = string.IsNullOrEmpty(description) ? null : description;
     return auto;
 }
コード例 #2
0
 private void LoadAutomobileInformation(Automobile auto)
 {
     this.AutoVin.Text = auto.Vin;
     this.AutoChassisNumber.Text = auto.ChassisNumber;
     this.AutoEngineNumber.Text = auto.EngineNumber;
     this.AutoEngineCub.Text = auto.EngineCub.ToString();
     this.AutoMake.Text = auto.Make;
     this.AutoModel.Text = auto.Model;
     DateTime? makeYear = auto.MakeYear;
     string makeYearTxt = string.Empty;
     if (makeYear.HasValue)
     {
         CultureInfo cultureInfo = new CultureInfo(CarServiceConstants.ENGLISH_CULTURE_INFO);
         makeYearTxt = makeYear.Value.ToString(CarServiceConstants.DATE_FORMAT, cultureInfo);
     }
     this.AutoMakeYearCalendar.SelectedDate = makeYearTxt;
     this.AutoColour.Text = auto.Colour;
     this.AutoDescription.Text = auto.Description;
     this.AutoOwner.Text = auto.Owner;
     this.AutoPhoneNumber.Text = auto.PhoneNumber;
 }
コード例 #3
0
 private void UpdateRepairCard(RepairCard repairCard, Automobile automobile, DateTime? finishRepairDate, 
     string description, decimal sparePartsPrice, decimal repairPrice, ListItemCollection sparePartItems)
 {
     repairCard.Automobile = automobile;
     repairCard.Description = (string.IsNullOrEmpty(description) ? null : description);
     repairCard.FinishRepair = finishRepairDate;
     repairCard.PartPrice = sparePartsPrice;
     repairCard.CardPrice = repairPrice;
     CarServicePresentationUtility.AddSpareParts(repairCard, sparePartItems, this.persister);
     this.persister.SaveChanges();
 }
コード例 #4
0
 private bool SaveAutomobile(Automobile auto, string vin, string chassisNumber, string engineNumber,
     int? engineCub, string make, string model, DateTime? makeYear, string owner, string phoneNumber,
     string colour, string description)
 {
     if (auto == null)
     {
         auto = new Automobile();
         auto = InitAutomobile(auto, vin, chassisNumber, engineNumber, engineCub, make, model, makeYear, owner, phoneNumber, colour, description);
         this.persister.CreateAutomobile(auto);
     }
     else
     {
         auto = InitAutomobile(auto, vin, chassisNumber, engineNumber, engineCub, make, model, makeYear, owner, phoneNumber, colour, description);
     }
     this.persister.SaveChanges();
     return true;
 }
コード例 #5
0
 private void SaveRepairCard(Automobile automobile, DateTime startRepairDate, string description, 
     decimal sparePartsPrice, decimal repairPrice, ListItemCollection sparePartItems)
 {
     MembershipUser currentUser = Membership.GetUser();
     RepairCard newRepairCard = new RepairCard()
     {
         Automobile = automobile,
         UserId = ((System.Guid)currentUser.ProviderUserKey),
         StartRepair = startRepairDate,
         Description = (string.IsNullOrEmpty(description) ? null : description),
         PartPrice = sparePartsPrice,
         CardPrice = repairPrice
     };
     CarServicePresentationUtility.AddSpareParts(newRepairCard, sparePartItems, this.persister);
     this.persister.CreateRepairCard(newRepairCard);
     this.persister.SaveChanges();
 }
コード例 #6
0
 public void DeleteAutomobile(Automobile automobile)
 {
     this.carServiceEntities.Automobiles.DeleteObject(automobile);
 }
コード例 #7
0
 public void CreateAutomobile(Automobile automobile)
 {
     this.carServiceEntities.Automobiles.AddObject(automobile);
 }
コード例 #8
0
 /// <summary>
 /// Create a new Automobile object.
 /// </summary>
 /// <param name="automobileId">Initial value of the AutomobileId property.</param>
 /// <param name="vin">Initial value of the Vin property.</param>
 /// <param name="chassisNumber">Initial value of the ChassisNumber property.</param>
 /// <param name="engineNumber">Initial value of the EngineNumber property.</param>
 public static Automobile CreateAutomobile(global::System.Int32 automobileId, global::System.String vin, global::System.String chassisNumber, global::System.String engineNumber)
 {
     Automobile automobile = new Automobile();
     automobile.AutomobileId = automobileId;
     automobile.Vin = vin;
     automobile.ChassisNumber = chassisNumber;
     automobile.EngineNumber = engineNumber;
     return automobile;
 }
コード例 #9
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Automobiles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAutomobiles(Automobile automobile)
 {
     base.AddObject("Automobiles", automobile);
 }