예제 #1
0
        public Kamar GetProduct(int id)
        {
            KasurEmpukBDO kasurBDO = null;

            try
            {
                kasurBDO = kasurLogic.GetProduct(id);
            }
            catch (Exception e)
            {
                string msg    = e.Message;
                string reason = "GetProduct Fail!";
                throw new FaultException <KasurFault>(new KasurFault(msg), reason);
            }
            if (kasurBDO == null)
            {
                string msg    = string.Format("No room found for id {0}", id);
                string reason = "Empty room!";
                throw new FaultException <KasurFault>(new KasurFault(msg), reason);
            }

            Kamar kamar = new Kamar();

            MawarBDOToPenerbanganDTO(kasurBDO, kamar);
            return(kamar);
        }
예제 #2
0
        public bool UpdateProduct(ref Kamar kamar, ref string message)
        {
            bool result = true;

            if (kamar.harga <= 0)
            {
                message = "Price cannot be <=0";
                result  = false;
            }
            else if (kamar.jumlah <= 0)
            {
                message = "Total room cannot be <=0";
                result  = false;
            }
            else
            {
                try
                {
                    KasurEmpukBDO kasurBDO = KamarDTOToMawarBDO(kamar);
                    result = kasurLogic.UpdatedProduct(ref kasurBDO, ref message);
                }
                catch (Exception e)
                {
                    string msg = e.Message;
                    throw new FaultException <KasurFault>
                              (new KasurFault(msg), msg);
                }
            }
            return(result);
        }
예제 #3
0
        public IEnumerable <Kamar> GetAllPenerbangan()
        {
            IEnumerable <KasurEmpukBDO> temp = null;

            try
            {
                temp = kasurLogic.GetAllProduct();
            }
            catch (Exception e)
            {
                string msg    = e.Message;
                string reason = "GetAll Fail!";
                throw new FaultException <KasurFault>(new KasurFault(msg), reason);
            }
            if (temp == null)
            {
                string msg    = string.Format("No room found!");
                string reason = "No room available!";
                throw new FaultException <KasurFault>(new KasurFault(msg), reason);
            }
            List <Kamar> penerbangans = new List <Kamar>();

            foreach (var c in temp)
            {
                Kamar kamar = new Kamar();
                MawarBDOToPenerbanganDTO(c, kamar);
            }
            return(penerbangans);
        }
예제 #4
0
 public void MawarBDOToPenerbanganDTO(KasurEmpukBDO kasurBDO, Kamar kamar)
 {
     kamar.kamar_Id = kasurBDO.Kamar_ID;
     kamar.jumlah   = (int)kasurBDO.Jumlah;
     kamar.harga    = (int)kasurBDO.Harga;
     kamar.jenis    = kasurBDO.Jenis;
 }
예제 #5
0
 public void MawarBDOToPenerbanganDTO(MawarDBO mawarDBO, Kamar kamar)
 {
     kamar.kamar_Id = mawarDBO.Kamar_ID;
     kamar.jumlah   = (int)mawarDBO.Jumlah;
     kamar.harga    = (int)mawarDBO.Harga;
     kamar.jenis    = mawarDBO.Jenis;
 }
예제 #6
0
        public KasurEmpukBDO KamarDTOToMawarBDO(Kamar kamar)
        {
            KasurEmpukBDO kasurBDO = new KasurEmpukBDO();

            kasurBDO.Kamar_ID = kamar.kamar_Id;
            kasurBDO.Jenis    = kamar.jenis;
            kasurBDO.Harga    = (int)kamar.harga;
            kasurBDO.Jumlah   = (int)kamar.jumlah;

            return(kasurBDO);
        }
예제 #7
0
        public MawarDBO KamarDTOToMawarBDO(Kamar kamar)
        {
            MawarDBO mawarDBO = new MawarDBO();

            mawarDBO.Kamar_ID = kamar.kamar_Id;
            mawarDBO.Jenis    = kamar.jenis;
            mawarDBO.Harga    = (int)kamar.harga;
            mawarDBO.Jumlah   = (int)kamar.jumlah;

            return(mawarDBO);
        }
예제 #8
0
        public void InsertProduct(Kamar kamar)
        {
            try
            {
                KasurEmpukBDO kasurBDO = KamarDTOToMawarBDO(kamar);

                kasurLogic.InsertProduct(kasurBDO);
            }
            catch (Exception e)
            {
                string msg    = e.Message;
                string reason = "Insert Fail!";
                throw new FaultException <KasurFault>(new KasurFault(msg), reason);
            }
        }
예제 #9
0
        public void InsertProduct(Kamar kamar)
        {
            try
            {
                MawarDBO mawarDBO = KamarDTOToMawarBDO(kamar);

                mawarLogic.InsertProduct(mawarDBO);
            }
            catch (Exception e)
            {
                string msg    = e.Message;
                string reason = "Insert Fail!";
                throw new FaultException <MawarFault>(new MawarFault(msg), reason);
            }
        }