Example #1
0
        public static List <PropertyDTO> Search(string cityName, string streetName, string number, Nullable <int> floor, Nullable <double> roomsNum)
        {
            using (ArgamanExpressEntities db = new ArgamanExpressEntities())
            {
                List <Property> pro;
                pro = (from p in db.Properties select p).ToList();
                if (cityName != null)
                {
                    pro = (from p in pro where p.CityName.Contains(cityName) select p).ToList();
                }
                if (streetName != null)
                {
                    pro = (from p in pro where p.StreetName.Contains(streetName) select p).ToList();
                }
                if (number != null)
                {
                    pro = (from p in pro where p.Number.Contains(number) select p).ToList();
                }
                if (floor != null)
                {
                    pro = (from p in pro where p.Floor == floor select p).ToList();
                }

                List <PropertyDTO> prodto = new List <PropertyDTO>();
                foreach (Property p in pro)
                {
                    prodto.Add(new PropertyDTO(p));
                }
                return(prodto);
            }
            return(null);
        }
Example #2
0
        public static bool UpdateProperty(PropertyDTO pd)
        {
            using (ArgamanExpressEntities db = new ArgamanExpressEntities())
            {
                Property p = db.Properties.Find(pd.PropertyID);

                p.OwnerID          = pd.OwnerID;
                p.CityID           = pd.CityID;
                p.StreetID         = pd.StreetID;
                p.Number           = pd.Number;
                p.Size             = pd.Size;
                p.Floor            = pd.Floor;
                p.IsDivided        = pd.IsDivided;
                p.ManagmentPayment = pd.ManagmentPayment;
                p.IsPaid           = pd.IsPaid;
                p.IsExclusivity    = pd.IsExclusivity;
                p.ExclusivityID    = pd.ExclusivityID;
                p.IsWarranty       = pd.IsWarranty;
                p.IsRented         = pd.IsRented;
                p.RoomsNum         = pd.RoomsNum;
                p.ApartmentNum     = pd.ApartmentNum;
                if (pd.Dock != null)
                {
                    Document doc = new Document();
                    doc.DocCoding = pd.Dock;
                    doc.DocUser   = pd.PropertyID;
                    doc.type      = 1;
                    doc.DocName   = pd.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                }
                db.SaveChanges();
                return(true);
            }
            return(false);
        }
Example #3
0
 public static bool UpdatePropertyOwner(PropertyOwnerDTO po)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         PropertiesOwner pro = db.PropertiesOwners.Find(po.OwnerID);
         pro.OwnerID           = p.OwnerID;
         pro.CityID            = p.CityID;
         this.CityName         = p.CityName;
         this.StreetID         = p.StreetID;
         this.StreetName       = p.StreetName;
         this.Number           = p.Number;
         this.Size             = p.Size;
         this.Floor            = p.Floor;
         this.IsDivided        = p.IsDivided;
         this.ManagmentPayment = p.ManagmentPayment;
         this.IsPaid           = p.IsPaid;
         this.IsExclusivity    = p.IsExclusivity;
         this.ExclusivityID    = p.ExclusivityID;
         this.IsWarranty       = p.IsWarranty;
         this.IsRented         = p.IsRented;
         this.RoomsNum         = p.RoomsNum;
         this.ApartmentNum     = p.ApartmentNum;
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
Example #4
0
        public static bool UpdateSubProperty(SubPropertyDTO spd)
        {
            using (ArgamanExpressEntities db = new ArgamanExpressEntities())
            {
                SubProperty sp = db.SubProperties.Find(spd.SubPropertyID);


                sp.num      = spd.num;
                sp.IsRented = spd.IsRented;
                sp.Size     = spd.Size;
                sp.RoomsNum = spd.RoomsNum;
                if (spd.Dock != null)
                {
                    Document doc = new Document();
                    doc.DocCoding = spd.Dock;
                    doc.DocUser   = spd.SubPropertyID;
                    doc.type      = 5;
                    doc.DocName   = spd.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                }
                db.SaveChanges();
                return(true);
            }
            return(false);
        }
Example #5
0
        public static List <PropertyOwnerDTO> Search(string OwnerFirstName, string OwnerLastName, string Phone, string Email)
        {
            using (ArgamanExpressEntities db = new ArgamanExpressEntities())
            {
                List <PropertiesOwner> po;
                po = (from p in db.PropertiesOwners select p).ToList();
                if (OwnerFirstName != null)
                {
                    po = (from p in po where p.OwnerFirstName.Contains(OwnerFirstName) select p).ToList();
                }
                if (OwnerLastName != null)
                {
                    po = (from p in po where p.OwnerLastName.Contains(OwnerLastName) select p).ToList();
                }
                if (Phone != null)
                {
                    po = (from p in po where p.Phone.Contains(Phone) select p).ToList();
                }
                if (Email != null)
                {
                    po = (from p in po where p.Email.Contains(Email) select p).ToList();
                }

                List <PropertyOwnerDTO> podto = new List <PropertyOwnerDTO>();
                foreach (PropertiesOwner p in po)
                {
                    podto.Add(new PropertyOwnerDTO(p));
                }
                return(podto);
            }
            return(null);
        }
