public CTariff(int nid, CICCard.EnmICCardType etype, EnmFeeUnit eunt, float ffee, float dtime, EnmFeeType eftype, bool busy) : this() { mnid = nid; metype = etype; //卡类型 meunit = eunt; mffee = ffee; mdtime = dtime; //计费时间-days meftype = eftype; //收费类型 isbusy = busy; }
private void rdMonth_CheckedChanged(object sender, EventArgs e) { EnmFeeUnit unit = EnmFeeUnit.Init; if (rdMonth.Checked) { unit = EnmFeeUnit.Month; } else if (rdSeason.Checked) { unit = EnmFeeUnit.Season; } else if (rdYear.Checked) { unit = EnmFeeUnit.Year; } try { lstTariffs = new List <CTariff>(Program.mng.SelectTariff()); //加载收费标准 if (lstTariffs != null) { CTariff tari = lstTariffs.Find(t => t.Type == tempFixLog.ICType && t.Unit == unit); if (tari != null) { txtFeeStandard.Text = tari.Fee.ToString(); } else { txtFeeStandard.Text = ""; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public async Task <ActionResult> SetFixUserFee() { Log log = LogFactory.GetLogger("SetFixUserFee"); Response resp = new Response(); #region CWICCard cwiccd = new CWICCard(); try { string proof = Request.Form["uiccd"]; //计费类型 string feetype = Request.Form["feetype"]; //费用标准 string feeStd = Request.Form["feeunit"]; //实收费用 string actualfee = Request.Form["actualfee"]; if (TempData["CustInfo"] == null) { resp.Message = "请先点击< 查询信息 >,再 确认缴费 !"; return(Json(resp)); } FixCustInfo oldInfo = (FixCustInfo)TempData["CustInfo"]; if (proof.Trim() != oldInfo.Proof.Trim()) { resp.Message = "查询条件已改变,请先点击< 查询信息 >,再 确认缴费 !"; return(Json(resp)); } Customer cust = await cwiccd.FindCustAsync(oldInfo.CustID); float standard = Convert.ToSingle(feeStd); float actual = Convert.ToSingle(actualfee); int rnd = (int)(actual / standard); EnmFeeUnit unit = (EnmFeeUnit)Convert.ToInt16(feetype); int months = 0; switch (unit) { case EnmFeeUnit.Month: months = 1 * rnd; break; case EnmFeeUnit.Season: months = 3 * rnd; break; case EnmFeeUnit.Year: months = 12 * rnd; break; default: break; } if (months == 0) { resp.Message = "系统异常,rnd- " + rnd + " , Unit- " + unit.ToString(); return(Json(resp)); } DateTime current = cust.Deadline; if (current == DateTime.Parse("2017-1-1")) { current = DateTime.Now; } cust.StartDTime = DateTime.Now; cust.Deadline = current.AddMonths(months); //更新期限 resp = cwiccd.UpdateCust(cust); oldInfo.LastDeadline = oldInfo.CurrDeadline; oldInfo.CurrDeadline = cust.Deadline.ToString(); if (resp.Code == 1) { #region 记录日志 string uty = ""; switch (cust.Type) { case EnmICCardType.Periodical: uty = "定期用户"; break; case EnmICCardType.FixedLocation: uty = "固定用户"; break; default: uty = cust.Type.ToString(); break; } string umsg = ""; switch (unit) { case EnmFeeUnit.Month: umsg = "月"; break; case EnmFeeUnit.Season: umsg = "季"; break; case EnmFeeUnit.Year: umsg = "年"; break; default: break; } string oprt = User.Identity.Name; FixUserChargeLog fixlog = new FixUserChargeLog { UserName = cust.UserName, PlateNum = cust.PlateNum, UserType = uty, Proof = oldInfo.Proof, LastDeadline = oldInfo.LastDeadline, CurrDeadline = oldInfo.CurrDeadline, FeeType = umsg, FeeUnit = standard, CurrFee = actual, OprtCode = oprt, RecordDTime = DateTime.Now }; await new CWTariffLog().AddFixLogAsync(fixlog); #endregion resp.Message = "缴费成功!"; NBackInfo nback = new NBackInfo() { LastDeadline = oldInfo.LastDeadline, CurrDeadline = oldInfo.CurrDeadline }; resp.Data = nback; } } catch (Exception ex) { log.Error(ex.ToString()); } #endregion return(Json(resp)); }
public CTariff() { metype = CICCard.EnmICCardType.Init; meunit = EnmFeeUnit.Init; meftype = EnmFeeType.Init; }