示例#1
0
 private static void SaveMessenger(string toAddress, string messageBody, string messageSubject, bool isBodyHtml)
 {
     try
     {
         var a = db.SystemSettingsDatas.FirstOrDefault(x => x.SettingName == "GmailAddress").SettingValueA ?? "*****@*****.**";
         JazMax.DataAccess.MessengerCoreLog log = new JazMax.DataAccess.MessengerCoreLog()
         {
             DateCreated        = DateTime.Now,
             IsHtml             = isBodyHtml,
             MessageBody        = messageBody,
             MessageFrom        = a,
             MessageTo          = toAddress,
             IsSent             = false,
             MessenegerTypeId   = -1,
             MessageSubject     = messageSubject,
             MessengerTriggerId = 0
         };
         db.MessengerCoreLogs.Add(log);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         ErrorLog.LogError(e, 0);
     }
 }
示例#2
0
 public void CreateNewBranch(CoreBranchView model)
 {
     try
     {
         db.CoreBranches.Add(ConvertViewToModel(model));
         db.SaveChanges();
     }
     catch (Exception e)
     {
         AuditLog.ErrorLog.LogError(db, e, 0);
     }
 }
示例#3
0
        private void CapturePropertyListingFeatures(PropertyListingFeatureView model, int PropetyListingId, FormCollection collection)
        {
            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    string[] ids = collection["PropertyListingFeatureView.PropertyFeatureId"].Split(new char[] { ',' });
                    foreach (var item in ids)
                    {
                        DataAccess.ProprtyListingFeature table = new DataAccess.ProprtyListingFeature()
                        {
                            IsFeatureActive   = true,
                            PropertyListingId = PropetyListingId,
                            PropertyFeatureId = int.Parse(item),
                        };

                        db.ProprtyListingFeatures.Add(table);
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
        }
示例#4
0
        private static int SaveImage(string url, string type, string fileType, string fileName, string fileExtension, int fileSize)
        {
            int BlobStorageId = 0;

            try
            {
                DataAccess.BlobCoreStorage blob = new DataAccess.BlobCoreStorage()
                {
                    BlobFileName      = fileName,
                    BlobFileType      = fileType,
                    BlobType          = type,
                    IsActive          = true,
                    BlobUrl           = url,
                    BlobFileExtension = fileExtension,
                    BlobFileSize      = fileSize
                };
                db.BlobCoreStorages.Add(blob);
                db.SaveChanges();
                BlobStorageId = blob.BlobId;
                return(BlobStorageId);
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 1);
                return(BlobStorageId);
            }
        }
示例#5
0
        private int CaptureListing(PropertyListingView model)
        {
            int ListingId = 0;

            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    DataAccess.PropertyListing table = new DataAccess.PropertyListing()
                    {
                        BranchId        = model.BranchId,
                        FriendlyName    = model.FriendlyName,
                        IsListingActive = true,
                        PropertyListingPricingTypeId = model.PropertyListingPricingTypeId,
                        LastUpdate        = DateTime.Now,
                        ListingDate       = DateTime.Now,
                        Price             = model.Price,
                        PropertyTypeId    = model.PropertyTypeId,
                        ProprtyDesciption = model.ProprtyDesciption,
                        ProvinceId        = model.ProvinceId
                    };
                    db.PropertyListings.Add(table);
                    db.SaveChanges();
                    ListingId = table.PropertyListingId;
                }
            }

            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
            return(ListingId);
        }
