コード例 #1
0
        public bool UpdateClient(ClientViewModel model)
        {
            try
            {
                using (SubDataContext = new DmsSubDomainContext())
                {
                    Clients objClient = new Clients();
                    objClient = SubDataContext.Clients.Where(x => x.ClientId == model.ClientId).FirstOrDefault();
                    objClient.AccountingFirmId = Convert.ToInt32(SessionManagement.LoggedInUser.FirmId);
                    objClient.ClientName       = model.ClientName;
                    objClient.ClientAddress    = model.ClientAddress;
                    objClient.Phone            = model.PhoneNumber;
                    objClient.EmailAddress     = model.EmailAddress;
                    objClient.FirstName        = model.FirstName;
                    objClient.MiddleName       = model.MiddleName;
                    objClient.LastName         = model.LastName;
                    objClient.ClientType       = model.ClientType;
                    objClient.BirthDate        = Convert.ToDateTime(model.BirthDate);
                    objClient.SSN          = Convert.ToString(model.SSN);
                    objClient.IsActive     = true;
                    objClient.IsDeleted    = false;
                    objClient.ModifiedDate = DateTime.Now;
                    objClient.ModifiedBy   = 5534534543545;
                    objClient.CreatedDate  = DateTime.Now;
                    objClient.CreatedBy    = 5534534543545;

                    SubDataContext.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #2
0
 public ClientRepository()
 {
     if (uow == null)
     {
         SubDataContext = new DmsSubDomainContext();
         DataContext    = new DmsDomainContext();
         uow            = new UnityOfWork(DataContext);
         subuow         = new UnityOfWork(SubDataContext);
     }
 }
コード例 #3
0
        public bool AddClient(ClientViewModel model)
        {
            try
            {
                using (SubDataContext = new DmsSubDomainContext())
                {
                    Clients objClient = new Clients();
                    objClient.AccountingFirmId = Convert.ToInt32(SessionManagement.LoggedInUser.FirmId);
                    objClient.ClientName       = model.ClientName;
                    objClient.ClientAddress    = model.ClientAddress;
                    objClient.Phone            = model.PhoneNumber;
                    objClient.EmailAddress     = model.EmailAddress;
                    objClient.FirstName        = model.FirstName;
                    objClient.MiddleName       = model.MiddleName;
                    objClient.LastName         = model.LastName;
                    objClient.ClientType       = model.ClientType;
                    objClient.BirthDate        = Convert.ToDateTime(model.BirthDate);
                    objClient.SSN       = Convert.ToString(model.SSN);
                    objClient.IsActive  = true;
                    objClient.IsDeleted = false;

                    objClient.CreatedDate = DateTime.Now;
                    objClient.CreatedBy   = SessionManagement.LoggedInUser.UserId;

                    subuow.Repository <Clients>().Add(objClient);
                    subuow.SaveChanges();

                    if (model.ClientType == 1)
                    {
                        IndividualClient objIndividualClient = new IndividualClient();
                        objIndividualClient.ClientRecordId = 1;
                        objIndividualClient.CreatedBy      = SessionManagement.LoggedInUser.UserId;
                        objIndividualClient.CreatedDate    = DateTime.Now;
                        // objIndividualClient.EmployeeId = null;
                        objIndividualClient.IndividualRecordId = 1;
                        objIndividualClient.IsActive           = true;
                        objIndividualClient.IsDeleted          = false;
                        objIndividualClient.IsIndividualClient = true;
                        objIndividualClient.ClientRecordId     = objClient.ClientId;
                        subuow.Repository <IndividualClient>().Add(objIndividualClient);
                        subuow.SaveChanges();
                    }
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #4
0
 public bool DeleteClient(long ClientId)
 {
     try
     {
         using (SubDataContext = new DmsSubDomainContext())
         {
             var _entity = SubDataContext.Clients.Where(x => x.ClientId == ClientId).FirstOrDefault();
             _entity.IsDeleted = true;
             SubDataContext.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #5
0
        public Clients GetClient(long ClientId)
        {
            try
            {
                using (SubDataContext = new DmsSubDomainContext())
                {
                    Clients objClient = new Clients();


                    objClient = SubDataContext.Clients.Where(x => x.ClientId == ClientId).FirstOrDefault();

                    return(objClient);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }