예제 #1
0
        public static bool AddUser(UserDTO ud)
        {
            Random rand = new Random();//הגרלה לא תקינה
            int    i    = rand.Next(100000, 999999);
            User   u    = UserDTO.ToDal(ud);

            if (ud.Email != null)
            {
                ud.UserName = ud.Email;
                ud.Password = ud.Email.Substring(0, 2) + i.ToString();
            }//יותר לפי firstname
            else
            {
                ud.UserName = ud.FirstName.Substring(1, 4) + ud.LastName.Substring(1, 4);
                ud.Password = ud.UserName.Substring(1, 3) + i.ToString();
            }
            Mailsend.Mailnewuser(ud);
            // else
            //sms
            int id = UserDAL.AddUser(u);

            if (id != 0 && ud.Dock != null)
            {
                Document doc = new Document();
                doc.DocCoding = ud.Dock;
                doc.DocUser   = id;
                doc.type      = 7;
                doc.DocName   = ud.DocName;
                DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                return(true);
            }
            return(false);
        }
예제 #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);
        }
예제 #3
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);
        }
예제 #4
0
파일: RenterBL.cs 프로젝트: leahr0040/C-
 public static bool UpdateRenter(UserDTO ud)
 {
     if (ud.Dock != null)
     {
         Document doc = new Document();
         doc.DocCoding = ud.Dock;
         doc.DocUser   = ud.UserID;
         doc.type      = 4;
         doc.DocName   = ud.DocName;
         DocumentBL.AddUserDocuments(new DocumentDTO(doc));
     }
     return(UserBL.UpdateUser(ud));
 }
예제 #5
0
파일: RentalBL.cs 프로젝트: leahr0040/C-
        public static bool UpdateRental(RentalDTO rd)
        {
            using (ArgamanExpressEntities db = new ArgamanExpressEntities())
            {
                Rental r = db.Rentals.Find(rd.RentalID);
                r.PropertyID    = rd.PropertyID;
                r.SubPropertyID = rd.SubPropertyID;
                r.UserID        = rd.UserID;
                r.RentPayment   = rd.RentPayment;
                r.PaymentTypeID = rd.PaymentTypeID;
                r.EnteryDate    = rd.EnteryDate;
                r.EndDate       = rd.EndDate;
                if (r.ContactRenew != rd.ContactRenew)
                {
                    if (rd.ContactRenew == true && rd.EndDate.Value < DateTime.Today.AddMonths(3))
                    {
                        Bl.TaskBL.AddRenewTask(rd.PropertyID, rd.SubPropertyID);
                    }
                    else
                    {
                        getAllTasks_Result task = db.getAllTasks().Where(t => t.PropertyID == rd.PropertyID && t.TaskTypeId == 2 && t.status == true && t.SubPropertyID == rd.SubPropertyID).FirstOrDefault();
                        if (task != null)
                        {
                            Bl.TaskBL.DeleteTask(task.TaskID);
                        }
                    }
                }
                r.ContactRenew = rd.ContactRenew;

                if (rd.Dock != null)
                {
                    Document doc = new Document();
                    doc.DocCoding = rd.Dock;
                    doc.DocUser   = rd.RentalID;
                    doc.type      = 3;
                    doc.DocName   = rd.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                }
                db.SaveChanges();
                return(true);
            }
            return(false);
        }
예제 #6
0
        public static bool UpdateTask(TaskDTO td)
        {
            using (ArgamanExpressEntities db = new ArgamanExpressEntities())
            {
                Dal.Task t = db.Tasks.Find(td.TaskID);


                t.TaskTypeId             = td.TaskTypeId;
                t.Description            = td.Description;
                t.PropertyID             = td.PropertyID;
                t.SubPropertyID          = td.SubPropertyID;
                t.ClassificationID       = td.ClassificationID;
                t.ClientClassificationID = td.ClientClassificationID;
                t.ReportDate             = td.ReportDate;
                t.DateForHandling        = td.DateForHandling;
                t.IsHandled = td.IsHandled;
                if (td.IsHandled == true)
                {
                    t.status = false;
                }
                else
                {
                    t.status = true;
                }

                t.HandlingDate = td.HandlingDate;
                t.HandlingWay  = td.HandlingWay;
                if (td.Dock != null)
                {
                    Document doc = new Document();
                    doc.DocCoding = td.Dock;
                    doc.DocUser   = td.TaskID;
                    doc.type      = 6;
                    doc.DocName   = td.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                    return(true);
                }
                db.SaveChanges();
                return(true);
            }
            return(false);
        }
예제 #7
0
        public static bool AddTask(TaskDTO td)
        {
            Dal.Task t  = TaskDTO.ToDal(td);
            int      id = TaskDAL.AddTask(t);

            if (id != 0)
            {
                if (td.Dock != null)
                {
                    Document doc = new Document();
                    doc.DocCoding = td.Dock;
                    doc.DocUser   = id;
                    doc.type      = 6;
                    doc.DocName   = td.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                }
                return(true);
            }
            return(false);
        }
예제 #8
0
        public static bool AddPropertyOwner(PropertyOwnerDTO pod)
        {
            PropertiesOwner poDal = PropertyOwnerDTO.ToDal(pod);
            int             id    = PropertyOwnerDAL.AddPropertyOwner(poDal);

            if (id != 0)
            {
                if (pod.Dock != null)
                {
                    Document doc = new Document();
                    doc.DocCoding = pod.Dock;
                    doc.DocUser   = id;
                    doc.type      = 2;
                    doc.DocName   = pod.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                }
                return(true);
            }
            return(false);
        }
예제 #9
0
        public static bool AddSubProperty(SubPropertyDTO spd)
        {
            SubProperty sp = SubPropertyDTO.ToDal(spd);
            int         id = SubPropertyDAL.AddSubProperty(sp);

            if (id != 0)
            {
                if (spd.Dock != null)

                {
                    Document doc = new Document();
                    doc.DocCoding = spd.Dock;
                    doc.DocUser   = id;
                    doc.type      = 5;
                    doc.DocName   = spd.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                }
                return(true);
            }
            return(false);
        }
예제 #10
0
파일: RenterBL.cs 프로젝트: leahr0040/C-
        public static bool AddRenter(UserDTO ud)
        {
            ud.RoleID = 3;
            User u  = UserDTO.ToDal(ud);
            int  id = UserDAL.AddUser(u);

            if (id != 0)
            {
                if (ud.Dock != null)
                {
                    Document doc = new Document();
                    doc.DocCoding = ud.Dock;
                    doc.DocUser   = id;
                    doc.type      = 4;
                    doc.DocName   = ud.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                }
                return(true);
            }
            return(false);
        }
예제 #11
0
        public static bool AddProperty(PropertyDTO d)
        {
            d.status = true;
            Property p  = PropertyDTO.Todal(d);
            int      id = PropertyDAL.AddProperty(p);

            if (id != 0)
            {
                if (d.Dock != null)

                {
                    Document doc = new Document();
                    doc.DocCoding = d.Dock;
                    doc.DocUser   = id;
                    doc.type      = 1;
                    doc.DocName   = d.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                }
                return(true);
            }
            return(false);
        }
예제 #12
0
 public static bool UpdatePropertyOwner(PropertyOwnerDTO po)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         PropertiesOwner pro = db.PropertiesOwners.Find(po.OwnerID);
         pro.OwnerFirstName = po.OwnerFirstName;
         pro.OwnerLastName  = po.OwnerLastName;
         pro.Phone          = po.Phone;
         pro.Email          = po.Email;
         if (po.Dock != null)
         {
             Document doc = new Document();
             doc.DocCoding = po.Dock;
             doc.DocUser   = po.OwnerID;
             doc.type      = 2;
             doc.DocName   = po.DocName;
             DocumentBL.AddUserDocuments(new DocumentDTO(doc));
         }
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
예제 #13
0
파일: RentalBL.cs 프로젝트: leahr0040/C-
        public static bool AddRental(RentalDTO rd)
        {
            Rental r  = RentalDTO.ToDal(rd);
            int    id = RentalDAL.AddRental(r);

            if (id != 0)
            {
                if (rd.Dock != null)
                {
                    Document doc = new Document();
                    doc.DocCoding = rd.Dock;
                    doc.DocUser   = id;
                    doc.type      = 3;
                    doc.DocName   = rd.DocName;
                    DocumentBL.AddUserDocuments(new DocumentDTO(doc));
                }
                if (rd.ContactRenew == true && (rd.EndDate).Value < DateTime.Today.AddMonths(3))
                {
                    Bl.TaskBL.AddRenewTask(rd.PropertyID, rd.SubPropertyID);
                }
                return(true);
            }
            return(false);
        }