示例#6
0
        public int UpdatePropertyListing(PropertyListingView model, int PropertyListingId)
        {
            int Lid = 0;

            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    var listing = db.PropertyListings.FirstOrDefault(x => x.PropertyListingId == PropertyListingId);
                    listing.PropertyListingId            = PropertyListingId;
                    listing.PropertyTypeId               = model.PropertyTypeId;
                    listing.BranchId                     = model.BranchId;
                    listing.ProvinceId                   = model.ProvinceId;
                    listing.FriendlyName                 = model.FriendlyName;
                    listing.Price                        = model.Price;
                    listing.PropertyListingPricingTypeId = model.PropertyListingPricingTypeId;
                    listing.ProprtyDesciption            = model.ProprtyDesciption;
                    listing.IsListingActive              = model.IsListingActive;

                    db.SaveChanges();
                    Lid = listing.PropertyListingId;
                }
            }

            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
            return(Lid);
        }
        public void Update(LeadActivityType model, int CoreSystemUserId)
        {
            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    DataAccess.LeadActivity table = db.LeadActivities.FirstOrDefault(x => x.LeadActivityId == model.LeadActivityId);

                    LoadEditLogDetails(table.LeadActivityId, CoreSystemUserId);

                    JazMax.BusinessLogic.ChangeLog.ChangeLogService.LogChange(table.ActivityName, model.ActivityName, "Activity Name");

                    if (table != null)
                    {
                        table.IsActive     = true;
                        table.ActivityName = model.ActivityName;
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
        }
示例#8
0
        public void Update(PropertyPricingTypesView model, int CoreSystemUserId)
        {
            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    DataAccess.PropertyListingPricingType table = db.PropertyListingPricingTypes.FirstOrDefault(x => x.PropertyListingPricingTypeId == model.PropertyListingPricingTypeId);

                    LoadEditLogDetails(table.PropertyListingPricingTypeId, CoreSystemUserId);

                    JazMax.BusinessLogic.ChangeLog.ChangeLogService.LogChange(table.TypeName, model.TypeName, "Property Price Type");

                    if (table != null)
                    {
                        table.IsActive = true;
                        table.TypeName = model.TypeName;
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
        }
示例#9
0
 public void ArchiveDocument(UploadView upload)
 {
     using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
     {
         DataAccess.CoreFileUpload UploadDocument = new DataAccess.CoreFileUpload();
         UploadDocument          = db.CoreFileUploads.FirstOrDefault(x => x.FileUploadId == upload.FileUploadId);
         UploadDocument.IsActive = false;
         db.SaveChanges();
     }
 }
示例#10
0
 public void RecievedDocuments(UploadView upload)
 {
     using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
     {
         DataAccess.CoreFileUpload UploadDocument = new DataAccess.CoreFileUpload();
         UploadDocument            = db.CoreFileUploads.FirstOrDefault(x => x.FileUploadId == upload.FileUploadId);
         UploadDocument.IsRecieved = true;
         db.SaveChanges();
     }
 }
示例#11
0
        //Uses the current open DB connection to log error
        //This should be used in the Business Logic
        public static void LogError(JazMax.DataAccess.JazMaxDBProdContext dbcontext, Exception e, int coreUserId = 0)
        {
            JazMax.DataAccess.SystemErrorLog a = new JazMax.DataAccess.SystemErrorLog()
            {
                CoreUserId         = 0,
                SystemErrorMessage = e.Message.ToString() != null?e.Message.ToString() : "Bad",
                                         ErrorDateTime = DateTime.Now
            };

            dbcontext.SystemErrorLogs.Add(a);
            dbcontext.SaveChanges();
        }
 public bool Create(CoreProvinceView view)
 {
     try
     {
         if (CheckExist(view.ProvinceName) == false)
         {
             db.CoreProvinces.Add(ConvertToView(view));
             db.SaveChanges();
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         AuditLog.ErrorLog.LogError(db, e, 0);
         return(true);
     }
 }
示例#13
0
        public Guid?CreateUserRole(string roleName)
        {
            Guid random = Guid.NewGuid();

            try
            {
                DataAccess.AspNetRole r = new DataAccess.AspNetRole()
                {
                    Id   = random.ToString(),
                    Name = roleName
                };
                db.AspNetRoles.Add(r);
                db.SaveChanges();

                return(random);
            }
            catch (Exception e)
            {
                AuditLog.ErrorLog.LogError(e, 0);
                return(null);
            }
        }
示例#14
0
 public void BulkRemove(FormCollection Form)
 {
     using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
     {
         string[] ids = Form["FileUploadId"].Split(new char[] { ',' });
         foreach (var item in ids)
         {
             var file = db.CoreFileUploads.Find(int.Parse(item));
             db.CoreFileUploads.Remove(file);
             db.SaveChanges();
         }
     }
 }
示例#15
0
 public static void UpdateMessengerToSent(int Id)
 {
     JazMax.DataAccess.MessengerCoreLog a = db.MessengerCoreLogs.FirstOrDefault(x => x.MessengerCoreLogId == Id);
     try
     {
         a.IsSent            = true;
         a.DateSent          = DateTime.Now;
         a.MessengerResponse = "Sent";
     }
     catch (Exception e)
     {
         a.MessengerResponse = e.Message;
         ErrorLog.LogError(db, e, 0);
     }
     db.SaveChanges();
 }
示例#16
0
 public void UpdatePropertyFeatures(PropertyListingFeatureView model, int PropertyListingId)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             var features = db.ProprtyListingFeatures.FirstOrDefault(x => x.PropertyFeatureId == model.PropertyFeatureId);
             features.IsFeatureActive   = model.IsFeatureActive;
             features.PropertyListingId = PropertyListingId;
             features.PropertyFeatureId = model.PropertyFeatureId;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
示例#17
0
 public void UpdateYoutubeLibrary(PropertyListingYoutubeView model, int PropertyListingId)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             var youtube = db.ProprtyListingYoutubeLibraries.FirstOrDefault(x => x.ProprtyListingYoutubeLibraryId == model.ProprtyListingYoutubeLibraryId);
             youtube.IsVideoActive     = model.IsVideoActive;
             youtube.PrfoprtyListingId = PropertyListingId;
             youtube.YoutubeVideoLink  = model.YoutubeVideoLink;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
示例#18
0
        public void UpdatePropertyAgents(PropertyListingAgentsView model, int PropertyListingId)
        {
            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    var agents = db.PropertyListingAgents.FirstOrDefault(x => x.AgentId == model.AgentId);
                    agents.PropertyListingId = PropertyListingId;
                    agents.IsActive          = model.IsActive;
                    agents.AgentId           = model.AgentId;

                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
        }
示例#19
0
 public void Create(PropertyPricingTypesView model)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             DataAccess.PropertyListingPricingType table = new DataAccess.PropertyListingPricingType()
             {
                 IsActive = true,
                 TypeName = model.TypeName
             };
             db.PropertyListingPricingTypes.Add(table);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
 public void Create(LeadActivityType model)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             DataAccess.LeadActivity table = new DataAccess.LeadActivity()
             {
                 IsActive     = true,
                 ActivityName = model.ActivityName,
                 IsSystem     = model.IsSystemActivity
             };
             db.LeadActivities.Add(table);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
示例#21
0
 public void UpdateListingDetail(PropertyListingDetailView model, int PropertyListingId)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             var Details = db.PropertyListingDetails.FirstOrDefault(x => x.PropertyListingDetailId == model.PropertyListingDetailId);
             Details.RatesAndTaxes        = model.RatesAndTaxes;
             Details.NumberOfBathRooms    = model.NumberOfBathRooms;
             Details.NumberOfBedrooms     = model.NumberOfBedrooms;
             Details.NumberOfGarages      = model.NumberOfGarages;
             Details.NumberOfSquareMeters = model.NumberOfSquareMeters;
             Details.PropertyListingId    = PropertyListingId;
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
示例#22
0
 private void CaptureListingAgents(PropertyListingAgentsView model, int PropetyListingId)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             DataAccess.PropertyListingAgent table = new DataAccess.PropertyListingAgent()
             {
                 PropertyListingId = PropetyListingId,
                 IsActive          = true,
                 AgentId           = model.AgentId
             };
             db.PropertyListingAgents.Add(table);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
示例#23
0
 private void CaptureYoutubeLibrary(PropertyListingYoutubeView model, int PropetyListingId)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             DataAccess.ProprtyListingYoutubeLibrary table = new DataAccess.ProprtyListingYoutubeLibrary()
             {
                 IsVideoActive     = true,
                 PrfoprtyListingId = PropetyListingId,
                 YoutubeVideoLink  = model.YoutubeVideoLink
             };
             db.ProprtyListingYoutubeLibraries.Add(table);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
示例#24
0
        public void CapturePropertyImages(PropertyImagesView model, int PropertyListingId)
        {
            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    DataAccess.PropertyImage table = new DataAccess.PropertyImage()
                    {
                        PropertyImagesId  = model.PropertyImagesId,
                        PropertyListingId = PropertyListingId,
                        BlobId            = model.BlobId,
                        IsActive          = model.IsActive
                    };

                    db.PropertyImages.Add(table);
                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
        }
示例#25
0
 private void CaptureListingDetail(PropertyListingDetailView model, int PropetyListingId)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             DataAccess.PropertyListingDetail table = new DataAccess.PropertyListingDetail()
             {
                 RatesAndTaxes        = model.RatesAndTaxes,
                 NumberOfBathRooms    = model.NumberOfBathRooms,
                 NumberOfBedrooms     = model.NumberOfBedrooms,
                 NumberOfGarages      = model.NumberOfGarages,
                 NumberOfSquareMeters = model.NumberOfSquareMeters,
                 PropertyListingId    = PropetyListingId,
             };
             db.PropertyListingDetails.Add(table);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }
示例#26
0
        public void Activation(bool isAction, int PropertyListingPricingTypeId, int UserId)
        {
            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    DataAccess.PropertyListingPricingType table = db.PropertyListingPricingTypes.FirstOrDefault(x => x.PropertyListingPricingTypeId == PropertyListingPricingTypeId);
                    LoadEditLogDetails(table.PropertyListingPricingTypeId, UserId);

                    if (table != null)
                    {
                        if (isAction)
                        {
                            JazMax.BusinessLogic.ChangeLog.ChangeLogService.LogChange(
                                JazMax.BusinessLogic.ChangeLog.ChangeLogService.GetBoolString(table.IsActive),
                                JazMax.BusinessLogic.ChangeLog.ChangeLogService.GetBoolString(true), "Active Status");

                            table.IsActive = true;
                        }
                        else
                        {
                            JazMax.BusinessLogic.ChangeLog.ChangeLogService.LogChange(
                                JazMax.BusinessLogic.ChangeLog.ChangeLogService.GetBoolString(table.IsActive),
                                JazMax.BusinessLogic.ChangeLog.ChangeLogService.GetBoolString(false), "Active Status");

                            table.IsActive = false;
                        }
                    }
                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
        }
示例#27
0
        public int?CreateNewCoreUser(CoreUserView model)
        {
            int?userId = null;

            try
            {
                DataAccess.CoreUser a = new DataAccess.CoreUser();
                a.CellPhone       = model.CellPhone;
                a.CreatedBy       = model.CreatedBy;
                a.CreatedDate     = DateTime.Now;
                a.EmailAddress    = model.EmailAddress;
                a.FirstName       = model.FirstName;
                a.GenderId        = model.GenderId;
                a.IdNumber        = model.IDNumber;
                a.IsActive        = true;
                a.LastName        = model.LastName;
                a.LastUpdatedDate = DateTime.Now;
                a.MiddleName      = model.MiddleName;
                a.PhoneNumber     = model.PhoneNumber;
                db.CoreUsers.Add(a);
                db.SaveChanges();
                userId = a.CoreUserId;
                AddUserToType(a.CoreUserId, model.CoreUserTypeId);

                //PA
                if (model.CoreUserTypeId == 5)
                {
                    DataAccess.CorePa z = new DataAccess.CorePa()
                    {
                        CoreUserId = userId,
                        ProvinceId = model.CapturePAView.provinceId,
                        IsActive   = true
                    };
                    db.CorePas.Add(z);
                    db.SaveChanges();

                    UpdateProvinceToAssigned(model.CapturePAView.provinceId);
                }

                //TeamLeader
                else if (model.CoreUserTypeId == 3)
                {
                    DataAccess.CoreTeamLeader y = new DataAccess.CoreTeamLeader()
                    {
                        CoreProvinceId = model.CaptureTeamLeader.provinceId,
                        CoreUserId     = userId,
                        IsActive       = true
                    };
                    db.CoreTeamLeaders.Add(y);
                    db.SaveChanges();
                }

                //Agent
                else if (model.CoreUserTypeId == 4)
                {
                    DataAccess.CoreAgent p = new DataAccess.CoreAgent()
                    {
                        CoreBranchId = model.CaptureAgent.BranchId,
                        CoreUserId   = userId,
                        IsActive     = true
                    };
                    db.CoreAgents.Add(p);
                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                AuditLog.ErrorLog.LogError(db, e, 0);
                userId = -1;
            }

            return(userId);
        }