public static Boolean CreateUnOccupiedProperty(UnOccupiedProperty UnOccupied)
        {
            Boolean flag = false;
            if (!(IsExistingUnOccupiedProperty(UnOccupied)))
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (var context = new SycousCon())
                    {
                        try
                        {
                            context.UnOccupiedProperties.AddObject(UnOccupied);
                            context.SaveChanges();
                            scope.Complete();
                            context.AcceptAllChanges();
                            flag = true;
                        }
                        catch (Exception ex)
                        {
                            context.Dispose();
                            throw;
                        }
                    }//
                }// using
            }//if

            return flag;
        }
        public static Boolean CreateDataLoggerMapping(SiteInLogger logger)
        {
            Boolean flag = false;

                using (TransactionScope scope = new TransactionScope())
                {
                    using (var context = new SycousCon())
                    {
                        try
                        {
                            context.SiteInLoggers.AddObject(logger);
                            context.SaveChanges();
                            scope.Complete();
                            context.AcceptAllChanges();
                            flag = true;
                        }
                        catch (Exception ex)
                        {
                            context.Dispose();
                            throw;
                        }
                    }//
                }// using

            return flag;
        }
Exemple #3
0
        public static Boolean CreatePeerConsumerAverages(PeerNConsumerAverage Peer)
        {
            Boolean flag = false;
            if (!(IsExistingPeerNConsumerAverage(Peer)))
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (var context = new SycousCon())
                    {
                        try
                        {
                            context.PeerNConsumerAverages.AddObject(Peer);
                            context.SaveChanges();
                            scope.Complete();
                            context.AcceptAllChanges();
                            flag = true;
                        }
                        catch (Exception ex)
                        {
                            context.Dispose();
                            throw;
                        }
                    }//
                }// using
            }//if

            return flag;
        }
Exemple #4
0
        public static bool UpdateExistResetPassword(ResetPwd Pwd)
        {
            Boolean flag = true;
            using (TransactionScope scope = new TransactionScope())
            {
                using (var context = new SycousCon())
                {
                    try
                    {
                        var ResetToUpdate = context.ResetPwds.Where(c => c.UserID == Pwd.UserID && c.Active == false);
                        foreach (ResetPwd p in ResetToUpdate)
                        {
                            p.Active = true;
                            p.ModifyBy = Pwd.CreateBy;
                            p.ModifyDate = DateTime.Now;
                        }

                        context.SaveChanges();
                        context.AcceptAllChanges();
                        scope.Complete();
                        context.Dispose();
                        flag = true;
                    }
                    catch (Exception ex)
                    {
                        flag = false;
                        context.Dispose();
                        throw;
                    }
                }
            }
            return flag;
        }
        public static Boolean CreateSiteCreditControl(SiteCreditControl site)
        {
            Boolean flag = false;
            if (!(IsExistingSiteCreditControl(site)))
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (var context = new SycousCon())
                    {
                        try
                        {
                            context.SiteCreditControls.AddObject(site);
                            context.SaveChanges();
                            scope.Complete();
                            context.AcceptAllChanges();
                            flag = true;
                        }
                        catch (Exception ex)
                        {
                            context.Dispose();
                            throw;
                        }
                    }//
                }// using
            }//if

            return flag;
        }
        public static Boolean DeletedDirectDebit(DirectDebit debit)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.DirectDebits.Where(c => c.ID == debit.ID&& c.IsDeleted==0&&c.IsApproved==0);

                        foreach (DirectDebit p in Update)
                        {
                            p.IsDeleted = 2;
                            p.ModifyBy = debit.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
        }
 public static Boolean CreateDirectDebitTLetteremplate(DirectDebitLetterTemplate directDebit)
 {
     Boolean flag = false;
     if (!(IsExistingDirectDebitTemplate(directDebit)))
     {
         using (TransactionScope scope = new TransactionScope())
         {
             using (var context = new SycousCon())
             {
                 try
                 {
                     context.DirectDebitLetterTemplates.AddObject(directDebit);
                     context.SaveChanges();
                     scope.Complete();
                     context.AcceptAllChanges();
                     flag = true;
                 }
                 catch (Exception ex)
                 {
                     context.Dispose();
                     throw;
                 }
             }
         }
     }
     return flag;
 }
