}//ViewRecord


       Boolean IUpdate.UpdateRecord(Object Consumerobj)
       {
           Boolean flag = false;
           ConsumerMaster consumer = (ConsumerMaster)Consumerobj;
           try
           {
               Consumer _consumer = new Consumer();
               _consumer.ID = Convert.ToInt64(consumer.ID);
             
               if (consumer.Email != null)
               {
                   _consumer.Email = consumer.Email.Trim();
               }
               if (consumer.Mobile != null)
               {
                   _consumer.Mobile = consumer.Mobile.Trim();
               }

               if (consumer.ForwardingAddress1 != null)
               {
                   _consumer.ForwardingAddress1 = consumer.ForwardingAddress1.Trim();
               }

               if (consumer.ForwardingAddress2 != null)
               {
                   _consumer.ForwardingAddress2 = consumer.ForwardingAddress2.Trim();
               }

               if (consumer.ForwardingCity!= null)
               {
                   _consumer.ForwardingCity = consumer.ForwardingCity.Trim();
               }
               if (consumer.ForwardingCounty != null)
               {
                   _consumer.ForwardingCounty = consumer.ForwardingCounty.Trim();
               }
               if (consumer.ForwardingPostCode != null)
               {
                   _consumer.ForwardingPostCode = consumer.ForwardingPostCode.Trim();
               }
               if ((consumer.EndDate != null)&&(!String.IsNullOrEmpty(consumer.EndDate)))
               { 
               _consumer.EndDate= Common.DateGB(consumer.EndDate.ToString());
               
               }
               _consumer.ModifyBy = consumer.ModifyBy;
               _consumer.ModifyDate = DateTime.Now;

               if (_consumer.ID != null)
               {
                   flag = DAL.DALConsumerCls.UpdateConsumer(_consumer);
               }
           }
           catch (Exception ex)
           {
               throw;
           }
           return flag;
       }//UpdateRecord
       }//UpdateRecord

       public String AddRecord(Object Consumerobj)
       {
           String ConsumerID = String.Empty;
           ConsumerMaster consumer = (ConsumerMaster)Consumerobj;
           try
           {
               Consumer _consumer = new Consumer();

               if (consumer.OwnerID != null)
               {
                   _consumer.OwnerID = consumer.OwnerID;
               }
               if (consumer.PropertyID != null)
               {
                   _consumer.PropertyID = consumer.PropertyID;
               }

               if (consumer.ConsumerName != null)
               {
                   _consumer.ConsumerName = consumer.ConsumerName.Trim();
               }

               if (consumer.StartDate != null)
               {
                   _consumer.StartDate = Common.DateGB(consumer.StartDate);
               }
               if (consumer.EndDate != null)
               {
                   _consumer.EndDate = Common.DateGB(consumer.EndDate);
               }
               if (consumer.Address1 != null)
               {
                   _consumer.Address1 = consumer.Address1.Trim();
               }
               if (consumer.Address2 != null)
               {
                   _consumer.Address2 = consumer.Address2.Trim();
               }
               if (consumer.City != null)
               {
                   _consumer.City = consumer.City.Trim();
               }
               if (consumer.County != null)
               {
                   _consumer.County = consumer.County.Trim();
               }
               if (consumer.ZipCode != null)
               {
                   _consumer.ZipCode = consumer.ZipCode.Trim();
               }
               if (consumer.Email != null)
               {
                   _consumer.Email = consumer.Email.Trim();
               }
               if (consumer.Mobile != null)
               {
                   _consumer.Mobile = consumer.Mobile.Trim();
               }
               if (consumer.BankName != null)
               {
                   _consumer.BankName = consumer.BankName.Trim();
               }
               if (consumer.BankSortCode != null)
               {
                   _consumer.BankSortCode = consumer.BankSortCode.Trim();
               }
               if (consumer.BankAccount != null)
               {
                   _consumer.BankAccount = consumer.BankAccount.Trim();
               }
               if (consumer.FirstName != null)
               {
                   _consumer.FirstName = consumer.FirstName.Trim();
               }
               if (consumer.LastName != null)
               {
                   _consumer.LastName = consumer.LastName.Trim();
               }

               if (consumer.Notes != null)
               {
                   _consumer.Notes = consumer.Notes.Trim();
               }

               if (consumer.ClientRefNo != null)
               {
                   _consumer.ClientRefNo = consumer.ClientRefNo.Trim();
               }

               _consumer.CreateBy = consumer.CreateBy;
               _consumer.CreateDate = DateTime.Now;

               if ((_consumer.PropertyID != null) && (_consumer.OwnerID != null))
               {
                   ConsumerID = DAL.DALConsumerCls.CreateConsumer(_consumer).ToString();
               }
           }
           catch (Exception ex)
           {
               throw;
           }
           return ConsumerID;

       }// AddRecord
