public static void Check(this TransferRoute transferRoute) { if (transferRoute.InitialWarehouseID == transferRoute.FinalWarehouseID) { throw new InitialAndFinalWarehousesMatchException(); } }
public async Task <IActionResult> PutTransferRoute(TransferRoute transferRoute) { //if (id != transferRoute.TransferRouteID) //{ // return BadRequest(); //} _context.Entry(transferRoute).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TransferRouteExists(transferRoute.TransferRouteID)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TransferRoute> > PostTransferRoute(TransferRoute transferRoute) { _context.TransferRoute.Add(transferRoute); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTransferRoute", new { id = transferRoute.TransferRouteID }, transferRoute)); }
public int EditTransferRoute(TransferRoute objTransferRoute) { try { sqlListParam = new List <SqlParameter>(); sqlListParam.Add(new SqlParameter("@TransferRouteID", objTransferRoute.TransferRouteID)); sqlListParam.Add(new SqlParameter("@TransferfromCode", objTransferRoute.TransferfromCode)); sqlListParam.Add(new SqlParameter("@TransfertoCode", objTransferRoute.TransfertoCode)); sqlListParam.Add(new SqlParameter("@JarakTempuh", objTransferRoute.JarakTempuh)); sqlListParam.Add(new SqlParameter("@BiayaToll", objTransferRoute.BiayaToll)); sqlListParam.Add(new SqlParameter("@BiayaBBM", objTransferRoute.BiayaBBM)); sqlListParam.Add(new SqlParameter("@Retribusi", objTransferRoute.Retribusi)); sqlListParam.Add(new SqlParameter("@BiayaLainLain", objTransferRoute.BiayaLainLain)); sqlListParam.Add(new SqlParameter("@RowStatus", objTransferRoute.RowStatus)); sqlListParam.Add(new SqlParameter("@CreatedBy", objTransferRoute.CreatedBy)); DataAccess dataAccess = new DataAccess(Global.AllVisionsCS); int intResult = dataAccess.ProcessData(sqlListParam, "spTransferRouteEdit"); strError = dataAccess.Error; return(intResult); } catch (Exception ex) { strError = ex.Message; return(-1); } }
public TransferRoute GenerateTransferRouteObject(SqlDataReader sqlDataReader) { objTransferRoute = new TransferRoute(); objTransferRoute.TransferRouteID = Convert.ToInt32(sqlDataReader["TransferRouteID"]); objTransferRoute.TransferfromCode = sqlDataReader["TransferfromCode"].ToString(); objTransferRoute.TransfertoCode = sqlDataReader["TransfertoCode"].ToString(); objTransferRoute.JarakTempuh = Convert.ToDecimal(sqlDataReader["JarakTempuh"]); objTransferRoute.BiayaToll = Convert.ToDecimal(sqlDataReader["BiayaToll"]); objTransferRoute.BiayaBBM = Convert.ToDecimal(sqlDataReader["BiayaBBM"]); objTransferRoute.Retribusi = Convert.ToDecimal(sqlDataReader["Retribusi"]); objTransferRoute.BiayaLainLain = Convert.ToDecimal(sqlDataReader["BiayaLainLain"]); objTransferRoute.RowStatus = Convert.ToByte(sqlDataReader["RowStatus"]); objTransferRoute.CreatedBy = sqlDataReader["CreatedBy"].ToString(); if (sqlDataReader["CreatedTime"] != null && sqlDataReader["CreatedTime"].ToString() != "") { objTransferRoute.CreatedTime = Convert.ToDateTime(sqlDataReader["CreatedTime"]); } objTransferRoute.LastModifiedBy = sqlDataReader["LastModifiedBy"].ToString(); if (sqlDataReader["LastModifiedTime"] != null && sqlDataReader["LastModifiedTime"].ToString() != "") { objTransferRoute.LastModifiedTime = Convert.ToDateTime(sqlDataReader["LastModifiedTime"]); } return(objTransferRoute); }
void LoadData() { transferRoute = transferRouteManagement.RetrieveTransferRouteByID(intUniqID); if (transferRouteManagement.Error == string.Empty) { if (transferRoute.TransferRouteID > 0) { cboTransferfromCode.SelectedValue = transferRoute.TransferfromCode; cboTransfertoCode.SelectedValue = transferRoute.TransfertoCode; txtJarakTempuh.Text = transferRoute.JarakTempuh.ToString("N2"); txtBiayaToll.Text = transferRoute.BiayaToll.ToString("N2"); txtBiayaBBM.Text = transferRoute.BiayaBBM.ToString("N2"); txtRetribusi.Text = transferRoute.Retribusi.ToString("N2"); txtRetribusi.Text = transferRoute.Retribusi.ToString("N2"); txtID.Text = transferRoute.TransferRouteID.ToString(); } else if (transferRoute.TransferfromCode == string.Empty) { ClearText(); } } cboTransferfromCode.Focus(); }
public async Task UpdateRoute(TransferRoute Route) { var response = await httpService.Put(url, Route); if (!response.Success) { throw new ApplicationException(await response.GetBody()); } }
void ClearText() { transferRoute = new TransferRoute(); cboTransferfromCode.SelectedValue = transferRoute.TransferfromCode; cboTransfertoCode.SelectedValue = transferRoute.TransfertoCode; txtJarakTempuh.Text = transferRoute.JarakTempuh.ToString("N2"); txtBiayaToll.Text = transferRoute.BiayaToll.ToString("N2"); txtBiayaBBM.Text = transferRoute.BiayaBBM.ToString("N2"); txtRetribusi.Text = transferRoute.Retribusi.ToString("N2"); txtRetribusi.Text = transferRoute.Retribusi.ToString("N2"); txtID.Text = transferRoute.TransferRouteID.ToString(); }