Пример #1
0
 public Client selectClient(Client obj)
 {
     try
     {
         IClientSvc svc = (IClientSvc)this.getService(typeof(IClientSvc).Name);
         return svc.selectClient(obj);
     }
     catch (ServiceLoadException ex)
     {
         throw ex;
     }
 }
Пример #2
0
        public bool insertClient(Client obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    db.Clients.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Пример #3
0
 public Boolean updateClient(Client obj)
 {
     try
     {
         IClientSvc svc = (IClientSvc)this.getService(typeof(IClientSvc).Name);
         if (obj.isDataEntered())
         {
             return svc.updateClient(obj);
         }
         else
         {
             throw new BusinessValidationException(CustomErrors.REQUIRED_FIELD);
         }
     }
     catch (ServiceLoadException ex)
     {
         throw ex;
     }
 }
Пример #4
0
        public bool deleteClient(Client obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {
                    IQueryable<Client> ClientList = from client in db.Clients
                                                    where client.ClientID == obj.ClientID
                                                    select client;

                    if ((ClientList.ToArray().Length > 0))
                    {
                        //
                        #region Database Submission

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }

                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Пример #5
0
        public Client selectClient(Client obj)
        {
            RealReportContext db = new RealReportContext();

            try
            {
                IQueryable<Client> ClientList = from Client in db.Clients
                                                where Client.ClientID == obj.ClientID
                                                select Client;

                return (ClientList.ToList())[0];
            }
            catch (Exception ex)
            {
                return null;
            }
        }
Пример #6
0
        public bool updateClient(Client obj)
        {
            using (RealReportContext db = new RealReportContext())
            {
                try
                {

                    IQueryable<Client> ClientList = from Client in db.Clients
                                                    where Client.ClientID == obj.ClientID
                                                    select Client;

                    if ((ClientList.ToArray()).Length > 0)
                    {
                        foreach (Client Client in ClientList)
                        {
                            //Modify Attributes
                        }

                        #region Database Submission with Rollback

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }
                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }