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.insuranceamt = Convert.ToDouble(txtVehicleInsuraceAmt.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.AddVehicleInsuanceDetailsInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vehicle Insurance 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_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.InsProvider = string.IsNullOrEmpty(dpVeh_InsProvider.Text.ToString()) ? 0 : Convert.ToInt32(dpVeh_InsProvider.SelectedItem.Value); transport.InsPolicyNo = string.IsNullOrEmpty(dpVeh_InsPolicyNo.Text.ToString()) ? string.Empty : Convert.ToString(dpVeh_InsPolicyNo.SelectedItem.Text); transport.InspaidDate = string.IsNullOrEmpty(txtInsuransepaidDate.Text.ToString()) ? string.Empty : (Convert.ToDateTime(txtInsuransepaidDate.Text)).ToString("dd-MM-yyyy"); transport.Insnextduedate = string.IsNullOrEmpty(txtnextinspaiddate.Text.ToString()) ? string.Empty : (Convert.ToDateTime(txtnextinspaiddate.Text)).ToString("dd-MM-yyyy"); transport.insuranceamt = string.IsNullOrEmpty(txtVehicleInsuraceAmt.Text.ToString()) ? 0 : Convert.ToDouble(txtVehicleInsuraceAmt.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.AddVehicleInsuanceDetailsInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vehicle Insurance Added Successfully"; ClearTextBox(); BindVehicleOperationInfo(); pnlError.Update(); upMain.Update(); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Data Already exists"; pnlError.Update(); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Please select Vehicle Number!');", true); } } }
protected void btnClick_btnUpdateMaintenanceCost(object sender, EventArgs e) { if (Page.IsValid) { transportdata = new TransportData(); transport = new Transports(); transport.ID = string.IsNullOrEmpty(hfID.Value) ? 0 : Convert.ToInt32(hfID.Value); transport.TM_Id = Convert.ToInt32(dpVehicleNo.SelectedItem.Value); transport.InsProvider = string.IsNullOrEmpty(dpVeh_InsProvider.Text.ToString()) ? 0 : Convert.ToInt32(dpVeh_InsProvider.SelectedItem.Value); transport.InsPolicyNo = string.IsNullOrEmpty(dpVeh_InsPolicyNo.Text.ToString()) ? string.Empty : Convert.ToString(dpVeh_InsPolicyNo.SelectedItem.Text); transport.InspaidDate = string.IsNullOrEmpty(txtInsuransepaidDate.Text.ToString()) ? string.Empty : (Convert.ToDateTime(txtInsuransepaidDate.Text)).ToString("dd-MM-yyyy"); transport.Insnextduedate = string.IsNullOrEmpty(txtnextinspaiddate.Text.ToString()) ? string.Empty : (Convert.ToDateTime(txtnextinspaiddate.Text)).ToString("dd-MM-yyyy"); transport.insuranceamt = string.IsNullOrEmpty(txtVehicleInsuraceAmt.Text.ToString()) ? 0 : Convert.ToDouble(txtVehicleInsuraceAmt.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 = "Update"; int Result = 0; Result = transportdata.AddVehicleInsuanceDetailsInfo(transport); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vehicle Insurance Updated Successfully"; ClearTextBox(); BindVehicleOperationInfo(); pnlError.Update(); upMain.Update(); uprouteList.Update(); btnUpdateMaintenanceCost.Visible = false; btnAddVehicleMaintenanceCost.Visible = true; } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } } }