Example #1
0
 public static void DeleteRecord(Record record)
 {
     DataLayer dl = new DataLayer();
     String type = record.GetType().ToString();
     dl.DeleteRecord(Utilities.ToLong(record.RecordId), type.Substring(type.LastIndexOf(".") + 1, (type.Length - (type.LastIndexOf(".") + 1))));
 }
Example #2
0
 public static void DeleteRecord(long id, Type recordType)
 {
     DataLayer temp = new DataLayer();
     String type = recordType.ToString();
     temp.DeleteRecord(id, type.Substring(type.LastIndexOf(".") + 1, (type.Length - (type.LastIndexOf(".") + 1))));
 }
Example #3
0
 public static List<SiteGroup> ListSiteGroup(int? orgId, int? siteGroupId)
 {
     DataLayer dataLayer = new DataLayer();
     List<SiteGroup> result = dataLayer.ListSiteGroup(orgId, siteGroupId);
     if (result != null && result.Count > 0)
     {
         foreach (SiteGroup siteGroup in result)
         {
             siteGroup.Sites = dataLayer.ListSiteBySiteGroup(siteGroup.SiteGroupId, null);
         }
     }
     return result;
 }
Example #4
0
 public static void SaveAspRole(string applicationName, List<AspRole> saveList, string currentUser)
 {
     if (saveList != null)
     {
         DataLayer dataLayer = new DataLayer();
         foreach (AspRole item in saveList)
         {
             if (item.IsDeleted && item.RoleId != Guid.Empty && item.CanDelete)
             {
                 dataLayer.DeleteAspRole(item);
             }
             else if (item.IsChanged)
             {
                 if (!string.IsNullOrEmpty(item.RoleName))
                     item.LoweredRoleName = item.RoleName.ToLower();
                 else
                     item.LoweredRoleName = item.RoleName = string.Empty;
                 dataLayer.SaveAspRole(applicationName, item, currentUser);
             }
         }
     }
 }
Example #5
0
 public static List<Site> ListSiteBySiteGroup(int? siteGroupId, bool? showLegacy, bool loadContact)
 {
     DataLayer dataLayer = new DataLayer();
     List<Site> result = dataLayer.ListSiteBySiteGroup(siteGroupId, showLegacy);
     if (loadContact)
     {
         foreach (Site site in result)
         {
             if (site.ContactInformationID > 0)
             {
                 List<ContactInformation> contacts = dataLayer.ListContactInformation(site.ContactInformationID);
                 if (contacts.Count > 0)
                 {
                     site.ContactInformation = contacts[0];
                 }
             }
         }
     }
     return result;
 }
Example #6
0
 public static List<Organisation> ListOrganisation(Guid? roleId)
 {
     DataLayer dataLayer = new DataLayer();
     List<Organisation> result = dataLayer.ListOrganisation();
     if (roleId.HasValue)
     {
         foreach (Organisation org in result)
         {
             org.ContactInformation = dataLayer.ListContactInformation(org.ContactInformationId).FirstOrDefault();
             org.OrgAdminUsers = dataLayer.ListUserRoleAuth(org.OrganisationId, null, roleId.Value);
         }
     }
     return result;
 }
Example #7
0
 public static List<AspUser> ListOrgAdminAspUser(int orgId, Guid roleId)
 {
     DataLayer dataLayer = new DataLayer();
     List<AspUser> result = new List<AspUser>();
     List<UserRoleAuth> uraList = dataLayer.ListUserRoleAuth(orgId, null, roleId);
     if (uraList != null)
     {
         foreach (UserRoleAuth ura in uraList)
         {
             result.AddRange(dataLayer.ListAspUser(orgId, ura.UserId, null));
         }
         result = result.OrderByDescending(i => i.LastActivityDate).ToList();
     }
     return result;
 }
Example #8
0
        public static List<Customer> ListCustomer(int? orgId, int? customerId, string firstName, string lastName,
            int? siteId, bool hasContracts, DateTime? contractDateStart, DateTime? contractDateEnd, bool includeLegacy)
        {
            DataLayer dl = new DataLayer();
            List<Customer> result = dl.ListCustomer(orgId, customerId, firstName, lastName, siteId, hasContracts, contractDateStart, contractDateEnd, includeLegacy);
            if (result != null)
            {
                foreach (Customer cus in result)
                {
                    cus.ContactInformation = dl.ListContactInformation(cus.ContactInformationId).FirstOrDefault();

                }
            }
            return result;
        }
Example #9
0
        public static List<BookingPayment> ListBookingPayment(int? orgId, int? siteId, int? roomId, int? bookingId, int? bookingPaymentId,
            DateTime dateStart, DateTime dateEnd, int payment)
        {
            DataLayer dataLayer = new DataLayer();
            //Generate the payment first if not exist;
            List<BookingPayment> firstList = dataLayer.ListBookingPayment(orgId, siteId, roomId, bookingId, bookingPaymentId, dateStart, dateEnd, payment);
            List<BookingPayment> saveList = new List<BookingPayment>();
            foreach (BookingPayment item in firstList)
            {
                if (!item.NullableRecordId.HasValue)
                {
                    item.IsChanged = true;
                    item.TotalPrice = item.RoomPrice + item.EquipmentPrice + item.ServicePrice;
                    item.CreatedBy = "Automation";
                    saveList.Add(item);
                }
            }

            if (saveList.Count > 0)
            {
                SaveBookingPayment(saveList);
                firstList = dataLayer.ListBookingPayment(orgId, siteId, roomId, bookingId, bookingPaymentId, dateStart, dateEnd, payment);
            }

            return firstList;
        }