// POST: api/TipeStatus
        public IHttpActionResult Post(TipeStatus tipestatus)
        {
            TipeStatusDAL tipeStatusDAL = new TipeStatusDAL();

            try
            {
                tipeStatusDAL.Insert(tipestatus);
                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        //private string coiNumber;
        //private COIDetail result;

        //async void GetData()
        //{
        //    COIService coiService = new COIService();
        //    COIDetail result = await coiService.GetCOIById(coiNumber);
        //    this.result = result;
        //    //await DisplayAlert("Keterangan", "COI " + result.COINumber, "OK");
        //}



        async void GetData()
        {
            COIDetail data = (COIDetail)BindingContext;

            TipeStatusService tipeStatusServices = new TipeStatusService();

            //await DisplayAlert("Keterangan", "Tipe Status " + IdTipeStatusInt.ToString(), "OK");

            TipeStatus statusPrev = await tipeStatusServices.GetStatusPrev(data.IdTipeStatus.ToString());

            btnStatusPrev.Text = statusPrev.NamaTipe;

            TipeStatus statusNext = await tipeStatusServices.GetStatusNext(data.IdTipeStatus.ToString());

            btnStatusNext.Text = statusNext.NamaTipe;
        }
Beispiel #3
0
        public void Update(TipeStatus tipestatus)
        {
            using (SqlConnection conn = new SqlConnection(GetConnString()))
            {
                var strSql = @"update TipeStatus set NamaTipe=@NamaTipe 
                               where IdTipeStatus=@IdTipeStatus";

                var param = new
                {
                    NamaTipe     = tipestatus.NamaTipe,
                    IdTipeStatus = tipestatus.IdTipeStatus
                };

                try
                {
                    conn.Execute(strSql, param);
                }
                catch (SqlException sqlEx)
                {
                    throw new Exception(sqlEx.Message);
                }
            }
        }
Beispiel #4
0
        public void Insert(TipeStatus tipestatus)
        {
            using (SqlConnection conn = new SqlConnection(GetConnString()))
            {
                var strSql = @"insert into TipeStatus(IdTipeStatus,NamaTipe) 
                               values(@IdTipeStatus,@NamaTipe)";

                var param = new
                {
                    IdTipeStatus = tipestatus.IdTipeStatus,
                    NamaTipe     = tipestatus.NamaTipe
                };

                try
                {
                    conn.Execute(strSql, param);
                }
                catch (SqlException sqlEx)
                {
                    throw new Exception(sqlEx.Message);
                }
            }
        }
        // PUT: api/TipeStatus/5
        public IHttpActionResult Put(string id, TipeStatus tipestatus)
        {
            TipeStatusDAL tipeStatusDAL = new TipeStatusDAL();

            var result = tipeStatusDAL.GetById(id);

            if (result != null)
            {
                try
                {
                    result.NamaTipe = tipestatus.NamaTipe;
                    tipeStatusDAL.Update(result);
                    return(Ok());
                }
                catch (Exception ex)
                {
                    return(BadRequest(ex.Message));
                }
            }
            else
            {
                return(BadRequest("Data not found !"));
            }
        }