public override void Save() { try { if (grdLister.Rows.Where(c => c.Cells["Check"].Value.ToBool()).Count() > 0) { objMaster.GetByPrimaryKey(CurrentVehicleId); objMaster.Edit(); CurrentAttributeValues = string.Join(",", grdLister.Rows.Where(c => c.Cells["Check"].Value.ToBool() == true).Select(c => c.Cells[COLS.Id].Value.ToStr()).ToArray <string>()); if (CurrentAttributeValues.ToStr().Trim().Length > 0 && CurrentAttributeValues.StartsWith(",") == false && CurrentAttributeValues.EndsWith(",") == false) { CurrentAttributeValues = "," + CurrentAttributeValues + ","; } objMaster.Current.AttributeValues = CurrentAttributeValues; objMaster.Save(); this.Close(); // objMaster.Clear(); } else { ENUtils.ShowMessage("Required atleast one Vehicle Type"); } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void Save() { try { int orderNo = 1; if (lstVehicleOrder.Items[0].Value.ToInt() != AppVars.objPolicyConfiguration.DefaultVehicleTypeId.ToInt()) { ENUtils.ShowMessage("Default Vehicle should be on Top in the order"); return; } foreach (RadListDataItem item in lstVehicleOrder.Items) { // objMaster = new ZoneBO(); objMaster.GetByPrimaryKey(item.Value); if (objMaster.Current != null) { objMaster.CheckDataValidation = false; objMaster.Current.OrderNo = orderNo++; objMaster.Save(); } } General.RefreshListWithoutSelected <frmVehicleTypeList>("frmVehicleTypeList1"); Close(); //General.LoadZoneList(); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }
public override void Save() { try { IsSaved = false; if (objMaster.PrimaryKeyValue == null) { objMaster.New(); Fleet_VehicleType objVehicle = General.GetQueryable <Fleet_VehicleType>(null).OrderByDescending(c => c.Id).FirstOrDefault(); if (objVehicle != null) { // objMaster.Current.Id = objVehicle.Id+1; objMaster.Current.OrderNo = objVehicle.Id + 1; } } else { objMaster.Edit(); } objMaster.Current.VehicleType = txtVehicleType.Text.Trim(); objMaster.Current.NoofPassengers = numPassengers.Value.ToInt(); objMaster.Current.NoofLuggages = numLuggages.Value.ToInt(); objMaster.Current.NoofHandLuggages = numHandLuggages.Value.ToInt(); objMaster.Current.StartRate = numStartRate.Value.ToDecimal(); objMaster.Current.StartRateValidMiles = numValidMiles.Value.ToDecimal(); objMaster.Current.Photo = pic_Vehicle.GetByteArrayOfImage(); objMaster.Current.BackgroundColor = txtBgColor.Tag.ToStr(); objMaster.Current.TextColor = txtTextColor.Tag.ToStr(); DateTime dateValue = new DateTime(1900, 1, 1, 0, 0, 0); DateTime?fromPeakTimeStartTime = null; DateTime?tillPeakTimeStartTime = null; DateTime?fromOffPeakFromEndTime = null; DateTime?tillOffPeakToEndTime = null; if (dtpFromStartTime.Value != null) { fromPeakTimeStartTime = string.Format("{0:dd/MM/yyyy HH:mm}", dateValue.ToDate() + dtpFromStartTime.Value.Value.TimeOfDay).ToDateTime(); } if (dtpTillStartTime.Value != null) { tillPeakTimeStartTime = string.Format("{0:dd/MM/yyyy HH:mm}", dateValue.ToDate() + dtpTillStartTime.Value.Value.TimeOfDay).ToDateTime(); } if (dtpFromEndTime.Value != null) { fromOffPeakFromEndTime = string.Format("{0:dd/MM/yyyy HH:mm}", dateValue.ToDate() + dtpFromEndTime.Value.Value.TimeOfDay).ToDateTime(); } if (dtpTillEndTime.Value != null) { tillOffPeakToEndTime = string.Format("{0:dd/MM/yyyy HH:mm}", dateValue.ToDate() + dtpTillEndTime.Value.Value.TimeOfDay).ToDateTime(); } // objMaster.Current.EnablePeakOffPeak = chkEnablePeakFares.Checked; objMaster.Current.FromStartTime = fromPeakTimeStartTime; objMaster.Current.TillStartTime = tillPeakTimeStartTime; objMaster.Current.FromStartRate = numFromStartRate.Value.ToDecimal(); objMaster.Current.FromStartRateValidMiles = numFromValidMiles.Value.ToDecimal(); objMaster.Current.FromEndTime = fromOffPeakFromEndTime; objMaster.Current.TillEndTime = tillOffPeakToEndTime; objMaster.Current.TillStartRate = numTillStartRate.Value.ToDecimal(); objMaster.Current.TillStartRateValidMiles = numTillValidMiles.Value.ToDecimal(); objMaster.Current.DriverWaitingChargesPerHour = numDrvWaitingCharges.Value.ToDecimal(); objMaster.Current.AccountWaitingChargesPerHour = numAccountWaitingChargesMins.Value.ToDecimal(); objMaster.Save(); IsSaved = true; General.RefreshListWithoutSelected <frmVehicleTypeList>("frmVehicleTypeList1"); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }