protected void btnClick_btnAddVehicleMaintenanceCost(object sender, EventArgs e) { if (Page.IsValid) { int checkvehicleno; checkvehicleno = Convert.ToInt32(dpVehicleNo.SelectedItem.Value); if (checkvehicleno != 0) { transportdata = new TransportData(); transport = new Transports(); transport.ID = 0; transport.TM_Id = Convert.ToInt32(dpVehicleNo.SelectedItem.Value); transport.MaintenanceType = string.IsNullOrEmpty(dpMaintenanceType.Text.ToString()) ? 0 : Convert.ToInt32(dpMaintenanceType.SelectedItem.Value); transport.M_Description = txtDescription.Text; transport.DateGiven = string.IsNullOrEmpty(txtmaintenancegivendate.Text.ToString()) ? string.Empty : (Convert.ToDateTime(txtmaintenancegivendate.Text)).ToString("dd-MM-yyyy"); transport.datereceived = string.IsNullOrEmpty(txtmaintenancenextdate.Text.ToString()) ? string.Empty : (Convert.ToDateTime(txtmaintenancenextdate.Text)).ToString("dd-MM-yyyy"); transport.maintenanceamt = string.IsNullOrEmpty(txtMaintenanceAmt.Text.ToString()) ? 0 : Convert.ToDouble(txtMaintenanceAmt.Text); transport.CreatedBy = GlobalInfo.Userid; //if (dpIsActive.SelectedItem.Value == "1") //{ transport.IsActive = true; //} //else if (dpIsActive.SelectedItem.Value == "2") //{ // transport.IsActive = false; //} //else if (dpIsActive.SelectedItem.Value == "0") //{ // 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 = "Insert"; int Result = 0; Result = transportdata.AddVehicleMaintenanceDetailsInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vehicle Maintenance 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(); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Please select Vehicle Number!');", true); } } }
public void DeleteMapbyID(int ID) { transportdata = new TransportData(); transport = new Transports(); transport.ID = Convert.ToInt32(ID); transport.TM_Id = 0; transport.TM_Id = Convert.ToInt32(dpVehicleNo.SelectedItem.Value); transport.MaintenanceType = Convert.ToInt32(dpMaintenanceType.SelectedItem.Value); transport.M_Description = txtDescription.Text; transport.DateGiven = (Convert.ToDateTime(txtmaintenancegivendate.Text)).ToString("dd-MM-yyyy"); transport.datereceived = (Convert.ToDateTime(txtmaintenancenextdate.Text)).ToString("dd-MM-yyyy"); transport.maintenanceamt = Convert.ToDouble(txtMaintenanceAmt.Text); transport.CreatedBy = GlobalInfo.Userid; //if (dpIsActive.SelectedItem.Value == "1") //{ transport.IsActive = true; //} //else if (dpIsActive.SelectedItem.Text == "2") //{ // transport.IsActive = false; //} //DateTime time = DateTime.Parse(string.Format("{0}:{1}:{2} {3}", TimeSelector1.Hour, TimeSelector1.Minute, TimeSelector1.Second, TimeSelector1.AmPm)); ////product.IsActive = true; //time.ToString(); 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.AddVehicleMaintenanceDetailsInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vehicle Maintenance 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(); } }