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;
 }
示例#2
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;
        }
示例#3
0
        public static IEnumerable<DirectDebitConsumerDropdown> DirectDebitConsumerDropdownList(String ConsumerType,String ClientID)
        {
            IEnumerable<DirectDebitConsumerDropdown> List = null;
            try
            {
                using (var context = new SycousCon())
                {
                    var pConsumerType = new SqlParameter
                    {
                        ParameterName = "ConsumerType",
                        Value = ConsumerType,
                        Direction = ParameterDirection.Input
                    };
                    var pClientID = new SqlParameter
                    {
                        ParameterName = "ClientID",
                        Value = ClientID,
                        Direction = ParameterDirection.Input
                    };

                    List = context.ExecuteStoreQuery<DirectDebitConsumerDropdown>("exec SYCOUS.GetDirectDebitConsumerList @ConsumerType,@ClientID", pConsumerType, pClientID).ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return List;
        }
示例#4
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;
        }
示例#5
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;
        }
示例#6
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;
        }
示例#7
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;
        }
示例#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 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;
 }
示例#10
0
 public static String OwnerClientName(Int64 OwnerID)
 {
     String ClientName = String.Empty;
        using (var context = new SycousCon())
        {
        try
        {
            var _ClientName = (from O in context.Owners
                                    join P in  context.Properties
                                      on O.PropertyID equals P.ID
                                      join S in  context.SiteMasters
                                     on O.SiteID equals S.Id
                                      join C in context.ClientMasters
                                      on S.ClientID equals C.ClientID
                                      where (O.IsDeleted==0 && P.IsDeleted==0 && S.IsDeleted==0 && C.DeleteStatus==0&& O.ID==OwnerID)
                                      select C.Name
                                 ).FirstOrDefault();
            if (_ClientName != null)
            {
                ClientName = (String)_ClientName;
            }
        }
        catch (Exception ex)
        {
            context.Dispose();
            throw;
        }
        }
        return ClientName;
 }
示例#11
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
        }
示例#12
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;
        }
示例#13
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;
 }
示例#14
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;
        }
示例#15
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;
        }
示例#16
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;
        }
示例#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;
        }
        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;
        }
示例#19
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
        }
示例#20
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;
 }
示例#21
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;
        }
示例#22
0
        public static IEnumerable<DirectDebitWrokFlow> DirectDebitWorkFlowRecordList(String ProcessingDate)
        {
            IEnumerable<DirectDebitWrokFlow> List = null;
            using (var context = new SycousCon())
            {
                try
                {
                    var parDate = new SqlParameter
                    {
                        ParameterName = "ProcessingDate",
                        Value = Commmon.DateGB(ProcessingDate.ToString()),
                        Direction = ParameterDirection.Input
                    };
             // List = context.ExecuteStoreQuery<DirectDebitWrokFlow>("exec SYCOUS.GenerateDirectDebitWorkFlow @ProcessingDate", parDate).ToList();

                    List = context.ExecuteStoreQuery<DirectDebitWrokFlow>("exec SYCOUS.GenerateDirectDebitWorkFlow @ProcessingDate", parDate).ToList();

                }
                catch (Exception ex)
                {
                    context.Dispose();
                    throw;
                }
            }//using
            return List;
        }
示例#23
0
 public static String Get_RoleName(Int32 RoleID)
 {
     String RoleName = String.Empty;
     using (var context = new SycousCon())
     {
         RoleName = (from x in context.Roles.Where(x => x.Role_ID == RoleID) select (x.RoleName)).FirstOrDefault();
     }
     return RoleName;
 }
示例#24
0
        public static List<RoleDescription> RoleDDL()
        {
            using (var context = new SycousCon())
            {  return (from c in context.Roles
                            select new RoleDescription
                            {   RoleID = c.Role_ID,
                                RoleName = c.RoleName
                            }).ToList();

            }
        }
示例#25
0
 public static IEnumerable<EnergyDropdownList> EnergyDropDownList()
 {
     using (var context = new SycousCon())
     {
         return (from c in context.Energies.Where(c => c.IsDeleted == 0)
                 select new EnergyDropdownList
                 {
                     ID = c.ID,
                     EnergyName = c.EnergyName
                 }).ToList();
     }
 }
示例#26
0
 public static IEnumerable<MreterCategory>MreterCategoryDropDownList()
 {
     using (var context = new SycousCon())
        {
        return (from c in context.MeterCategories.Where(c => c.IsDeleted == 0)
                select new MreterCategory
                {
                    ID = c.ID,
                    MeterCategory = c.MeterCategory1
                }).ToList();
        }
 }
示例#27
0
 public static IEnumerable<CommunicationDropdownlist> CommunicationDropdownlist()
 {
     using (var context = new SycousCon())
     {
         return (from c in context.Communications.Where(c => c.IsDeleted == 0)
                 select new CommunicationDropdownlist
                 {
                     ID = c.ID,
                     CommunicationName = c.CommunicationName
                 }).ToList();
     }
 }
示例#28
0
 public static IEnumerable<DataLoggerDropdownlist> DataLoggerDropdownlist()
 {
     using (var context = new SycousCon())
     {
         return (from c in context.DataLoggers.Where(c => c.IsDeleted == 0)
                 select new DataLoggerDropdownlist
                 {
                     ID = c.ID,
                     SerialNumber = c.SerialNumber
                 }).ToList();
     }
 }
示例#29
0
 public static IEnumerable<DepartmentDDL> DepartmentDDList()
 {
     using (var context = new SycousCon())
     {
         return (from c in context.Departments.Where(p => p.DeleteStatus == 0)
                 orderby c.DeptCode
                 select new DepartmentDDL
                 {
                     DepartmentID = c.DeptID,
                     DepartmentCode = c.DeptCode
                 }).ToList();
     }
 }
示例#30
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;
 }