public AccountCreateViewModel(Account bo)
 {
     this.Id = bo.Id;
     this.CompanyId = bo.CompanyId;
     this.SOBId = bo.SOBId;
     this.SegmentChar1 = bo.SegmentChar1;
     this.SegmentChar2 = bo.SegmentChar2;
     this.SegmentChar3 = bo.SegmentChar3;
     this.SegmentChar4 = bo.SegmentChar4;
     this.SegmentChar5 = bo.SegmentChar5;
     this.SegmentChar6 = bo.SegmentChar6;
     this.SegmentChar7 = bo.SegmentChar7;
     this.SegmentChar8 = bo.SegmentChar8;
     this.SegmentEnabled1 = bo.SegmentEnabled1 ?? false;
     this.SegmentEnabled2 = bo.SegmentEnabled2 ?? false;
     this.SegmentEnabled3 = bo.SegmentEnabled3 ?? false;
     this.SegmentEnabled4 = bo.SegmentEnabled4 ?? false;
     this.SegmentEnabled5 = bo.SegmentEnabled5 ?? false;
     this.SegmentEnabled6 = bo.SegmentEnabled6 ?? false;
     this.SegmentEnabled7 = bo.SegmentEnabled7 ?? false;
     this.SegmentEnabled8 = bo.SegmentEnabled8 ?? false;
     this.SegmentName1 = bo.SegmentName1;
     this.SegmentName2 = bo.SegmentName2;
     this.SegmentName3 = bo.SegmentName3;
     this.SegmentName4 = bo.SegmentName4;
     this.SegmentName5 = bo.SegmentName5;
     this.SegmentName6 = bo.SegmentName6;
     this.SegmentName7 = bo.SegmentName7;
     this.SegmentName8 = bo.SegmentName8;
     this.CreateBy = bo.CreateBy;
     this.CreateDate = bo.CreateDate;
     this.UpdateBy = bo.UpdateBy;
     this.UpdateDate = bo.UpdateDate;
 }
 public string Update(Account entity)
 {
     var originalEntity = this.Context.Accounts.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id.ToString();
 }
Exemplo n.º 3
0
        private static Account getEntityByModel(AccountCreateViewModel model)
        {
            if (model == null) return null;

            Account entity = new Account();
            entity.Id = model.Id;
            entity.SegmentChar1 = model.SegmentChar1;
            entity.SegmentChar2 = model.SegmentChar2;
            entity.SegmentChar3 = model.SegmentChar3;
            entity.SegmentChar4 = model.SegmentChar4;
            entity.SegmentChar5 = model.SegmentChar5;
            entity.SegmentChar6 = model.SegmentChar6;
            entity.SegmentChar7 = model.SegmentChar7;
            entity.SegmentChar8 = model.SegmentChar8;
            entity.SegmentEnabled1 = model.SegmentEnabled1;
            entity.SegmentEnabled2 = model.SegmentEnabled2;
            entity.SegmentEnabled3 = model.SegmentEnabled3;
            entity.SegmentEnabled4 = model.SegmentEnabled4;
            entity.SegmentEnabled5 = model.SegmentEnabled5;
            entity.SegmentEnabled6 = model.SegmentEnabled6;
            entity.SegmentEnabled7 = model.SegmentEnabled7;
            entity.SegmentEnabled8 = model.SegmentEnabled8;
            entity.SegmentName1 = model.SegmentName1;
            entity.SegmentName2 = model.SegmentName2;
            entity.SegmentName3 = model.SegmentName3;
            entity.SegmentName4 = model.SegmentName4;
            entity.SegmentName5 = model.SegmentName5;
            entity.SegmentName6 = model.SegmentName6;
            entity.SegmentName7 = model.SegmentName7;
            entity.SegmentName8 = model.SegmentName8;
            entity.SOBId = model.SOBId;
            if (model.Id == 0)
            {
                entity.CompanyId = AuthenticationHelper.CompanyId.Value;
                entity.CreateBy = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CompanyId = model.CompanyId;
                entity.CreateBy = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }
            entity.UpdateDate = DateTime.Now;
            return entity;
        }
Exemplo n.º 4
0
 public static int? GetSegmentCharacters(string segment, Account account)
 {
     if (segment == account.SegmentName1)
     {
         return account.SegmentChar1;
     }
     else if (segment == account.SegmentName2)
     {
         return account.SegmentChar2;
     }
     else if (segment == account.SegmentName3)
     {
         return account.SegmentChar3;
     }
     else if (segment == account.SegmentName4)
     {
         return account.SegmentChar4;
     }
     else if (segment == account.SegmentName5)
     {
         return account.SegmentChar5;
     }
     else if (segment == account.SegmentName6)
     {
         return account.SegmentChar6;
     }
     else if (segment == account.SegmentName7)
     {
         return account.SegmentChar7;
     }
     else if (segment == account.SegmentName8)
     {
         return account.SegmentChar8;
     }
     else
     {
         return 0;
     }
 }
        private AccountView GetAccountViewByAccountEntity(Account entity)
        {
            if (entity == null) return null;

            AccountView mappingObject = new AccountView();
            mappingObject.Id = entity.Id;
            mappingObject.SOBId = entity.SOBId;
            mappingObject.SOBName = this.Context.SetOfBooks.Where(x => x.Id == entity.SOBId).Select(x => x.Name).FirstOrDefault();
            mappingObject.Segments = Utility.Stringize("-", 
                Convert.ToBoolean(entity.SegmentEnabled1) ? entity.SegmentName1 : "",
                Convert.ToBoolean(entity.SegmentEnabled2) ? entity.SegmentName2 : "", 
                Convert.ToBoolean(entity.SegmentEnabled3) ? entity.SegmentName3 : "", 
                Convert.ToBoolean(entity.SegmentEnabled4) ? entity.SegmentName4 : "", 
                Convert.ToBoolean(entity.SegmentEnabled5) ? entity.SegmentName5 : "", 
                Convert.ToBoolean(entity.SegmentEnabled6) ? entity.SegmentName6 : "", 
                Convert.ToBoolean(entity.SegmentEnabled7) ? entity.SegmentName7 : "",
                Convert.ToBoolean(entity.SegmentEnabled8) ? entity.SegmentName8 : "");
            mappingObject.SegmentsLength = Utility.Stringize("-", 
                Convert.ToBoolean(entity.SegmentEnabled1) ? entity.SegmentChar1 : (int?)null,
                Convert.ToBoolean(entity.SegmentEnabled2) ? entity.SegmentChar2 : (int?)null,
                Convert.ToBoolean(entity.SegmentEnabled3) ? entity.SegmentChar3 : (int?)null,
                Convert.ToBoolean(entity.SegmentEnabled4) ? entity.SegmentChar4 : (int?)null,
                Convert.ToBoolean(entity.SegmentEnabled5) ? entity.SegmentChar5 : (int?)null,
                Convert.ToBoolean(entity.SegmentEnabled6) ? entity.SegmentChar6 : (int?)null,
                Convert.ToBoolean(entity.SegmentEnabled7) ? entity.SegmentChar7 : (int?)null,
                Convert.ToBoolean(entity.SegmentEnabled8) ? entity.SegmentChar8 : (int?)null);
            return mappingObject;
        }
 public string Insert(Account entity)
 {
     this.Context.Accounts.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }
Exemplo n.º 7
0
 public string Update(Account entity)
 {
     return this.repository.Update(entity);
 }
Exemplo n.º 8
0
 public string Insert(Account entity)
 {
     return this.repository.Insert(entity);
 }