protected void btnClick_btnupdateVehicletariff(object sender, EventArgs e) { if (Page.IsValid) { // My credential check code transportdata = new TransportData(); transport = new Transports(); transport.V_TrfID = string.IsNullOrEmpty(hfvmapId.Value) ? 0 : Convert.ToInt32(hfvmapId.Value); transport.trModelID = Convert.ToInt32(dpModelNo.SelectedItem.Value);; transport.troption = Convert.ToInt32(dpSelectOption.SelectedItem.Value); transport.tariffamt = Convert.ToDouble(txtTariffamt.Text); transport.CreatedBy = GlobalInfo.Userid; if (dpIsActive.SelectedItem.Value == "1") { transport.IsActive = true; } else if (dpIsActive.SelectedItem.Text == "2") { transport.IsActive = false; } transport.Createddate = DateTime.Now.ToString("dd-MM-yyyy"); transport.ModifiedBy = GlobalInfo.Userid; transport.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy"); transport.flag = "Update"; int Result = 0; Result = transportdata.AddVehicleTariffInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vehicle Tariff Updated Successfully"; ClearTextBox(); BindVehicleTariffInfo(); pnlError.Update(); upMain.Update(); uprouteList.Update(); btnAddVehicleTariff.Visible = true; btnupdateVehicletariff.Visible = false; } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } } }
public void DeleteTariffByID(int V_TrfID) { transportdata = new TransportData(); transport = new Transports(); transport.V_TrfID = Convert.ToInt32(V_TrfID); transport.trVehicleNo = 0; transport.troption = 0; transport.tariffamt = 0; transport.CreatedBy = GlobalInfo.Userid; transport.IsActive = true; transport.Createddate = DateTime.Now.ToString("dd-MM-yyyy"); transport.ModifiedBy = GlobalInfo.Userid; transport.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy"); transport.flag = "Delete"; int Result = 0; Result = transportdata.AddVehicleTariffInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vehicle Tariff Deleted Successfully"; ClearTextBox(); BindVehicleTariffInfo(); pnlError.Update(); upMain.Update(); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } }