/// <summary> /// 保存列表中收费标准 /// </summary> /// <param name="tariff"></param> private void SaveDgvTariffInfo(object sender, EventArgs e) { if (typeof(CTariffDto) != sender.GetType()) { return; } CTariffDto tariff = (CTariffDto)sender; bool bAdd = true; // 更新 foreach (CTariffDto dto in this.CboTariffDescp.Items) { if (dto.id == tariff.id) { int nIndex = this.CboTariffDescp.Items.IndexOf(dto); if (-1 != nIndex) { bAdd = false; this.CboTariffDescp.Items.RemoveAt(nIndex); this.CboTariffDescp.Items.Insert(nIndex, tariff); break; } } } // 添加列表信息 if (bAdd) { tariff.id = this.CboTariffDescp.Items.Count + 1; this.CboTariffDescp.Items.Add(tariff); } m_form.Close(); }
/// <summary> /// 获取收费标准实例 /// </summary> /// <returns></returns> private CTariffDto GetTariffInfo() { CTariffDto tariff = new CTariffDto(); //if (null != this.Tag && typeof(int) == this.Tag.GetType()) //{ // tariff.id = (int)this.Tag; //} tariff.iccardtype = (int)CStaticClass.ConvertICCardType(this.CboCardType.Text); tariff.feetype = (int)CStaticClass.ConvertFeeType(this.CboFeeTypeTariff.Text); tariff.tariffdescp = this.TxtTariffDescp.Text; float fee; if (this.TxtFee.Visible) { float.TryParse(this.TxtFee.Text.Trim(), out fee); tariff.fee = fee;// 固定卡总费用 return(tariff); } if (CuttpHour.Visible) { CuttpHour.GetTariffInfo(ref tariff); } return(tariff); }
/// <summary> /// 设置收费标准实例 /// </summary> /// <returns></returns> public void SetTariffInfo(CTariffDto tariff) { try { this.Tag = 0; this.CboCardType.SelectedIndex = -1; this.CboFeeTypeTariff.SelectedIndex = -1; this.TxtFee.Text = ""; this.DtpICCardStart.Value = CStaticClass.DefDatetime; this.DtpICCardEnd.Value = CStaticClass.DefDatetime; if (null == tariff) { SetTempHourControl(false); return; } CuttpHour.SetTariffInfo(tariff); this.Tag = tariff.id; this.CboCardType.Text = CStaticClass.ConvertICCardType(tariff.iccardtype); this.CboFeeTypeTariff.Text = CStaticClass.ConvertFeeType(tariff.feetype); this.TxtFee.Text = tariff.fee.ToString(); this.TxtTariffDescp.Text = tariff.tariffdescp; } catch (Exception exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 移除数据列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public bool DeleteDataList(object data) { bool flag = true; // 所有列表处理 if (data.GetType() == typeof(COperatorDto)) { COperatorDto dto = (COperatorDto)data; flag = m_lstOperator.RemoveAll(s => s.optcode == dto.optcode) > 0 ? true : false; } else if (data.GetType() == typeof(struCustomerInfo)) { struCustomerInfo dto = (struCustomerInfo)data; flag = m_lstStruCUSTInfo.RemoveAll(s => s.strICCardID == dto.strICCardID && s.strName == dto.strName) > 0 ? true : false; } else if (data.GetType() == typeof(CSoundDto)) { CSoundDto dto = (CSoundDto)data; flag = m_lstSound.RemoveAll(s => s.soundcode == dto.soundcode) > 0 ? true : false; } else if (data.GetType() == typeof(CLedContentDto)) { CLedContentDto dto = (CLedContentDto)data; flag = m_lstLedContent.RemoveAll(s => s.id == dto.id) > 0 ? true : false; } else if (data.GetType() == typeof(CICCardLogDto)) { CICCardLogDto dto = (CICCardLogDto)data; flag = m_lstICCardLog.RemoveAll(s => s.id == dto.id) > 0 ? true : false; } else if (data.GetType() == typeof(CSystemLogDto)) { CSystemLogDto dto = (CSystemLogDto)data; flag = m_lstSystemLog.RemoveAll(s => s.logid == dto.logid) > 0 ? true : false; } else if (data.GetType() == typeof(CTelegramLogDto)) { CTelegramLogDto dto = (CTelegramLogDto)data; flag = m_lstTelegramLog.RemoveAll(s => s.id == dto.id) > 0 ? true : false; } else if (data.GetType() == typeof(CDeviceFaultLogDto)) { CDeviceFaultLogDto dto = (CDeviceFaultLogDto)data; flag = m_lstDeviceFaultLog.RemoveAll(s => s.id == dto.id) > 0 ? true : false; } else if (data.GetType() == typeof(CDeviceStatusLogDto)) { CDeviceStatusLogDto dto = (CDeviceStatusLogDto)data; flag = m_lstDeviceStatusLog.RemoveAll(s => s.id == dto.id) > 0 ? true : false; } else if (data.GetType() == typeof(CTariffDto)) { CTariffDto dto = (CTariffDto)data; flag = m_lstTariff.RemoveAll(s => s.id == dto.id) > 0 ? true : false; } return(flag); }
/// <summary> /// 登陆界面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CFormTariff_Load(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { // 查询所有标准收费信息 List <CTariffDto> lstTariff = proxy.GetTariffList(); if (EnmICCardType.Temp == m_currentICCardType) { lstTariff = lstTariff.FindAll(s => s.iccardtype == (int)m_currentICCardType); } else { lstTariff = lstTariff.FindAll(s => s.iccardtype != (int)EnmICCardType.Temp); } this.CboTariffDescp.Items.Clear(); // 添加列表信息 this.CboTariffDescp.Items.AddRange(lstTariff.ToArray()); CTariffDto tariff = lstTariff.Find(s => s.id == m_nTariffID); if (null != tariff) { this.CboTariffDescp.SelectedItem = tariff; } else { this.CutpTariff.Visible = false; } } catch (TimeoutException) { MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FaultException exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (CommunicationException exception) { MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } proxy.Close(); }
public override void CalcParkingFees(ref struBillInfo struBillInfo, CTariffDto tariffTBL) { //struBillInfo.dtStartTime = struBillInfo.dtEndTime.AddMonths(-m_dMonths); struBillInfo.strCalculateDays = (struBillInfo.dtEndTime - DateTime.Now).Days.ToString(); if (0 > struBillInfo.fPayableFee && struBillInfo.dtEndTime < DateTime.Now) {// 当前卡已存车且IC卡已过期,请补交费用 int nDays = Math.Max(struBillInfo.dtEndTime.Subtract(struBillInfo.dtStartTime).Days, 1); float fDayFee = struBillInfo.fTariffNorm / nDays; int nCalculateDays = Math.Max(DateTime.Now.Subtract(struBillInfo.dtEndTime).Days, 0); struBillInfo.fPayableFee = nCalculateDays * fDayFee; } }
/// <summary> /// 确认选择 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnOk_Click(object sender, EventArgs e) { if (null != this.CboTariffDescp.SelectedItem) { CTariffDto tariff = (CTariffDto)this.CboTariffDescp.SelectedItem; DateTime fixStartTime; DateTime fixEndTime; this.CutpTariff.GetFixDateTime(out fixStartTime, out fixEndTime); if (null != this.Owner && typeof(CFormCustomer) == this.Owner.GetType()) { ((CFormCustomer)this.Owner).SetTariffID(tariff, fixStartTime, fixEndTime); this.Close(); } } }
/// <summary> /// 计费标准选择 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CboTariffDescp_SelectedIndexChanged(object sender, EventArgs e) { CTariffDto tariff = (CTariffDto)this.CboTariffDescp.SelectedItem; CutpTariff.SetTariffInfo(tariff); if ((int)EnmICCardType.Temp == tariff.iccardtype) { CutpTariff.SetFixVisable(false); } else { CutpTariff.SetFixVisable(true); } this.CutpTariff.Visible = true; }
/// <summary> /// 删除列表中收费标准 /// </summary> /// <param name="tariff"></param> private void RemoveDgvTariffInfo(object sender, EventArgs e) { if (typeof(CTariffDto) != sender.GetType()) { return; } CTariffDto tariff = (CTariffDto)sender; // 删除列表信息 this.CboTariffDescp.Items.Remove(tariff); foreach (CTariffDto dto in this.CboTariffDescp.Items) { if (dto.id > tariff.id) { dto.id -= 1; } } m_form.Close(); }
/// <summary> /// 计费标准文本改变触发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CboTariff_SelectedIndexChanged(object sender, EventArgs e) { try { CTariffDto tariff = (CTariffDto)this.CboTariff.SelectedItem; SetTariffInfo(tariff); } catch (TimeoutException) { MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FaultException exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (CommunicationException exception) { MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 计费标准绑定到数据值时发生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CboTariffDescp_Format(object sender, ListControlConvertEventArgs e) { try { CTariffDto tariff = (CTariffDto)e.ListItem; e.Value = tariff.tariffdescp; } catch (TimeoutException) { MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FaultException exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (CommunicationException exception) { MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public abstract void CalcParkingFees(ref struBillInfo struBillInfo, CTariffDto tariffTBL);
/// <summary> /// 单位向上取整方式-计算临时卡计时卡费用(0点为跨天节点) /// </summary> /// <param name="struBillInfo"></param> /// <param name="tariffTBL"></param> private void CalcTempFeeByUnit(ref struBillInfo struBillInfo, CTariffDto tariffTBL) { if (null == tariffTBL || null == struBillInfo.dtStartTime || null == struBillInfo.dtEndTime) { return; } float fPayableFee = 0; // 是否区分工作日 bool bWorkday = true; // 工作日高峰起始时间、工作日高峰截止时间、非工作日高峰起始时间、非工作日高峰截止时间 TimeSpan tsWorkPeakStart, tsWorkPeakEnd, tsNonworkPeakStart, tsNonworkPeakEnd; // 工作日限额、非工作日限额、一天费用 float fWorkDayFee, fNonworkDayFee, fFee; // 工作日高峰首单位内单价、工作日高峰首单位外单价、工作日非高峰首单位内单价、工作日非高峰首单位外单价 float fWorkPeakInFee, fWorkPeakOutFee, fWorkNonpeakInFee, fWorkNonpeakOutFee; // 工作日高峰首单位内单位、工作日高峰首单位外单位、工作日非高峰首单位内单位、工作日非高峰首单位外单位(以分钟为单元) int nWorkPeakInUnit, nWorkPeakOutUnit, nWorkNonpeakInUnit, nWorkNonpeakOutUnit; // 非工作日高峰首单位内单价、非工作日高峰首单位外单价、非工作日非高峰首单位内单价、非工作日非高峰首单位外单价 float fNonworkPeakInFee, fNonworkPeakOutFee, fNonworkNonpeakInFee, fNonworkNonpeakOutFee; // 非工作日高峰首单位内单位、非工作日高峰首单位外单位、非工作日非高峰首单位内单位、非工作日非高峰首单位外单位(以分钟为单元) int nNonworkPeakInUnit, nNonworkPeakOutUnit, nNonworkNonpeakInUnit, nNonworkNonpeakOutUnit; TimeSpan ts24End;// 24:00:00时间 DateTime dsCurrent = struBillInfo.dtStartTime; DateTime dsEnd = struBillInfo.dtEndTime; #region 解析CTariffDto属性值 if (0 == tariffTBL.isworkday) { bWorkday = false; } CBaseMethods.MyBase.ConvertTimePeriod(tariffTBL.workpeakperiod, out tsWorkPeakStart, out tsWorkPeakEnd); CBaseMethods.MyBase.ConvertTimePeriod(tariffTBL.nonworkpeakperiod, out tsNonworkPeakStart, out tsNonworkPeakEnd); fWorkDayFee = null == tariffTBL.workdayquotafee ? 0.0f : (float)tariffTBL.workdayquotafee; fNonworkDayFee = null == tariffTBL.nonworkdayquotafee ? 0.0f : (float)tariffTBL.nonworkdayquotafee; fFee = null == tariffTBL.fee ? 0.0f : (float)tariffTBL.fee; fWorkPeakInFee = CBaseMethods.MyBase.ConvertUnitToInt(tariffTBL.workpeakinunitfee, out nWorkPeakInUnit); fWorkPeakOutFee = CBaseMethods.MyBase.ConvertUnitToInt(tariffTBL.workpeakoutunitfee, out nWorkPeakOutUnit); fWorkNonpeakInFee = CBaseMethods.MyBase.ConvertUnitToInt(tariffTBL.worknonpeakinunitfee, out nWorkNonpeakInUnit); fWorkNonpeakOutFee = CBaseMethods.MyBase.ConvertUnitToInt(tariffTBL.worknonpeakoutunitfee, out nWorkNonpeakOutUnit); fNonworkPeakInFee = CBaseMethods.MyBase.ConvertUnitToInt(tariffTBL.nonworkpeakinunitfee, out nNonworkPeakInUnit); fNonworkPeakOutFee = CBaseMethods.MyBase.ConvertUnitToInt(tariffTBL.nonworkpeakoutunitfee, out nNonworkPeakOutUnit); fNonworkNonpeakInFee = CBaseMethods.MyBase.ConvertUnitToInt(tariffTBL.nonworknonpeakinunitfee, out nNonworkNonpeakInUnit); fNonworkNonpeakOutFee = CBaseMethods.MyBase.ConvertUnitToInt(tariffTBL.nonworknonpeakoutunitfee, out nNonworkNonpeakOutUnit); TimeSpan.TryParse("24:00:00", out ts24End); #endregion #region 首单位内计算 if (bWorkday && IsNonworkdays(dsCurrent)) {// 区分工作日,判断当前日期是否为非工作日 string strNonworkFirstUnit = tariffTBL.nonworkpeakfirstunit; if (0 > dsCurrent.TimeOfDay.CompareTo(tsNonworkPeakStart) || 0 < dsCurrent.TimeOfDay.CompareTo(tsNonworkPeakEnd)) {// 起始时间在非工作日非高峰时段内 strNonworkFirstUnit = tariffTBL.nonworknonpeakfirstunit; } if (!CBaseMethods.MyBase.IsEmpty(strNonworkFirstUnit)) {// 区分首单位(以分钟为单元) int nNonworkFirstUnit; CBaseMethods.MyBase.ConvertUnitToInt(strNonworkFirstUnit, out nNonworkFirstUnit); dsCurrent = dsCurrent.AddMinutes(nNonworkFirstUnit); if (struBillInfo.dtStartTime.Date == dsCurrent.Date) { fPayableFee += CalculateOneDayFee(struBillInfo.dtStartTime.TimeOfDay, dsCurrent.TimeOfDay, tsNonworkPeakStart, tsNonworkPeakEnd, nNonworkPeakInUnit, nNonworkNonpeakInUnit, fNonworkPeakInFee, fNonworkNonpeakInFee); } else {// 跨天情况 fPayableFee += CalculateOneDayFee(struBillInfo.dtStartTime.TimeOfDay, ts24End, tsNonworkPeakStart, tsNonworkPeakEnd, nNonworkPeakInUnit, nNonworkNonpeakInUnit, fNonworkPeakInFee, fNonworkNonpeakInFee); fPayableFee += CalculateOneDayFee(new TimeSpan(0, 0, 0), dsCurrent.TimeOfDay, tsNonworkPeakStart, tsNonworkPeakEnd, nNonworkPeakInUnit, nNonworkNonpeakInUnit, fNonworkPeakInFee, fNonworkNonpeakInFee); } } } else {// 工作日 string strWorkFirstUnit = tariffTBL.workpeakfirstunit; if (0 > dsCurrent.TimeOfDay.CompareTo(tsWorkPeakStart) || 0 < dsCurrent.TimeOfDay.CompareTo(tsWorkPeakEnd)) {// 起始时间在工作日非高峰时段内 strWorkFirstUnit = tariffTBL.worknonpeakfirstunit; } if (!CBaseMethods.MyBase.IsEmpty(strWorkFirstUnit)) {// 区分首单位 int nWorkFirstUnit; CBaseMethods.MyBase.ConvertUnitToInt(strWorkFirstUnit, out nWorkFirstUnit); dsCurrent = dsCurrent.AddMinutes(nWorkFirstUnit); if (struBillInfo.dtStartTime.Date == dsCurrent.Date) { fPayableFee += CalculateOneDayFee(struBillInfo.dtStartTime.TimeOfDay, dsCurrent.TimeOfDay, tsWorkPeakStart, tsWorkPeakEnd, nWorkPeakInUnit, nWorkNonpeakInUnit, fWorkPeakInFee, fWorkNonpeakInFee); } else {// 跨天情况 fPayableFee += CalculateOneDayFee(struBillInfo.dtStartTime.TimeOfDay, ts24End, tsWorkPeakStart, tsWorkPeakEnd, nWorkPeakInUnit, nWorkNonpeakInUnit, fWorkPeakInFee, fWorkNonpeakInFee); fPayableFee += CalculateOneDayFee(new TimeSpan(0, 0, 0), dsCurrent.TimeOfDay, tsWorkPeakStart, tsWorkPeakEnd, nWorkPeakInUnit, nWorkNonpeakInUnit, fWorkPeakInFee, fWorkNonpeakInFee); } } } #endregion #region 首单位外计算 while (dsCurrent < dsEnd) { TimeSpan tsPeakStart, tsPeakEnd; int nPeakUnit, nNonpeakUnit; float fPeakFee, fNonpeakFee, fDayFee, fCalulateFee; if (bWorkday && IsNonworkdays(dsCurrent)) {// 区分工作日,判断当前日期是否为非工作日 tsPeakStart = tsNonworkPeakStart; tsPeakEnd = tsNonworkPeakEnd; nPeakUnit = nNonworkPeakOutUnit; nNonpeakUnit = nNonworkNonpeakOutUnit; fPeakFee = fNonworkPeakOutFee; fNonpeakFee = fNonworkNonpeakOutFee; float dPeakMinutes = (float)(tsPeakEnd.Subtract(tsPeakStart)).TotalMinutes; fDayFee = dPeakMinutes / nPeakUnit * fPeakFee + (1440 - dPeakMinutes) / nNonpeakUnit * fNonpeakFee; // 无限额时,按照一天费用计算 fDayFee = fNonworkDayFee < 0.1 ? fDayFee : fNonworkDayFee; } else {// 工作日 tsPeakStart = tsWorkPeakStart; tsPeakEnd = tsWorkPeakEnd; nPeakUnit = nWorkPeakOutUnit; nNonpeakUnit = nWorkNonpeakOutUnit; fPeakFee = fWorkPeakOutFee; fNonpeakFee = fWorkNonpeakOutFee; // 无限额时,按照一天费用计算 fDayFee = fWorkDayFee < 0.1 ? fFee : fWorkDayFee; } if (dsCurrent.Date == dsEnd.Date && 0 > dsCurrent.TimeOfDay.CompareTo(dsEnd.TimeOfDay)) {// 一天内情况 fCalulateFee = CalculateOneDayFee(dsCurrent.TimeOfDay, dsEnd.TimeOfDay, tsPeakStart, tsPeakEnd, nPeakUnit, nNonpeakUnit, fPeakFee, fNonpeakFee); fCalulateFee = fCalulateFee < fDayFee ? fCalulateFee : fDayFee; fPayableFee += fCalulateFee; break; } else if (dsCurrent.Date < dsEnd.Date) { // 跨天情况 if (0 == dsCurrent.TimeOfDay.TotalSeconds) { // 一整天时间 fPayableFee += fDayFee; } else {// 计算当天 fCalulateFee = CalculateOneDayFee(dsCurrent.TimeOfDay, ts24End, tsPeakStart, tsPeakEnd, nPeakUnit, nNonpeakUnit, fPeakFee, fNonpeakFee); fCalulateFee = fCalulateFee < fDayFee ? fCalulateFee : fDayFee; fPayableFee += fCalulateFee; } // 累积天数向截止日期靠拢 dsCurrent = dsCurrent.AddDays(1).Date; } else { break; } } #endregion struBillInfo.fPayableFee = fPayableFee; TimeSpan ts = struBillInfo.dtEndTime - struBillInfo.dtStartTime; int hours = ts.Hours + (ts.Minutes > 0 ? 1 : 0);// 停车总时间 struBillInfo.strCalculateDays = ts.Days + "天" + hours + "小时"; }
public override void CalcParkingFees(ref struBillInfo struBillInfo, CTariffDto tariffTBL) { CalcTempFeeEnterTimeByUnit(ref struBillInfo, tariffTBL); }
/// <summary> /// 删除选择 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnDeleteSel_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { DialogResult dr = MessageBox.Show("确定删除选择吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); if (dr == DialogResult.Cancel) { return; } bool bFlag = false; CTariffDto tariff = (CTariffDto)this.CboTariffDescp.SelectedItem; EnmFaultType type = proxy.DeleteTariff(tariff); if (EnmFaultType.Success == type) { this.CboTariffDescp.Items.Remove(tariff); foreach (CTariffDto dto in this.CboTariffDescp.Items) { if (dto.id > tariff.id) { dto.id -= 1; } } if (null == this.CboTariffDescp.Items || 1 > this.CboTariffDescp.Items.Count) { this.CutpTariff.Visible = false; } bFlag = true; } if (bFlag) { MessageBox.Show("删除成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("删除失败", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } catch (TimeoutException) { MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FaultException exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (CommunicationException exception) { MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } proxy.Close(); }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnDelete_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { if (null == this.CboTariff.SelectedItem || typeof(CTariffDto) != this.CboTariff.SelectedItem.GetType()) { MessageBox.Show("计费标准不能为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } CTariffDto tariff = (CTariffDto)this.CboTariff.SelectedItem; EnmFaultType type = proxy.DeleteTariff(tariff); switch (type) { case EnmFaultType.Success: { this.CboTariff.Items.Remove(tariff); foreach (CTariffDto dto in this.CboTariff.Items) { if (dto.id > tariff.id) { dto.id -= 1; } } SetTariffInfo(null); MessageBox.Show("删除成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); break; } case EnmFaultType.FailToDelete: { MessageBox.Show("删除数据库失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case EnmFaultType.Exception: { MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } default: { MessageBox.Show("删除失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } } } catch (TimeoutException) { MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FaultException exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (CommunicationException exception) { MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } proxy.Close(); }
/// <summary> /// 增加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSave_Click(object sender, EventArgs e) { if (!CStaticClass.CheckPushService()) {// 检查服务 return; } QueryServiceClient proxy = new QueryServiceClient(); try { if (string.IsNullOrEmpty(this.CboCardType.Text) || string.IsNullOrEmpty(this.CboFeeTypeTariff.Text)) { MessageBox.Show("IC卡类型、计费类型都不能为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } CTariffDto tariff = GetTariffInfo(); EnmFaultType type = proxy.SaveTariff(tariff); switch (type) { case EnmFaultType.Success: { if (null != ModifyDgvTariffRow) { ModifyDgvTariffRow(tariff, e); } tariff.id = this.CboTariff.Items.Count + 1; this.CboTariff.Items.Add(tariff); SetTariffInfo(null); MessageBox.Show("添加/修改成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); break; } case EnmFaultType.FailToInsert: { MessageBox.Show("插入数据库失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case EnmFaultType.FailToUpdate: { MessageBox.Show("更新数据库失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case EnmFaultType.Exception: { MessageBox.Show(CStaticClass.GetExceptionInfo(null), "连接异常", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } default: { MessageBox.Show("保存失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } } } catch (TimeoutException) { MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (FaultException exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (CommunicationException exception) { MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } proxy.Close(); }
public void CalcParkingFees(ref struBillInfo struBillInfo, CTariffDto tariffTBL) { m_objStandard.CalcParkingFees(ref struBillInfo, tariffTBL); }
/// <summary> /// 修改数据项 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void ModifyDataItem(object data) { // 所有列表处理 if (data.GetType() == typeof(COperatorDto)) { COperatorDto dto = (COperatorDto)data; int index = m_lstOperator.FindIndex(s => s.optcode == dto.optcode); if (-1 == index) { m_lstOperator.Add(dto); } else { m_lstOperator.RemoveAt(index); m_lstOperator.Insert(index, dto); } } else if (data.GetType() == typeof(struCustomerInfo)) { struCustomerInfo dto = (struCustomerInfo)data; int index = m_lstStruCUSTInfo.FindIndex(s => s.strICCardID == dto.strICCardID); if (-1 == index) { m_lstStruCUSTInfo.Add(dto); } else { m_lstStruCUSTInfo.RemoveAt(index); m_lstStruCUSTInfo.Insert(index, dto); } } else if (data.GetType() == typeof(CSoundDto)) { CSoundDto dto = (CSoundDto)data; int index = m_lstSound.FindIndex(s => s.soundcode == dto.soundcode); if (-1 == index) { m_lstSound.Add(dto); } else { m_lstSound.RemoveAt(index); m_lstSound.Insert(index, dto); } } else if (data.GetType() == typeof(CLedContentDto)) { CLedContentDto dto = (CLedContentDto)data; int index = m_lstLedContent.FindIndex(s => s.id == dto.id); if (-1 == index) { m_lstLedContent.Add(dto); } else { m_lstLedContent.RemoveAt(index); m_lstLedContent.Insert(index, dto); } } else if (data.GetType() == typeof(CICCardLogDto)) { CICCardLogDto dto = (CICCardLogDto)data; int index = m_lstICCardLog.FindIndex(s => s.id == dto.id); if (-1 == index) { m_lstICCardLog.Add(dto); } else { m_lstICCardLog.RemoveAt(index); m_lstICCardLog.Insert(index, dto); } } else if (data.GetType() == typeof(CSystemLogDto)) { CSystemLogDto dto = (CSystemLogDto)data; int index = m_lstSystemLog.FindIndex(s => s.logid == dto.logid); if (-1 == index) { m_lstSystemLog.Add(dto); } else { m_lstSystemLog.RemoveAt(index); m_lstSystemLog.Insert(index, dto); } } else if (data.GetType() == typeof(CTelegramLogDto)) { CTelegramLogDto dto = (CTelegramLogDto)data; int index = m_lstTelegramLog.FindIndex(s => s.id == dto.id); if (-1 == index) { m_lstTelegramLog.Add(dto); } else { m_lstTelegramLog.RemoveAt(index); m_lstTelegramLog.Insert(index, dto); } } else if (data.GetType() == typeof(CDeviceFaultLogDto)) { CDeviceFaultLogDto dto = (CDeviceFaultLogDto)data; int index = m_lstDeviceFaultLog.FindIndex(s => s.id == dto.id); if (-1 == index) { m_lstDeviceFaultLog.Add(dto); } else { m_lstDeviceFaultLog.RemoveAt(index); m_lstDeviceFaultLog.Insert(index, dto); } } else if (data.GetType() == typeof(CDeviceStatusLogDto)) { CDeviceStatusLogDto dto = (CDeviceStatusLogDto)data; int index = m_lstDeviceStatusLog.FindIndex(s => s.id == dto.id); if (-1 == index) { m_lstDeviceStatusLog.Add(dto); } else { m_lstDeviceStatusLog.RemoveAt(index); m_lstDeviceStatusLog.Insert(index, dto); } } else if (data.GetType() == typeof(CTariffDto)) { CTariffDto dto = (CTariffDto)data; int index = m_lstTariff.FindIndex(s => s.id == dto.id); if (-1 == index) { m_lstTariff.Add(dto); } else { m_lstTariff.RemoveAt(index); m_lstTariff.Insert(index, dto); } } UpdatePages(); }