public void DeleteMapbyID(int VOp) { transportdata = new TransportData(); transport = new Transports(); transport.VOp = Convert.ToInt32(VOp); transport.TM_Id = 0; transport.StartDate = txtStartDate.Text; transport.StartTime = txtStartTime.Text; transport.RouteID = 0; transport.StartKm = 0; transport.EndKm = 0; transport.FirstDriver = 0; transport.SecondDriver = 0; transport.operationtype = 0; transport.bata = 0; transport.tollpaid = 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.SalesmanId = Convert.ToInt32(dpSalesman.SelectedItem.Value); transport.SecondSalesmanId = Convert.ToInt32(dpSecondSalesmanId.SelectedItem.Value); transport.flag = "Delete"; int Result = 0; Result = transportdata.AddVehicleOperationInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vehicle Out Operation Deleted Successfully"; ClearTextBox(); BindVehicleOperationInfo(); 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(); } }
protected void btnClick_btnAddVehicleOperation(object sender, EventArgs e) { if (Page.IsValid) { transportdata = new TransportData(); transport = new Transports(); transport.VOp = 0; transport.TM_Id = Convert.ToInt32(dpVehicleNo.SelectedItem.Value); transport.StartDate = string.IsNullOrEmpty(txtStartDate.Text) ? string.Empty : (Convert.ToDateTime(txtStartDate.Text)).ToString("dd-MM-yyyy"); transport.StartTime = string.IsNullOrEmpty(txtStartTime.Text) ? string.Empty : (Convert.ToDateTime(txtStartTime.Text)).ToString("HH:mm"); transport.RouteID = Convert.ToInt32(dproute.SelectedItem.Value); transport.StartKm = string.IsNullOrEmpty(txtStartKm.Text) ? 0 : Convert.ToDecimal(txtStartKm.Text); transport.FirstDriver = string.IsNullOrEmpty(dpDriver.SelectedItem.Value) ? 0 : Convert.ToInt32(dpDriver.SelectedItem.Value); transport.SecondDriver = Convert.ToInt32(dpDriver2.SelectedItem.Value); transport.operationtype = Convert.ToInt32(dpOperations.SelectedItem.Value); transport.bata = string.IsNullOrEmpty(txtBata.Text) ? 0 : Convert.ToDecimal(txtBata.Text); transport.salesbata = string.IsNullOrEmpty(txtSalesBata.Text) ? 0 : Convert.ToDecimal(txtSalesBata.Text); 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.SalesmanId = Convert.ToInt32(dpSalesman.SelectedItem.Value); transport.SecondSalesmanId = Convert.ToInt32(dpSecondSalesmanId.SelectedItem.Value); transport.flag = "Insert"; int Result = 0; Result = transportdata.AddVehicleOperationInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vehicle Out Operation Added Successfully"; ClearTextBox(); BindVehicleOperationInfo(); 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(); } } }