Exemple #8
0
 public static Boolean CreateDepartment(Department deptartment)
 {
     Boolean flag = false;
     using (TransactionScope scope = new TransactionScope())
     {
         if (!(IsExistingDeptarmentCode(deptartment.DeptCode)))
         {
             using (var context = new SycousCon())
             {
                 try
                 {
                     context.Departments.AddObject(deptartment);
                     context.SaveChanges();
                     scope.Complete();
                     context.AcceptAllChanges();
                     flag = true;
                 }
                 catch (Exception ex)
                 {
                     context.Dispose();
                     throw;
                 }
             }
         }
     }
     return flag;
 }
Exemple #9
0
        public static Boolean CreateResetPassword(ResetPwd Pwd)
        {
            Boolean flag = false;

            if (UpdateExistResetPassword(Pwd))
            {

                using (TransactionScope scope = new TransactionScope())
                {
                    using (var context = new SycousCon())
                    {
                        try
                        {
                            context.ResetPwds.AddObject(Pwd);
                            context.SaveChanges();
                            scope.Complete();
                            context.AcceptAllChanges();
                            flag = true;
                        }
                        catch (Exception ex)
                        {
                            context.Dispose();
                            throw;
                        }
                    }
                }
            }
            return flag;
        }
Exemple #10
0
 public static Boolean CreatePropertyBandInTariff(PropertyBandInTariff tariff)
 {
     Boolean flag = false;
        if ((IsExistingPropertyBandInTariff(tariff)))
        {
        using (TransactionScope scope = new TransactionScope())
        {
            using (var context = new SycousCon())
            {
                try
                {
                    context.PropertyBandInTariffs.AddObject(tariff);
                    context.SaveChanges();
                    scope.Complete();
                    context.AcceptAllChanges();
                    flag = true;
                }
                catch (Exception ex)
                {
                    context.Dispose();
                    throw;
                }
            }
        }
        }
        return flag;
 }
Exemple #11
0
        public static Boolean AddTariffProperty(List<DAL.TariffInProperty> tariff)
        {
            Boolean flag = false;
               using (TransactionScope scope = new TransactionScope())
               {
               using (var context = new SycousCon())
               {
                   try
                   {
                       foreach (DAL.TariffInProperty item in tariff)
                       {
                           context.TariffInProperties.AddObject(item);

                       }
                       context.SaveChanges();
                       context.AcceptAllChanges();
                       scope.Complete();
                       flag = true;
                   }
                   catch (Exception ex)
                   {
                       context.Dispose();
                       throw;
                   }
               }// using
               return flag;
               }// trans
        }
        public static Boolean CreateTemperatureDifference(TemperatureDifference Temperature)
        {
            Boolean flag = false;
            if (!(IsExistingTemperatureDifference(Temperature)))
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (var context = new SycousCon())
                    {
                        try
                        {
                            context.TemperatureDifferences.AddObject(Temperature);
                            context.SaveChanges();
                            scope.Complete();
                            context.AcceptAllChanges();
                            flag = true;
                        }
                        catch (Exception ex)
                        {
                            context.Dispose();
                            throw;
                        }
                    }//
                }// using
            }//if

            return flag;
        }
Exemple #13
0
        public static Boolean CreateEnergy(Energy energy)
        {
            Boolean flag = false;
              if (!(IsExistingEnergy(energy)))
              {
              using (TransactionScope scope = new TransactionScope())
              {
                  using (var context = new SycousCon())
                  {
                      try
                      {
                          context.Energies.AddObject(energy);
                          context.SaveChanges();
                          scope.Complete();
                          context.AcceptAllChanges();
                          flag = true;
                      }
                      catch (Exception ex)
                      {
                          context.Dispose();
                          throw;
                      }
                  }//
              }// using
              }//if

              return flag;
        }
        public static Boolean CreateDirectDebit(DirectDebit mdirectdebit)
        {
            Boolean flag = false;

                using (TransactionScope scope = new TransactionScope())
                {
                    using (var context = new SycousCon())
                    {
                        try
                        {
                            context.DirectDebits.AddObject(mdirectdebit);
                            context.SaveChanges();
                            scope.Complete();
                            context.AcceptAllChanges();
                            flag = true;
                        }
                        catch (Exception ex)
                        {
                            context.Dispose();
                            throw;
                        }
                    }
                }

            return flag;
        }
Exemple #15
0
 public static Boolean CreateUnit(UnitMaster unit)
 {
     Boolean flag = false;
     if (!(IsExistingUnit(unit)))
     {
         using (TransactionScope scope = new TransactionScope())
         {
             using (var context = new SycousCon())
             {
                 try
                 {
                     context.UnitMasters.AddObject(unit);
                     context.SaveChanges();
                     scope.Complete();
                     context.AcceptAllChanges();
                     flag = true;
                 }
                 catch (Exception ex)
                 {
                     context.Dispose();
                     throw;
                 }
             }
         }
     }
     return flag;
 }
Exemple #16
0
        public static String AddProperty(Property prop)
        {
            String ReturnpropertyID = String.Empty;

               //if (!(IsExistingProperty(prop)))
               //{
               using (TransactionScope scope = new TransactionScope())
               {
                   using (var context = new SycousCon())
                   {
                       try
                       {
                           context.Properties.AddObject(prop);
                           context.SaveChanges();
                           scope.Complete();
                           context.AcceptAllChanges();
                           ReturnpropertyID = prop.ID.ToString();
                       }
                       catch (Exception ex)
                       {
                           context.Dispose();
                           throw;
                       }
                   }//
               }// using
               //}//if

               return ReturnpropertyID;
        }
 public static Boolean CreateFundamentalDaily( FundamentalDailyWorkFlow    daily)
 {
     Boolean flag = false;
        using (TransactionScope scope = new TransactionScope())
        {
        using (var context = new SycousCon())
            {
                try
                {
                    context.FundamentalDailyWorkFlows.AddObject(daily);
                    context.SaveChanges();
                    scope.Complete();
                    context.AcceptAllChanges();
                    flag = true;
                }
                catch (Exception ex)
                {
                    context.Dispose();
                    throw;
                }
            }
        }
        return flag;
 }
        public static Boolean UpdateDirectDebit(DirectDebit debit)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.DirectDebits.Where(c => c.ID == debit.ID);

                        foreach (DirectDebit p in Update)
                        {
                            if (debit.AccountHolderName != null)
                            {
                                p.AccountHolderName = debit.AccountHolderName;
                            }

                            if (debit.BankName != null)
                            {
                                p.BankName = debit.BankName;
                            }
                            if (debit.BankSortCode != null)
                            {
                                p.BankSortCode = debit.BankSortCode;
                            }
                            if (debit.AccountNumber != null)
                            {
                                p.AccountNumber = debit.AccountNumber;
                            }
                            if (debit.DirectDebitDate != null)
                            {
                                p.DirectDebitDate = debit.DirectDebitDate;
                            }
                            else
                            { p.DirectDebitDate = null; }

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

                            if (debit.Amount != null)
                            {
                                p.Amount = debit.Amount;
                            }
                            if (debit.StartDate != null)
                            {
                                p.StartDate = debit.StartDate;
                            }
                            if (debit.EndDate != null)
                            {
                                p.EndDate = debit.EndDate;
                            }

                            if (debit.DateOfDebitDebit != null)
                            {
                                p.DateOfDebitDebit = debit.DateOfDebitDebit;
                            }
                            else
                            {
                                p.DateOfDebitDebit = null;
                            }

                            p.ModifyBy = debit.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
        }
Exemple #19
0
        public static Boolean UpdateUnit(UnitMaster unit)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.UnitMasters.Where(c => c.ID == unit.ID);

                        foreach (UnitMaster p in Update)
                        {
                            if (unit.UnitCode != null)
                            {
                                p.UnitCode = unit.UnitCode;
                            }
                            if (unit.UnitName != null)
                            {
                                p.UnitName = unit.UnitName;
                            }
                            if (unit.Volume != null)
                            {
                                p.Volume = unit.Volume;
                            }

                            p.ModifyDate = DateTime.Now;
                            p.ModifyBy = unit.ModifyBy;
                        }//
                        context.SaveChanges();
                        context.AcceptAllChanges();
                        scope.Complete();
                        context.Dispose();
                        bol = true;
                    }
                    catch (Exception ex)
                    {
                        context.Dispose();
                        throw;
                    }

                }// using
                return bol;
            } //trans
        }
        public static Boolean UpdateTemperatureDifference(TemperatureDifference Temperature)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.TemperatureDifferences.Where(c => c.ID == Temperature.ID);

                        foreach (TemperatureDifference p in Update)
                        {
                            if (Temperature.ClientID != null)
                            {
                                p.ClientID = Temperature.ClientID;
                            }
                            if (Temperature.SiteID != null)
                            {
                                p.SiteID = Temperature.SiteID;
                            }

                            if (Temperature.Variance!= null)
                            {
                                p.Variance = Temperature.Variance;
                            }
                            else
                            {
                                p.Variance = null;
                            }
                            if (Temperature.FormDate != null)
                            {
                                p.FormDate = Temperature.FormDate;
                            }
                            else
                            {
                                p.FormDate = null;
                            }

                            if (Temperature.ToDate != null)
                            {
                                p.ToDate = Temperature.ToDate;
                            }
                            else
                            {
                                p.ToDate = null;
                            }

                            p.ModifyBy = Temperature.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
        }
