/// <summary> /// 获取列表 /// </summary> /// <param name="oilFeeReportID">消耗表主表ID</param> /// <returns>列表</returns> public IList<OilTypeFeeInfo> GetListAddBlank(string oilFeeReportID) { IList<OilTypeFeeInfo> list = GetList(oilFeeReportID); if (list == null) { list = new List<OilTypeFeeInfo>(); } OilTypeFeeInfo oInfo = new OilTypeFeeInfo(); list.Add(oInfo); return list; }
/// <summary> /// 加油记录操作 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void rList_RowCommand(object sender, GridViewCommandEventArgs e) { try { string id = e.CommandArgument.ToString(); if (e.CommandName == "btnDel") { new OilTypeFee().Delete(id); } else { OilTypeFeeInfo mInfo = new OilTypeFeeInfo(); if (string.IsNullOrEmpty(id) == false) { mInfo = new OilTypeFee().GetByID(id); } GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; DropDownList ddlPort = (DropDownList)gvr.FindControl("ddlPort"); SIRCWEB.Calendar cDate = (SIRCWEB.Calendar)gvr.FindControl("cDate"); DropDownList ddlOilType = (DropDownList)gvr.FindControl("ddlOilType"); TextBox tbAmout = (TextBox)gvr.FindControl("tbAmout"); TextBox tbPrice = (TextBox)gvr.FindControl("tbPrice"); DropDownList ddlCurrency = (DropDownList)gvr.FindControl("ddlCurrency"); mInfo.CreateTime = Convert.ToDateTime(cDate.Text); mInfo.CurrencyID = ddlCurrency.SelectedValue; mInfo.OilTypeID = ddlOilType.SelectedValue; mInfo.PortID = ddlPort.SelectedValue; mInfo.Price = tbPrice.Text; mInfo.Quantity = tbAmout.Text; mInfo.OilFeeReportID = this.ReportBaseID; if (e.CommandName == "btnSave") { new OilTypeFee().Update(mInfo); ShowMsg("更新成功。"); } if (e.CommandName == "btnAdd") { new OilTypeFee().Add(mInfo); ShowMsg("添加成功。"); } } IList<OilTypeFeeInfo> list = new OilTypeFee().GetListAddBlank(this.ReportBaseID); rList.DataSource = list; rList.DataBind(); } catch (ArgumentNullException aex) { ShowMsg(aex.Message); } catch (Exception ex) { ShowMsg(ex.Message); Log(ex); } }
/// <summary> /// 添加费用类别 /// </summary> /// <param name="cInfo">实体</param> /// <returns>新增实体的主键</returns> public string Add(OilTypeFeeInfo cInfo) { return dal.Add(cInfo); }
/// <summary> /// 添加费用类别 /// </summary> /// <param name="ID">实体主键</param> /// <returns></returns> public void Delete(string ID) { OilTypeFeeInfo cInfo = new OilTypeFeeInfo(ID); dal.Delete(cInfo); }
/// <summary> /// 更新费用类别 /// </summary> /// <param name="cInfo">实体</param> public void Update(OilTypeFeeInfo cInfo) { if (string.IsNullOrEmpty(cInfo.ID)) { throw new ArgumentNullException("参数ID不能为空。"); } dal.Update(cInfo); }