Exemple #3
0
        public static Boolean UpdateConsumer(Consumer consumer)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.Consumers.Where(c => c.ID == consumer.ID);

                        foreach (Consumer p in Update)
                        {
                            if (consumer.ConsumerName != null)
                            {
                                p.ConsumerName = consumer.ConsumerName;
                            }

                            if (consumer.StartDate != null)
                            {
                                p.StartDate = consumer.StartDate;
                            }
                            if (consumer.EndDate != null)
                            {
                                p.EndDate = consumer.EndDate;
                            }
                            if (consumer.Address1 != null)
                            {
                                p.Address1 = consumer.Address1;
                            }
                            if (consumer.Address2 != null)
                            {
                                p.Address2 = consumer.Address2;
                            }
                            if (consumer.City != null)
                            {
                                p.City = consumer.City;
                            }
                            if (consumer.County != null)
                            {
                                p.County = consumer.County;
                            }
                            if (consumer.ZipCode != null)
                            {
                                p.ZipCode = consumer.ZipCode;
                            }
                            if (consumer.Email != null)
                            {
                                p.Email = consumer.Email;
                            }
                            if (consumer.Mobile != null)
                            {
                                p.Mobile = consumer.Mobile;
                            }
                            if (consumer.BankName != null)
                            {
                                p.BankName = consumer.BankName;
                            }
                            if (consumer.BankSortCode != null)
                            {
                                p.BankSortCode = consumer.BankSortCode;
                            }
                            if (consumer.BankAccount != null)
                            {
                                p.BankAccount = consumer.BankAccount;
                            }

                            if (consumer.FirstName != null)
                            {
                                p.FirstName = consumer.FirstName;
                            }

                            if (consumer.LastName != null)
                            {
                                p.LastName = consumer.LastName;
                            }

                            if (consumer.Notes != null)
                            {
                                p.Notes = consumer.Notes;
                            }

                            if (consumer.ClientRefNo != null)
                            {
                                p.ClientRefNo = consumer.ClientRefNo;
                            }
                            else { p.ClientRefNo = null; }

                            p.ModifyBy = consumer.ModifyBy;
                            p.ModifyDate = DateTime.Now;
                        }//

                        context.SaveChanges();
                        context.AcceptAllChanges();
                        scope.Complete();
                        context.Dispose();
                        bol = true;

                    }
                    catch (Exception ex)
                    {
                        context.Dispose();
                        throw;
                    }

                }// using
                return bol;
            } //trans
        }
       }//EditRecord

       public bool UpdateRecord(Object Consumerobj)
       {
           Boolean flag = false;
           ConsumerMaster consumer = (ConsumerMaster)Consumerobj;
           try
           {      
               Consumer _consumer = new Consumer();
                _consumer.ID=Convert.ToInt64(consumer.ID);
               if (consumer.OwnerID != null)
               {
                   _consumer.OwnerID = consumer.OwnerID;
               }
               if (consumer.PropertyID != null)
               {
                   _consumer.PropertyID = consumer.PropertyID;
               }
               
               if (consumer.ConsumerName != null)
               {
                   _consumer.ConsumerName = consumer.ConsumerName.Trim();
               }
               
               if (consumer.StartDate != null)
               {
                   _consumer.StartDate = Common.DateGB(consumer.StartDate);
               }
               if (consumer.EndDate != null)
               {
                   _consumer.EndDate = Common.DateGB(consumer.EndDate);
               }
               if (consumer.Address1 != null)
               {
                   _consumer.Address1 = consumer.Address1.Trim();
               }
               if (consumer.Address2 != null)
               {
                   _consumer.Address2 = consumer.Address2.Trim();
               }
               if (consumer.City != null)
               {
                   _consumer.City = consumer.City.Trim();
               }
               if (consumer.County != null)
               {
                   _consumer.County = consumer.County.Trim();
               }
               if (consumer.ZipCode != null)
               {
                   _consumer.ZipCode = consumer.ZipCode.Trim();
               }
               if (consumer.Email != null)
               {
                   _consumer.Email = consumer.Email.Trim();
               }
               if (consumer.Mobile != null)
               {
                   _consumer.Mobile = consumer.Mobile.Trim();
               }
               if (consumer.BankName != null)
               {
                   _consumer.BankName = consumer.BankName.Trim();
               }
               if (consumer.BankSortCode != null)
               {
                   _consumer.BankSortCode = consumer.BankSortCode.Trim();
               }
               if (consumer.BankAccount != null)
               {
                   _consumer.BankAccount = consumer.BankAccount.Trim();
               }

               if (consumer.FirstName != null)
               {
                   _consumer.FirstName = consumer.FirstName.Trim();
               }
               if (consumer.LastName != null)
               {
                   _consumer.LastName = consumer.LastName.Trim();
               }

               if (consumer.Notes != null)
               {
                   _consumer.Notes = consumer.Notes.Trim();
               }

               if (consumer.ClientRefNo!= null)
               {
                   _consumer.ClientRefNo = consumer.ClientRefNo.Trim();
               }



               _consumer.ModifyBy = consumer.ModifyBy;
               _consumer.ModifyDate = DateTime.Now;

               if (_consumer.ID!= null) 
               {
                   flag = DAL.DALConsumer.UpdateConsumer(_consumer);
               }
           }
           catch (Exception ex)
           {
               throw;
           }
           return flag;
       }// UpdateRecord
Exemple #5
0
 public static Consumer EditConsumer(Int64 ConsumerID)
 {
     Consumer consumer = new Consumer();
     using (var context = new SycousCon())
     {
         try
         {
             consumer = context.Consumers.SingleOrDefault(s => s.ID == ConsumerID && s.IsDeleted==0);
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
     return consumer;
 }
Exemple #6
0
 public static bool IsExistingConsumer(Consumer consumer)
 {
     using (var context = new SycousCon())
     {
         try
         {
             Consumer objconsumer = context.Consumers.SingleOrDefault(p => p.PropertyID == consumer.PropertyID && p.EndDate == null);
             if (objconsumer != null)
             { return true; }
             else
             {
                 return false;
             }
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
 }
Exemple #7
0
 public static Boolean CreateConsumer(Consumer consumer)
 {
     Boolean flag = false;
     if (!(IsExistingConsumer(consumer)))
     {
         using (TransactionScope scope = new TransactionScope())
         {
             using (var context = new SycousCon())
             {
                 try
                 {
                     context.Consumers.AddObject(consumer);
                     context.SaveChanges();
                     scope.Complete();
                     context.AcceptAllChanges();
                     flag = true;
                 }
                 catch (Exception ex)
                 {
                     context.Dispose();
                     throw;
                 }
             }
         }
     }
     return flag;
 }
Exemple #8
0
        public static new Boolean UpdateConsumer(Consumer consumer)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.Consumers.Where(c => c.ID == consumer.ID);

                       foreach (Consumer p in Update)
                       {

                           if (consumer.Email != null)
                           {
                               p.Email = consumer.Email;
                           }
                           if (consumer.Mobile != null)
                           {
                               p.Mobile = consumer.Mobile;
                           }

                           if (consumer.EndDate != null)
                           {
                               p.EndDate = consumer.EndDate;

                           }

                           if (consumer.ForwardingAddress1 != null)
                           {
                               p.ForwardingAddress1 = consumer.ForwardingAddress1;

                           }
                           if (consumer.ForwardingAddress2 != null)
                           {
                               p.ForwardingAddress2 = consumer.ForwardingAddress2;
                           }

                           if (consumer.ForwardingCity!= null)
                           {
                               p.ForwardingCity = consumer.ForwardingCity;
                           }
                           if (consumer.ForwardingCounty != null)
                           {
                               p.ForwardingCounty = consumer.ForwardingCounty;
                           }
                           if (consumer.ForwardingPostCode != null)
                           {
                               p.ForwardingPostCode = consumer.ForwardingPostCode;
                           }

                           p.ModifyDate = consumer.ModifyDate;
                           p.ModifyBy = consumer.ModifyBy;
                       }//
                       context.SaveChanges();
                       context.AcceptAllChanges();
                       scope.Complete();
                       context.Dispose();
                       bol = true;
                   }
                   catch (Exception ex)
                   {
                       context.Dispose();
                       throw;
                   }
               }// using
               return bol;
               } //trans
        }
Exemple #9
0
 public static new Int64 CreateConsumer(Consumer consumer)
 {
     Int64 ConsumerID = 0;
        if (!(IsExistingConsumer(consumer)))
        {
        using (TransactionScope scope = new TransactionScope())
        {
            using (var context = new SycousCon())
            {
                try
                {
                    context.Consumers.AddObject(consumer);
                    context.SaveChanges();
                    scope.Complete();
                    context.AcceptAllChanges();
                    ConsumerID = consumer.ID;
                }
                catch (Exception ex)
                {
                    context.Dispose();
                    throw;
                }
            }
        }
        }
        return ConsumerID;
 }
 /// <summary>
 /// Create a new Consumer object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="isDeleted">Initial value of the IsDeleted property.</param>
 public static Consumer CreateConsumer(global::System.Int64 id, global::System.Int32 isDeleted)
 {
     Consumer consumer = new Consumer();
     consumer.ID = id;
     consumer.IsDeleted = isDeleted;
     return consumer;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Consumers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToConsumers(Consumer consumer)
 {
     base.AddObject("Consumers", consumer);
 }