예제 #1
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;
        }
예제 #2
0
        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
        }
예제 #3
0
        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;
        }
예제 #4
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;
        }
예제 #5
0
        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;
        }
예제 #6
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 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;
 }
예제 #8
0
        public static IEnumerable<DirectDebitWrokFlowDetails> DetailsByDirectDebitWorkFlowRecordList(String DirectDebitID, String DueDate)
        {
            IEnumerable<DirectDebitWrokFlowDetails> List = null;
             using (var context = new SycousCon())
             {
                 try
                 {
                     var parDirectDebit = new SqlParameter
                     {
                         ParameterName = "DirectDebitID",
                         Value =  Convert.ToInt32(DirectDebitID),
                         Direction = ParameterDirection.Input
                     };
                     var parDueDate = new SqlParameter
                     {
                         ParameterName = "DueDate",
                         Value = Commmon.DateGB(DueDate.ToString()),
                         Direction = ParameterDirection.Input
                     };

                     List = context.ExecuteStoreQuery<DirectDebitWrokFlowDetails>("exec SYCOUS.GetDetailsByDirectDebit @DirectDebitID,@DueDate", parDirectDebit, parDueDate).ToList();
                 }
                 catch (Exception ex)
                 {
                     context.Dispose();
                     throw;
                 }
             }//using
             return List;
        }
예제 #9
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;
 }
예제 #10
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;
 }
예제 #11
0
        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;
        }
예제 #12
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;
 }
예제 #13
0
        public static IEnumerable<ConsumerSearchList> GetContactConsumerList()
        {
            IEnumerable<ConsumerSearchList> List = null;
            try
            {
                using (var context = new SycousCon())
                {
                    try
                    {
                        var parmode = new SqlParameter
                        {
                            ParameterName = "mode",
                            Value = 1,
                            Direction = ParameterDirection.Input
                        };
                        List = context.ExecuteStoreQuery<ConsumerSearchList>("exec [SYCOUS].[GetConsumerContactList] @mode", parmode).ToList();
                    }
                    catch (Exception ex)
                    {
                        context.Dispose();
                        throw;
                    }
                }//using
            }
            catch (Exception ex)
            {
                throw;
            }

            return List;
        }
예제 #14
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;
        }
예제 #15
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;
        }
예제 #16
0
        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;
        }
예제 #17
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;
        }
예제 #18
0
        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;
        }
예제 #19
0
 public static UnitMaster EditUnit(Int32 unitId)
 {
     UnitMaster unit = new UnitMaster();
     using (var context = new SycousCon())
     {
         try
         {
             unit = context.UnitMasters.SingleOrDefault(s => s.ID == unitId);
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
     return unit;
 }
예제 #20
0
 public static TemperatureDifference EditTemperatureDifference(Int64 tempID)
 {
     TemperatureDifference Temp = new TemperatureDifference();
     using (var context = new SycousCon())
     {
         try
         {
             Temp = context.TemperatureDifferences.SingleOrDefault(s => s.ID == tempID);
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
     return Temp;
 }
예제 #21
0
 public static FlowTemperature EditFlowTemperature(Int64 FlowID)
 {
     FlowTemperature Flow = new FlowTemperature();
     using (var context = new SycousCon())
     {
         try
         {
             Flow = context.FlowTemperatures.SingleOrDefault(s => s.ID == FlowID);
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
     return Flow;
 }
예제 #22
0
 public static UnOccupiedProperty EditUnOccupiedProperty(Int64 UnOccupiedID)
 {
     UnOccupiedProperty occupied = new UnOccupiedProperty();
        using (var context = new SycousCon())
        {
        try
        {
            occupied = context.UnOccupiedProperties.SingleOrDefault(s => s.ID == UnOccupiedID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return occupied;
 }
예제 #23
0
 public static Supplier EditSupply(Int64 SupplyId)
 {
     Supplier supply = new Supplier();
     using (var context = new SycousCon())
     {
         try
         {
             supply = context.Suppliers.SingleOrDefault(s => s.ID == SupplyId);
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
     return supply;
 }
예제 #24
0
 public static PeerNConsumerAverage EditPeerConsumerAverages(Int64 PeerID)
 {
     PeerNConsumerAverage peer = new PeerNConsumerAverage();
     using (var context = new SycousCon())
     {
         try
         {
             peer = context.PeerNConsumerAverages.SingleOrDefault(s => s.ID == PeerID);
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
     return peer;
 }
예제 #25
0
 public static Owner EditOwner(Int64 OwnerID)
 {
     Owner owner = new Owner();
        using (var context = new SycousCon())
        {
        try
        {
            owner = context.Owners.SingleOrDefault(s => s.ID == OwnerID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return owner;
 }
예제 #26
0
 public static NotificationMaster EditNotification(Int32 NotifyID)
 {
     NotificationMaster Notify = new NotificationMaster();
        using (var context = new SycousCon())
        {
        try
        {
            Notify = context.NotificationMasters.SingleOrDefault(s => s.NotificationID == NotifyID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return Notify;
 }
예제 #27
0
 public static Energy EditEnergy(Int32 energyID)
 {
     Energy energy = new Energy();
       using (var context = new SycousCon())
       {
       try
       {
           energy = context.Energies.SingleOrDefault(s => s.ID == energyID);
       }
       catch (Exception ex)
       {
           context.Dispose();
           throw;
       }
       }
       return energy;
 }
예제 #28
0
 public static ReadFrequency EditReadFrequency(Int32 FrequencyID)
 {
     ReadFrequency Frequency = new ReadFrequency();
        using (var context = new SycousCon())
        {
        try
        {
            Frequency = context.ReadFrequencies.SingleOrDefault(s => s.ID == FrequencyID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return Frequency;
 }
예제 #29
0
 public static SiteCreditControl EditSiteCreditControl(Int64 creditId)
 {
     SiteCreditControl control = new SiteCreditControl();
     using (var context = new SycousCon())
     {
         try
         {
             control = context.SiteCreditControls.SingleOrDefault(s => s.ID == creditId);
         }
         catch (Exception ex)
         {
             context.Dispose();
             throw;
         }
     }
     return control;
 }
예제 #30
0
 public static Payment PaymentEdit(Int64 paymentID)
 {
     Payment _payment = new Payment();
        using (var context = new SycousCon())
        {
        try
        {
            _payment = context.Payments.SingleOrDefault(s => s.ID == paymentID);
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return _payment;
 }