예제 #1
0
        // 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));
            }
        }
예제 #2
0
        //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;
        }
예제 #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);
                }
            }
        }
예제 #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);
                }
            }
        }
예제 #5
0
        // 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 !"));
            }
        }