/// <summary> /// 添加日志 /// </summary> /// <param name="extensionCard"></param> private void AdddLog(ExtensionCard extensionCard) { ExtensionCardInfoModel extensionCardInfoModel=new ExtensionCardInfoModel(); extensionCardInfoModel.CreateTime = extensionCard.CreateTime; extensionCardInfoModel.ExtensionEndTm = extensionCard.ExtensionEndTm; extensionCardInfoModel.ExtensionStartTm = extensionCard.ExtensionStartTm; extensionCardInfoModel.MemberId = extensionCard.MemberId; int result=extensionCardInfoManager.Add(extensionCardInfoModel); }
/// <summary> /// 添加延期数据 /// </summary> private void AddExtension(MemberInfoModel memberInfoModel) { ExtensionCard extensionCard = new ExtensionCard(); extensionCard.CreateTime = DateTime.Now; extensionCard.ExtensionEndTm = this.dtp_ExtensionEndTime.Value; extensionCard.ExtensionStartTm = this.dtp_ExtensionStartTime.Value; extensionCard.MemberId = memberInfoModel.MemberID; int result = extensionCardManager.Add(extensionCard); if (result > 0) AdddLog(extensionCard); }
/// <summary> /// 获得数据列表 /// </summary> public List<Gymnasium_APP.Model.ExtensionCard> DataTableToList(DataTable dt) { List<Gymnasium_APP.Model.ExtensionCard> modelList = new List<Gymnasium_APP.Model.ExtensionCard>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Gymnasium_APP.Model.ExtensionCard model; for (int n = 0; n < rowsCount; n++) { model = new Gymnasium_APP.Model.ExtensionCard(); if (dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } if (dt.Rows[n]["MemberId"].ToString() != "") { model.MemberId = int.Parse(dt.Rows[n]["MemberId"].ToString()); } if (dt.Rows[n]["ExtensionStartTm"].ToString() != "") { model.ExtensionStartTm = DateTime.Parse(dt.Rows[n]["ExtensionStartTm"].ToString()); } if (dt.Rows[n]["ExtensionEndTm"].ToString() != "") { model.ExtensionEndTm = DateTime.Parse(dt.Rows[n]["ExtensionEndTm"].ToString()); } if (dt.Rows[n]["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(dt.Rows[n]["CreateTime"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 提交数据 /// </summary> private void SubmitData() { ExtensionCard extensionCard=new ExtensionCard(); extensionCard.CreateTime = DateTime.Now; extensionCard.ExtensionEndTm = this.dtp_ExtensionEndTime.Value; extensionCard.ExtensionStartTm = this.dtp_ExtensionStartTime.Value; extensionCard.MemberId = memberId; int result=extensionCardManager.Add(extensionCard); MessageBox.Show("单卡延期卡号:" + this.txt_CardNumber.Text + " 添加" + (result > 0 ? "成功!" : "失败!")); CommTools.AddSystemLog("单卡延期卡号", "卡号:" + txt_Name.Text.Trim() + " 添加" + (result > 0 ? "成功!" : "失败!")); // 添加记录 AdddLog(extensionCard); this.Close(); }