Example #6
0
        public static void Mailforgotpasword(User ud)
        {
            using (ArgamanExpressEntities db = new ArgamanExpressEntities())
            {
                try
                {
                    MailMessage mail       = new MailMessage();
                    SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");

                    mail.From = new MailAddress("*****@*****.**");
                    mail.To.Add(ud.Email);
                    // mail.Bcc.Add(mail1);
                    mail.Subject    = "כניסת משתמש לאתר ארגמן אקספרס";
                    mail.IsBodyHtml = true;

                    string ht = @"<html>
                    <body style='color:blueviolet;font-size:150%'>
          <a style='font-size:120%;font-family:'Gill Sans','Gill Sans MT',Calibri,'Trebuchet MS',sans-serif;text-align:left'> ברוכים הבאים" + ud.FirstName + " " + ud.LastName + @" </a><br/>הסיסמה שלך: " + ud.Password + @"
                <br/><a href='http://ArgamanExpress.co.il/'>כניסה לאתר</a></body></html>";

                    // < input type = 'date' id = 'date1' onchange = 'document.getElementById('link').href+=document.getElementById('date1').value' >
                    mail.Body              = ht;
                    SmtpServer.Port        = 587;
                    SmtpServer.Credentials = new System.Net.NetworkCredential("argamanexpress", "es211860663");
                    SmtpServer.EnableSsl   = true;

                    SmtpServer.Send(mail);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }
Example #7
0
 public static bool DailySet()
 {
     try
     {
         using (ArgamanExpressEntities db = new ArgamanExpressEntities())
         {
             foreach (Dal.Task task in db.Tasks)
             {
                 if (task.IsHandled != true && task.ClassificationID != null)
                 {
                     if (task.DateForHandling.Date <= DateTime.Now.Date || (task.TaskTypeId != 1 && task.TaskTypeId != 4 && (task.DateForHandling.Date - DateTime.Now.Date).Days <= 30))
                     {
                         task.ClassificationID = 1;
                     }
                     else if (task.ClassificationID != 1 && ((task.DateForHandling.Date - DateTime.Now.Date).Days <= 7 || (task.TaskTypeId != 1 && task.TaskTypeId != 4 && (task.DateForHandling.Date - DateTime.Now.Date).Days <= 60)))
                     {
                         task.ClassificationID = 2;
                     }
                 }
             }
             db.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
Example #8
0
 public static List <TaskDTO> GetTimePassedTasks()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <Dal.Task> tasks = (from t in db.Tasks where t.status == true && t.IsHandled == false && t.DateForHandling < DateTime.Today select t).ToList();
         return(ConvertListToDTO(tasks));
     }
 }
Example #9
0
 public static List <TaskDTO> GetAllTasks()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <getAllTasks_Result> tasks = (from t in db.getAllTasks() select t).OrderBy(t => t.ClassificationID).OrderBy(t => t.DateForHandling).ToList();
         return(ConvertListToDTO(tasks));
     }
 }
Example #10
0
 public static PropertyDTO GetPropertyByID(int id)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         Property property = db.Properties.Find(id);
         return(new PropertyDTO(property));
     }
 }
Example #11
0
 public static List <SubPropertyDTO> GetAllSubProperties()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <SubProperty> subProperties = (from sp in db.SubProperties select sp).OrderBy(sp => sp.IsRented).ToList();
         return(ConvertListToDTO(subProperties));
     }
 }
Example #12
0
 public static List <TaskDTO> GetAllarchivesTasks()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <Dal.Task> tasks = (from t in db.Tasks where t.status == false select t).OrderBy(t => t.DateForHandling).ToList();
         return(ConvertListToDTO(tasks));
     }
 }
Example #13
0
 public static SubPropertyDTO GetSubPropertyByID(int id)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         SubProperty subProperty = db.SubProperties.Find(id);
         return(new SubPropertyDTO(subProperty));
     }
 }
Example #14
0
 public static List <PropertyOwnerDTO> getAllOwners()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <getAllPropertiesOwners_Result> owners = (from o in db.getAllPropertiesOwners() select o).OrderBy(o => o.OwnerFirstName).OrderBy(o => o.OwnerLastName).ToList();
         return(ConvertListToDTO(owners));
     }
 }
Example #15
0
 public static List <PropertyDTO> Return_Details_user(string userNam, string Passwor)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         int u = (from a in db.Users where userNam == a.UserName && Passwor == a.Password select a.UserID).FirstOrDefault();
         return(RenterBL.getPropertiesbyRenterID(u));
     }
 }
Example #16
0
 public static List <TaskDTO> GetNotClassificatedTasks()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <Dal.Task> tasks = (from t in db.Tasks where (t.status == true && t.ClassificationID == 0 || t.ClassificationID == null) select t).ToList();
         return(ConvertListToDTO(tasks));
     }
 }
Example #17
0
 public static List <UserDTO> GetAllRenters()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <User> renters = (from r in db.Users where r.status == true select r).ToList();
         return(RenterBL.ConvertListToDTO(renters));
     }
 }
Example #18
0
 public static List <UserDTO> GetAllRenters()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <getAllUsers_Result> renters = (from r in db.getAllUsers() where r.RoleID == 3  select r).OrderBy(r => r.FirstName).OrderBy(r => r.LastName).ToList();
         return(ConvertListToDTO(renters));
     }
 }
Example #19
0
        public static List <RentalDTO> GetAllRentals()
        {
            using (ArgamanExpressEntities db = new ArgamanExpressEntities())
            {
                List <getAllRentals_Result> pro = (from r in db.getAllRentals() select r).OrderBy(r => r.EndDate).ToList();

                return(ConvertListToDTO(pro));
            }
        }
Example #20
0
 public static List <PropertyDTO> GetAllProperties()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <getAllProperties_Result> pro = (from p in  db.getAllProperties() select p).
                                              OrderBy(p => p.CityID).OrderBy(p => p.StreetID).ToList();
         return(ConvertListToDTO(pro));
     }
 }
Example #21
0
 public static bool DeleteTask(int id)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         Dal.Task t = db.Tasks.Find(id);
         t.status = false;
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
Example #22
0
 public static bool DeleteProperty(int id)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         Property p = db.Properties.Find(id);
         p.status = false;
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
Example #23
0
 public static bool AddTaskType(string name)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         TaskType taskType = new TaskType();
         taskType.TaskTypeName = name;
         db.TaskTypes.Add(taskType);
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
Example #24
0
        public static bool DeleteUser(int id)
        {
            using (ArgamanExpressEntities db = new ArgamanExpressEntities())
            {
                User t = db.Users.Find(id);
                t.status = false;

                db.SaveChanges();
                return(true);
            }
            return(false);
        }
Example #25
0
 public static bool DeleteRental(int id)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         Rental p = db.Rentals.Find(id);
         p.Property.IsRented = false;
         p.status            = false;
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
Example #26
0
 public static List <SubPropertyDTO> ConvertListToDTO(List <SubProperty> subProperties)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <SubPropertyDTO> spdto = new List <SubPropertyDTO>();
         foreach (SubProperty sp in subProperties)
         {
             spdto.Add(new SubPropertyDTO(sp));
         }
         return(spdto);
     }
     return(null);
 }
Example #27
0
 public static List <TaskDTO> ConvertListToDTO(List <getAllTasks_Result> tasks)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <TaskDTO> tdto = new List <TaskDTO>();
         foreach (getAllTasks_Result t in tasks)
         {
             tdto.Add(new TaskDTO(t));
         }
         return(tdto);
     }
     return(null);
 }
Example #28
0
 public static List <PropertyDTO> ConvertListToDTO(List <getAllProperties_Result> pro)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <PropertyDTO> prodto = new List <PropertyDTO>();
         foreach (getAllProperties_Result p in pro)
         {
             prodto.Add(new PropertyDTO(p));
         }
         return(prodto);
     }
     return(null);
 }
Example #29
0
 public static List <DocumentDTO> GetAllDocuments()
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <getAllDocuments_Result> documents = (from d in db.getAllDocuments() select d).ToList();
         List <DocumentDTO>            docks     = new List <DocumentDTO>();
         foreach (getAllDocuments_Result document in documents)
         {
             docks.Add(new DocumentDTO(document));
         }
         return(docks);
     }
 }
Example #30
0
 public static List <DocumentDTO> GetUserDocuments(int id, int type)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         List <Document>    documents = (from d in db.Documents where d.DocUser == id && d.type == type select d).ToList();
         List <DocumentDTO> docks     = new List <DocumentDTO>();
         foreach (Document document in documents)
         {
             docks.Add(new DocumentDTO(document));
         }
         return(docks);
     }
 }