Пример #1
0
 public void UpdateDealer(Dealer dealer)
 {
     var oldDealer = GetDealer(dealer.Id);
     oldDealer.Name = dealer.Name;
     oldDealer.Description = dealer.Description;
     oldDealer.StateId = dealer.StateId;
     dealerRepo.SaveChanges();
 }
Пример #2
0
 public static DealerModel FromDomainModel(Dealer dealer)
 {
     return new DealerModel {
         Id = dealer.Id,
         Name = dealer.Name,
         Description = dealer.Description,
         State = dealer.State.Name,
         StateId = dealer.StateId
     };
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Dealers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDealers(Dealer dealer)
 {
     base.AddObject("Dealers", dealer);
 }
Пример #4
0
 /// <summary>
 /// Create a new Dealer object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="stateId">Initial value of the StateId property.</param>
 /// <param name="objectInfo">Initial value of the ObjectInfo property.</param>
 public static Dealer CreateDealer(global::System.Int32 id, global::System.String name, global::System.Int32 stateId, ObjectInfo objectInfo)
 {
     Dealer dealer = new Dealer();
     dealer.Id = id;
     dealer.Name = name;
     dealer.StateId = stateId;
     dealer.ObjectInfo = StructuralObject.VerifyComplexObjectIsNotNull(objectInfo, "ObjectInfo");
     return dealer;
 }
Пример #5
0
 public static DealerModel FromDomainModel(Dealer dealer)
 {
     var csmNames = dealer.UserDealerMaps.Select(x => x.User.Name);
     var csmName = "";
     for (int i = 0; i < csmNames.Count(); i++)
     {
         if (i < csmNames.Count() - 1)
             csmName = csmName + csmNames.ElementAt(i) + ",";
         else
         {
             csmName = csmName + csmNames.ElementAt(i);
         }
     }
     return new DealerModel
     {
         Id = dealer.Id,
         Name = dealer.Name,
         Description = dealer.Description,
         State = dealer.State.Name,
         StateId = dealer.StateId,
         Csm = csmName
     };
 }
Пример #6
0
 public static string SaveRetailFile(HttpPostedFileBase httpPostedFileBase, Dealer dealer, Month month, User csm)
 {
     var directory = "/File/" + csm.Name;
     if (string.IsNullOrEmpty(httpPostedFileBase.FileName))
         return string.Empty;
     var ext = httpPostedFileBase.FileName.Split('.').LastOrDefault() ?? "";
     var absoluteDirectory = ConvertToAbsolute(directory);
     if (!Directory.Exists(absoluteDirectory))
         Directory.CreateDirectory(absoluteDirectory);
     var temppath = string.Format("{0}/{1}", directory, string.Format("{0}.{1}", Guid.NewGuid(), ext));
     var absolutepath = ConvertToAbsolute(temppath);
     httpPostedFileBase.SaveAs(absolutepath);
     return temppath;
 }