/// <summary> /// 添加费用类别 /// </summary> /// <param name="ID">实体主键</param> /// <returns></returns> public void Delete(string ID) { RentContainerReportInfo cInfo = new RentContainerReportInfo(ID); dal.Delete(cInfo); }
/// <summary> /// 添加费用类别 /// </summary> /// <param name="cInfo">实体</param> /// <returns>新增实体的主键</returns> public string Add(RentContainerReportInfo cInfo) { string msg = string.Empty; //int restInt = 0; //int equalInt = 0; //if (int.TryParse(cInfo.Rest, out restInt) && int.TryParse(cInfo.EqualTo, out equalInt)) //{ // if (restInt > equalInt) // { // throw new ArgumentException("特殊的柜数目必须小于或者等于标准柜数目。"); // } //} return dal.Add(cInfo); }
/// <summary> /// 更新费用类别 /// </summary> /// <param name="cInfo">实体</param> public void Update(RentContainerReportInfo cInfo) { if (string.IsNullOrEmpty(cInfo.ID)) { throw new ArgumentNullException("参数ID不能为空。"); } //string msg = string.Empty; //int restInt = 0; //int equalInt = 0; //if (int.TryParse(cInfo.Rest, out restInt) && int.TryParse(cInfo.EqualTo, out equalInt)) //{ // if (restInt > equalInt) // { // throw new ArgumentException("特殊的柜数目必须小于或者等于标准柜数目。"); // } //} dal.Update(cInfo); }
protected void btnSave_Click(object sender, EventArgs e) { try { RentContainerReportInfo rInfo = new RentContainerReportInfo(); string id = this.RentContainerReportID; if (string.IsNullOrEmpty(id) == false) { rInfo = new RentContainerReport().GetByID(id); } rInfo.User1 = tbUser1.Text; rInfo.User2 = tbUser2.Text; rInfo.User3 = tbUser3.Text; rInfo.Customer = tbCustomer.Text; rInfo.TaxNo = tbTaxNo.Text; rInfo.BeginDate = Convert.ToDateTime(tbStartTime.Text); rInfo.EndDate = Convert.ToDateTime(tbEndTime.Text); rInfo.CurrencyID = ddlCurrency.SelectedValue; rInfo.RentDays = tbRentDay.Text; rInfo.Remark = tbRemark.Text; if (string.IsNullOrEmpty(id) == false) { new RentContainerReport().Update(rInfo); } else { this.RentContainerReportID = new RentContainerReport().Add(rInfo); } lbTotal.Text = new RentContainerReport().GetAmout(rInfo.ID); lbCName.Text = ddlCurrency.SelectedItem.Text; lbTotalRMB.Text = new ExchangeRate().GetRMB(lbTotal.Text, rInfo.CurrencyID, rInfo.CreateTime).ToString(); ShowMsg("保存成功。"); } catch (ArgumentException ae) { this.ShowMsg(ae.Message); } catch (Exception exc) { ShowMsg(exc.Message); } }