Exemple #21
0
        public static Boolean UpdateBulkMeter(BulkMeter _bulk)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                Boolean bol = false;
                using (var context = new SycousCon())
                {
                    try
                    {
                        var Update = context.BulkMeters.Where(c => c.ID == _bulk.ID);

                        foreach (BulkMeter p in Update)
                        {
                            if (_bulk.ClientID != null)
                            {
                                p.ClientID = _bulk.ClientID;
                            }

                            if (_bulk.SiteID != null)
                            {
                                p.SiteID = _bulk.SiteID;
                            }

                            if (_bulk.SupplyID != null)
                            {
                                p.SupplyID = _bulk.SupplyID;
                            }
                            if (_bulk.DeviceID != null)
                            {
                                p.DeviceID = _bulk.DeviceID;
                            }

                            if (_bulk.StartDate != null)
                            {
                                p.StartDate = _bulk.StartDate;
                            }
                            else { p.StartDate = null; }

                            if (_bulk.EndDate != null)
                            {
                                p.EndDate= _bulk.EndDate;
                            }
                            else { p.EndDate = null; }

                            if (_bulk.Warrenty != null)
                            {
                                p.Warrenty = _bulk.Warrenty;
                            }
                            else { p.Warrenty = null; }

                            if (_bulk.OpeningReading != null)
                            {
                                p.OpeningReading = _bulk.OpeningReading;
                            }
                            else { p.OpeningReading = null; }

                            p.ModifyBy = _bulk.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
        }
Exemple #22
0
        public static Boolean UpdatePropertyBand(PropertyBand Band)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.PropertyBands.Where(c => c.ID == Band.ID);
                       foreach (PropertyBand p in Update)
                       {
                           if (Band.PropertyBand1 != null)
                           {
                               p.PropertyBand1 = Band.PropertyBand1;
                           }
                           if (Band.PropertyLevel != null)
                           {
                               p.PropertyLevel = Band.PropertyLevel;
                           }
                           if (Band.PropertySize != null)
                           {
                               p.PropertySize = Band.PropertySize;
                           }
                           if (Band.PropertyType != null)
                           {
                               p.PropertyType = Band.PropertyType;
                           }
                           if (Band.PropertyOwnershipType != null)
                           {
                               p.PropertyOwnershipType = Band.PropertyOwnershipType;
                           }

                           if (Band.ClientID != null)
                           {
                               p.ClientID = Band.ClientID;
                           }
                           if (Band.SiteID!= null)
                           {
                               p.SiteID = Band.SiteID;
                           }
                           p.ModifyBy = Band.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
        }
Exemple #23
0
        public static Boolean UpdateEnergy(Energy energy)
        {
            using (TransactionScope scope = new TransactionScope())
              {
              Boolean bol = false;
              using (var context = new SycousCon())
              {
                  try
                  {
                      var Update = context.Energies.Where(c => c.ID == energy.ID);

                      foreach (Energy p in Update)
                      {
                          if (energy.EnergyName != null)
                          {
                              p.EnergyName = energy.EnergyName.Trim();
                          }

                          if (energy.EnergyCode != null)
                          {
                              p.EnergyCode = energy.EnergyCode;
                          }
                          p.ModifyBy = energy.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
        }
Exemple #24
0
 public static Boolean UpdateTariffInPropperty(Int64 propertyID, Int64 ModifyByID)
 {
     using (TransactionScope scope = new TransactionScope())
        {
        Boolean bol = false;
        using (var context = new SycousCon())
        {
            try
            {
                var Update = context.TariffInProperties.Where(c => c.PropertyID == propertyID && c.IsDeleted == 0);
                foreach (TariffInProperty p in Update)
                {
                    p.IsDeleted = 2;
                    p.ModifyBy = ModifyByID;
                    p.ModifyDate = DateTime.Now;
                }//
                context.SaveChanges();
                context.AcceptAllChanges();
                scope.Complete();
                context.Dispose();
                bol = true;
            }
            catch (Exception ex)
            {
                context.Dispose();
                throw;
            }
        }// using
        return bol;
        } //trans
 }
Exemple #25
0
        public static Boolean CreateProperty(Property prop )
        {
            String propertyID = String.Empty;
               Boolean flag = false;
               if (!(IsExistingProperty(prop)))
               {
               using (TransactionScope scope = new TransactionScope())
               {
                   using (var context = new SycousCon())
                   {
                       try
                       {
                           context.Properties.AddObject(prop);
                           context.SaveChanges();
                           scope.Complete();
                           context.AcceptAllChanges();
                           propertyID = prop.ID.ToString();
                           flag = true;
                       }
                       catch (Exception ex)
                       {
                           context.Dispose();
                           throw;
                       }
                   }//
               }// using
               }//if

               return flag;
        }
Exemple #26
0
        public static Boolean UpdateProperty(Property prop)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.Properties.Where(c => c.ID == prop.ID);
                       foreach (Property p in Update)
                       {

                           if (prop.SiteID != null)
                           {
                               p.SiteID = prop.SiteID;
                           }
                           if (prop.PropertyNumber != null)
                           {
                               p.PropertyNumber = prop.PropertyNumber;
                           }
                           if (prop.Apartment != null)
                           {
                               p.Apartment = prop.Apartment;
                           }
                           if (prop.Address1 != null)
                           {
                               p.Address1 = prop.Address1;
                           }
                           if (prop.Address2 != null)
                           {
                               p.Address2 = prop.Address2;
                           }
                           if (prop.City != null)
                           {
                               p.City = prop.City;
                           }
                           if (prop.County != null)
                           {
                               p.County = prop.County;
                           }
                           if (prop.PostCode != null)
                           {
                               p.PostCode = prop.PostCode;
                           }
                           if (prop.PropertyBrand != null)
                           {
                               p.PropertyBrand = prop.PropertyBrand;
                           }
                           p.ModifyBy = prop.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
        }
Exemple #27
0
        public static Boolean UpdatePropertyBandInTariff(PropertyBandInTariff tariff)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.PropertyBandInTariffs.Where(c => c.ID == tariff.ID);

                       foreach (PropertyBandInTariff p in Update)
                       {
                           if (tariff.ReleaseDate!= null)
                           {
                               p.ReleaseDate = tariff.ReleaseDate;
                           }
                           if (tariff.IsDeleted != null)
                           {
                               p.IsDeleted = tariff.IsDeleted;
                           }

                           p.ModifyDate = DateTime.Now;
                           p.ModifyBy = tariff.ModifyBy;
                       }//
                       context.SaveChanges();
                       context.AcceptAllChanges();
                       scope.Complete();
                       context.Dispose();
                       bol = true;
                   }
                   catch (Exception ex)
                   {
                       context.Dispose();
                       throw;
                   }

               }// using
               return bol;
               } //trans
        }
Exemple #28
0
        public static Boolean UpdatePropertyType(PropertyType Type)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.PropertyTypes.Where(c => c.ID == Type.ID);
                       foreach (PropertyType p in Update)
                       {
                           if (Type.PropertyType1 != null)
                           {
                               p.PropertyType1 = Type.PropertyType1;
                           }

                           if (Type.ClientID != null)
                           {
                               p.ClientID = Type.ClientID;
                           }
                           if (Type.SiteID != null)
                           {
                               p.SiteID = Type.SiteID;
                           }

                           p.ModifyBy = Type.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
        }
Exemple #29
0
        public static Boolean UpdateTariff(Tariff tariff)
        {
            using (TransactionScope scope = new TransactionScope())
               {
               Boolean bol = false;
               using (var context = new SycousCon())
               {
                   try
                   {
                       var Update = context.Tariffs.Where(c => c.ID == tariff.ID);

                       foreach (Tariff p in Update)
                       {

                           if (tariff.ClientID!= null)
                           {
                               p.ClientID = tariff.ClientID;
                           }
                           if (tariff.SiteID != null)
                           {
                               p.SiteID = tariff.SiteID;
                           }
                           if (tariff.TariffTypeID != null)
                           {
                               p.TariffTypeID = tariff.TariffTypeID;
                           }
                           if (tariff.SupplierID != null)
                           {
                               p.SupplierID = tariff.SupplierID;
                           }
                           if (tariff.AllSite != null)
                           {
                               p.AllSite = tariff.AllSite;
                           }
                           if (tariff.PopBandID != null)
                           {
                               p.PopBandID = tariff.PopBandID;
                           }
                           if (tariff.TariffName != null)
                           {
                               p.TariffName = tariff.TariffName;
                           }
                           if (tariff.TariffCode != null)
                           {
                               p.TariffCode = tariff.TariffCode;
                           }
                           if (tariff.UnitPrefix != null)
                           {
                               p.UnitPrefix = tariff.UnitPrefix;
                           }
                           if (tariff.UnitRate != null)
                           {
                               p.UnitRate = tariff.UnitRate;
                           }
                           if (tariff.VatRate != null)
                           {
                               p.VatRate = tariff.VatRate;
                           }
                           if (tariff.FromDate != null)
                           {
                               p.FromDate = tariff.FromDate;
                           }
                           if (tariff.EndDate != null)
                           {
                               p.EndDate = tariff.EndDate;
                           }
                           if (tariff.StartTime != null)
                           {
                               p.StartTime = tariff.StartTime;
                           }
                           if (tariff.EndTime != null)
                           {
                               p.EndTime = tariff.EndTime;
                           }
                           p.IsDailyBasic = tariff.IsDailyBasic;
                           p.ModifyDate = DateTime.Now;
                           p.ModifyBy = tariff.ModifyBy;
                       }//
                       context.SaveChanges();
                       context.AcceptAllChanges();
                       scope.Complete();
                       context.Dispose();
                       bol = true;
                   }
                   catch (Exception ex)
                   {
                       context.Dispose();
                       throw;
                   }

               }// using
               return bol;
               } //trans
        }
Exemple #30
0
        public static Boolean CreatePropertyOwnership(PropertyOwnershipType ownership)
        {
            Boolean flag = false;
               if (!(IsExistingPropertyOwnership(ownership)))
               {
               using (TransactionScope scope = new TransactionScope())
               {
                   using (var context = new SycousCon())
                   {
                       try
                       {
                           context.PropertyOwnershipTypes.AddObject(ownership);
                           context.SaveChanges();
                           scope.Complete();
                           context.AcceptAllChanges();
                           flag = true;
                       }
                       catch (Exception ex)
                       {
                           context.Dispose();
                           throw;
                       }
                   }//
               }// using
               }//if

               return flag;
        }