public ActionResult EditPartial(TransportMaster transmaster) { transmaster.Status = "Active"; transmaster.ModifiedOn = DateTime.Now; _TransportMasterService.UpdateTransport(transmaster); return(RedirectToAction("ResultTransportMaster/" + transmaster.TransportId, "Transport")); }
private void Delete() { if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Delete)) { return; } if (ValidateValues() == false) { return; } bool bActionCompleted = false; int Id = 0; int.TryParse(hfId.Value, out Id); if (Id == 0) { lblStatus.Text = "Please click on edit button again."; return; } TransportDTO oTransportData = new TransportDTO(); oTransportData.TransportId = Id; TransportMaster oTransportMaster = new TransportMaster(); /* * ADDED BY VIJAY * CHECK IF THE Transport WHICH IS TO BE DELETED HAS ANY ASSOCIATED RECORDS...IF YES, MOVE OUT OF THE FUNCTION ELSE PROCEED * IF THE OUTPUT OF sMessage IS "", THEN RECORD CAN BE DELETED, ELSE NOT * */ string sMessage = ""; GF.HasRecords(Convert.ToString(Id), "Transport", out sMessage); if (sMessage != "") { base.DisplayAlert(sMessage); btnDelete.Enabled = true; } else { bActionCompleted = oTransportMaster.Delete(oTransportData); if (bActionCompleted == true) { sMessage = "The record has been deleted successfully"; base.DisplayAlert(sMessage); txtTransport.Text = ""; //lblStatus.Text = "Deleted"; RefreshGrid(); } else { sMessage = "Error Occured while deletion: Please refer to the error log."; base.DisplayAlert(sMessage); } } oTransportData = null; oTransportMaster = null; }
protected void dgTransport_SelectedIndexChanged(object sender, EventArgs e) { int iTransportId = 0; int.TryParse(Convert.ToString(dgTransport.DataKeys[dgTransport.SelectedIndex]), out iTransportId); hfId.Value = iTransportId.ToString(); //SessionHandler"TransportId"] = iTransportId; TransportMaster oTransportMaster = new TransportMaster(); TransportDTO[] oTransportData = oTransportMaster.GetData(iTransportId); if (oTransportData.Length > 0) { txtTransport.Text = oTransportData[0].TransportName.ToString(); } oTransportMaster = null; oTransportData = null; //btnAddNew.Enabled = false; //btnCancel.Enabled = true; btnCancel.Visible = true; btnDelete.Enabled = true; btnEdit.Text = "Update"; //btnEdit.Enabled = true; //btnSave.Enabled = false; lblStatus.Text = ""; }
private void Save() { if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Add)) { DisplayAlert("You don't have rights to " + ENums.PageCommand.Add.ToString()); return; } bool bActionCompleted = false; TransportDTO oTransportData = new TransportDTO(); oTransportData.TransportName = txtTransport.Text.Trim(); TransportMaster oTransportMaster = new TransportMaster(); bActionCompleted = oTransportMaster.Insert(oTransportData); if (bActionCompleted == true) { base.DisplayAlert("The record has been inserted successfully."); txtTransport.Text = ""; lblStatus.Text = "Saved"; } else { lblStatus.Text = "Error Occured while insertion: Please refer to the error log."; } oTransportData = null; oTransportMaster = null; }
public ActionResult DeletePartial(TransportMaster transmaster) { transmaster.Status = "InActive"; transmaster.ModifiedOn = DateTime.Now; _TransportMasterService.UpdateTransport(transmaster); var BankList = _TransportBankDetailService.GetDetailsFromBank(transmaster.TransportCode); foreach (var bank in BankList) { bank.Status = "InActive"; bank.ModifiedOn = DateTime.Now; _TransportBankDetailService.UpdateBankDetails(bank); } return(RedirectToAction("ResultTransportMaster/" + transmaster.TransportId, "Transport")); }
private void Update() { if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Update)) { return; } if (ValidateValues() == false) { return; } bool bActionCompleted = false; int Id = 0; int.TryParse(hfId.Value, out Id); if (Id == 0) { lblStatus.Text = "Please click on edit button again."; return; } TransportDTO oTransportData = new TransportDTO(); oTransportData.TransportId = Id; oTransportData.TransportName = txtTransport.Text.Trim(); TransportMaster oTransportMaster = new TransportMaster(); bActionCompleted = oTransportMaster.Update(oTransportData); if (bActionCompleted == true) { base.DisplayAlert("The record has been updated successfully."); txtTransport.Text = ""; lblStatus.Text = "Updated"; } else { base.DisplayAlert("Error Occured while updation: Please refer to the error log."); lblStatus.Text = "Error Occured while updation: Please refer to the error log."; } oTransportData = null; oTransportMaster = null; }
public JsonResult LoadDistrictByState(string statename) { if (!string.IsNullOrEmpty(statename)) { int stateid = _stateservice.GetStateIdByName(statename); TransportMaster transmaster = new TransportMaster(); transmaster.DistrictList = _districtservice.getDistrictbyState(stateid); var modelData = transmaster.DistrictList.Select(m => new SelectListItem() { Text = m.DistrictName, Value = m.DistrictId.ToString() }); return(Json(modelData, JsonRequestBehavior.AllowGet)); } else { var modelData = string.Empty; return(Json(modelData, JsonRequestBehavior.AllowGet)); } }
public JsonResult LoadStateByCountry(string countryname) { if (!string.IsNullOrEmpty(countryname)) { int countryid = _countryservice.getidbyname(countryname); TransportMaster transmaster = new TransportMaster(); transmaster.StateList = _stateservice.GetStateByCountry(countryid); var modelData = transmaster.StateList.Select(m => new SelectListItem() { Text = m.StateName, Value = m.StateName }); return(Json(modelData, JsonRequestBehavior.AllowGet)); } else { var modelData = string.Empty; return(Json(modelData, JsonRequestBehavior.AllowGet)); } }
private void RefreshGrid() { TransportMaster oTransportMaster; TransportDTO[] oTransportData; oTransportMaster = new TransportMaster(); oTransportData = oTransportMaster.GetData(); if (oTransportData != null) { if (oTransportData.Length > 0) { dgTransport.DataSource = oTransportData; dgTransport.DataBind(); } } else { dgTransport.DataSource = null; dgTransport.DataBind(); } txtTransport.Text = ""; oTransportMaster = null; oTransportData = null; }
private Table PopulateGroupDetailsTable(CFormReportDTO cFormReportDto) { TableHeaderRow hRow; Table tblGroupDetails = new Table(); TableRow dataRow; CityMaster cityMaster = null; string dateHandle = string.Empty; string timeHandle = string.Empty; hRow = GetGroupHeaderRow(); tblGroupDetails.Rows.Add(hRow); tblGroupDetails.CssClass = "dataTables"; if (cFormReportDto.BookingTouristDetails != null && cFormReportDto.BookingTouristDetails.Length > 0) { if (cFormReportDto.BookingTouristDetails[0].IndiaEntryDate == DateTime.MinValue || cFormReportDto.BookingTouristDetails[0].IndiaEntryDate == DateTime.MaxValue) { dateHandle = string.Empty; } else { dateHandle = GF.GetDD_MM_YYYY(cFormReportDto.BookingTouristDetails[0].IndiaEntryDate); } dataRow = GetGroupRow("Date of Entry into India", dateHandle); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Proposed stay in India", cFormReportDto.BookingTouristDetails[0].ProposedStayInIndia); tblGroupDetails.Rows.Add(dataRow); } if (cityMaster == null) { cityMaster = new CityMaster(); } string city = cityMaster.GetCityName(cFormReportDto.BookingDetails.ArrivalCityId); dataRow = GetGroupRow("Arrived From", city); tblGroupDetails.Rows.Add(dataRow); if (cFormReportDto.BookingDetails.ArrivalDateTime == DateTime.MinValue || cFormReportDto.BookingDetails.ArrivalDateTime == DateTime.MaxValue) { dateHandle = string.Empty; timeHandle = string.Empty; } else { dateHandle = GF.GetDD_MMM_YYYY(cFormReportDto.BookingDetails.ArrivalDateTime, false); timeHandle = GF.GetHHMM(cFormReportDto.BookingDetails.ArrivalDateTime); } dataRow = GetGroupRow("Date of Arrival", dateHandle); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Time of Arrival", timeHandle); tblGroupDetails.Rows.Add(dataRow); TransportMaster transportMaster = new TransportMaster(); string transportMode = transportMaster.GetTransportName(cFormReportDto.BookingDetails.ArrivalTransportId); dataRow = GetGroupRow("Mode of Transport", transportMode); tblGroupDetails.Rows.Add(dataRow); //TransportMaster transportMaster = new TransportMaster(); //string transportMode = transportMaster.GetTransportName(cFormReportDto.BookingDetails.); dataRow = GetGroupRow("Vehicle Name/Type", cFormReportDto.BookingDetails.ArrivalVehicleNameType); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Vehicle No.", cFormReportDto.BookingDetails.ArrivalVehicleNo); tblGroupDetails.Rows.Add(dataRow); //dataRow = GetGroupRow("Drivers Name", string.Empty); //tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Drivers No.", cFormReportDto.BookingDetails.ArrivalDriverPhoneNo); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Transport Company", cFormReportDto.BookingDetails.ArrivalTransportCompany); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Transport Phone No.", cFormReportDto.BookingDetails.ArrivalTransportCompanyPhoneNo); tblGroupDetails.Rows.Add(dataRow); if (cityMaster == null) { cityMaster = new CityMaster(); } city = string.Empty; city = cityMaster.GetCityName(cFormReportDto.BookingDetails.DepartureCityId); dataRow = GetGroupRow("Next destination", city); tblGroupDetails.Rows.Add(dataRow); if (cFormReportDto.BookingDetails.DepartureDateTime == DateTime.MinValue || cFormReportDto.BookingDetails.DepartureDateTime == DateTime.MaxValue) { dateHandle = string.Empty; timeHandle = string.Empty; } else { dateHandle = GF.GetDD_MMM_YYYY(cFormReportDto.BookingDetails.DepartureDateTime, false); timeHandle = GF.GetHHMM(cFormReportDto.BookingDetails.DepartureDateTime); } dataRow = GetGroupRow("Date of departure", dateHandle); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Time of Departure", timeHandle); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Whether Employed in India", "No"); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Purpose of visit", "Tourism"); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Submitted on", string.Empty); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Time", string.Empty); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Incharge", string.Empty); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Company Stamp", string.Empty); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Received : Police Official", string.Empty); tblGroupDetails.Rows.Add(dataRow); dataRow = GetGroupRow("Police Stamp", string.Empty); tblGroupDetails.Rows.Add(dataRow); return(tblGroupDetails); }
public void UpdateTransport(TransportMaster Transport) { _TransportMasterRepository.Update(Transport); _unityOfWork.Commit(); }
public void CreateTransport(TransportMaster Transport) { _TransportMasterRepository.Add(Transport); _unityOfWork.Commit(); }