Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 public static SubPropertyDTO GetSubPropertyByID(int id)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         SubProperty subProperty = db.SubProperties.Find(id);
         return(new SubPropertyDTO(subProperty));
     }
 }
Exemplo n.º 3
0
 public SubPropertyDTO(SubProperty sp)
 {
     this.SubPropertyID =sp.SubPropertyID;
     this.PropertyID =sp.PropertyID;
     this.num = sp.num;
     this.IsRented = sp.IsRented;
     this.Size = sp.Size;
     this.RoomsNum = sp.RoomsNum;
     status = sp.status;
 }
Exemplo n.º 4
0
 public static bool DeleteSubProperty(int id)
 {
     using (ArgamanExpressEntities db = new ArgamanExpressEntities())
     {
         SubProperty p = db.SubProperties.Find(id);
         p.status = false;
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
Exemplo n.º 5
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);
        }