private void SaveData() { try { Gen_SysPolicy obj = General.GetQueryable <Gen_SysPolicy>(null).FirstOrDefault(); if (obj != null) { objMaster.GetByPrimaryKey(obj.Id); objMaster.Edit(); } string[] skipProperties = { "Gen_SysPolicy" }; IList <Fleet_DriverTemplet> savedListTemp = objMaster.Current.Fleet_DriverTemplets; List <Fleet_DriverTemplet> listofDetailTemp = (from r in grdSMSTemplets.Rows select new Fleet_DriverTemplet { Id = r.Cells[COL_SMSTEMPLET.ID].Value.ToInt(), Templets = r.Cells[COL_SMSTEMPLET.Tempplet].Value.ToString(), SysPolicyId = r.Cells[COL_SMSTEMPLET.POLICYID].Value.ToInt(), }).ToList(); Utils.General.SyncChildCollection(ref savedListTemp, ref listofDetailTemp, "Id", skipProperties); objMaster.Save(); Display(); } catch (Exception ex) { ENUtils.ShowErrorMessage(ex.Message); } }
public override void Save() { try { string StartFrom = string.Empty; string Till = string.Empty; DateTime? dtFrom = null; DateTime? dtTill = null; Gen_SysPolicy obj = General.GetQueryable <Gen_SysPolicy>(null).FirstOrDefault(); if (obj != null) { objMaster.GetByPrimaryKey(obj.Id); objMaster.Edit(); } dtFrom = dtpStartFrom.Value.ToDateTimeorNull(); dtFrom = dtFrom.Value.Date + new TimeSpan(dtFrom.Value.Hour, dtFrom.Value.Minute, 0); dtTill = dtpTill.Value.ToDateTimeorNull(); dtTill = dtTill.Value.Date + new TimeSpan(dtTill.Value.Hour, dtTill.Value.Minute, 0); if (objMaster.Current.Gen_SysPolicy_BiddingTimeSettings.Count == 0) { objMaster.Current.Gen_SysPolicy_BiddingTimeSettings.Add(new Gen_SysPolicy_BiddingTimeSetting()); } objMaster.Current.Gen_SysPolicy_BiddingTimeSettings[0].SysPolicyId = objMaster.Current.Id; objMaster.Current.Gen_SysPolicy_BiddingTimeSettings[0].StartFrom = dtFrom; objMaster.Current.Gen_SysPolicy_BiddingTimeSettings[0].TillTo = dtTill; objMaster.Current.Gen_SysPolicy_BiddingTimeSettings[0].AnyTime = chkAnyTime.Checked.ToBool(); objMaster.Save(); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }
public override void Save() { try { if (objMaster.PrimaryKeyValue == null) { objMaster.New(); } else { objMaster.Edit(); } string[] skipProperties = { "Gen_SysPolicy", "SinBinTypes" }; IList <Gen_SysPolicy_SinBinSetting> savedList = objMaster.Current.Gen_SysPolicy_SinBinSettings; List <Gen_SysPolicy_SinBinSetting> listofDetail = (from r in grdSinBin.Rows select new Gen_SysPolicy_SinBinSetting { Id = r.Cells[COLS.Id].Value.ToInt(), SysPolicyId = objMaster.Current.Id, SinBinTypeId = r.Cells[COLS.SinBinTypeId].Value.ToInt(), SinBinMinutes = r.Cells[COLS.Minutes].Value.ToInt(), }).ToList(); Utils.General.SyncChildCollection(ref savedList, ref listofDetail, "Id", skipProperties); objMaster.Save(); //objMaster.GetByPrimaryKey(objMaster.PrimaryKeyValue); CreateSINBINZone(); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }
public override void Save() { try { string MeterType = ddlFareMeterType.Text.ToStr().Trim(); if (string.IsNullOrEmpty(MeterType)) { ENUtils.ShowMessage("Required : Fare Meter Type"); return; } if (MeterType == "Fare Meter 2(ADVANCED)") { MeterRoundedValue = spnMeterRoundedValue.Value.ToDecimal(); FareMeterType = 2; } else { FareMeterType = 1; MeterRoundedValue = 0; } Gen_SysPolicy obj = General.GetQueryable <Gen_SysPolicy>(null).FirstOrDefault(); if (obj != null) { objMaster.GetByPrimaryKey(obj.Id); objMaster.Edit(); } objMaster.Current.Gen_SysPolicy_Configurations[0].FareMeterType = ddlFareMeterType.SelectedValue.ToInt(); objMaster.Current.Gen_SysPolicy_Configurations[0].FareMeterRoundedCalc = MeterRoundedValue.ToDecimal(); //"Gen_SysPolicy", string[] skipProperties = new string[] { "Gen_SysPolicy", "Fleet_VehicleType" }; List <Gen_SysPolicy_FareMeterSetting> listofFares = (from a in grdFareMeterSetting.Rows select new Gen_SysPolicy_FareMeterSetting { Id = a.Cells[COLS.Id].Value.ToInt(), SysPolicyId = objMaster.Current.Id, VehicleTypeId = a.Cells[COLS.VehicleTypeId].Value.ToIntorNull(), HasMeter = a.Cells[COLS.HasMeter].Value.ToBool(), AutoStartWaiting = a.Cells[COLS.AutoStartWaiting].Value.ToBool(), AutoStartWaitingBelowSpeed = a.Cells[COLS.AutoStartWaitingSpeedLimit].Value.ToDecimal(), AutoStartWaitingBelowSpeedSeconds = a.Cells[COLS.AutoStartWaitingSecondsLimit].Value.ToInt(), AutoStopWaitingOnSpeed = a.Cells[COLS.AutoStopWaitingOnSpeed].Value.ToDecimal(), DrvWaitingChargesPerMin = a.Cells[COLS.DrvWaitingCharges].Value.ToDecimal(), AccWaitingChargesPerMin = a.Cells[COLS.WaitingTime].Value.ToDecimal() }).ToList(); IList <Gen_SysPolicy_FareMeterSetting> savedListFares = objMaster.Current.Gen_SysPolicy_FareMeterSettings; Utils.General.SyncChildCollection(ref savedListFares, ref listofFares, "Id", skipProperties); bool IsUpdated = false; if (objMaster.Current.Gen_SysPolicy_Configurations[0].EnablePeakOffPeakFares.ToBool() != chkEnablePeakOffPeakWiseFares.Checked || objMaster.Current.Gen_SysPolicy_Configurations[0].FareMeterType.ToInt() != ddlFareMeterType.SelectedValue.ToInt()) { objMaster.Current.Gen_SysPolicy_Configurations[0].EnablePeakOffPeakFares = chkEnablePeakOffPeakWiseFares.Checked; IsUpdated = true; } objMaster.Save(); if (IsUpdated) { General.LoadConfiguration(); } Close(); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }