protected void btnOtherSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.VoyageId)) { ShowMsg("请先保存航次信息。"); return; } ShipInfo sInfo = new Ship().GetByID(ddlShipName.SelectedValue); VoyageOtherInfo voInfo = new VoyageOther().GetByVoyageID(this.VoyageId); if (voInfo == null) { voInfo = new VoyageOtherInfo(); } voInfo.VoyageID = this.VoyageId; voInfo.Customer = tbCustomer.Text; voInfo.Remark = tbRemark.Text; voInfo.User1 = tbOtherUser1.Text; voInfo.User2 = tbOtherUser2.Text; voInfo.User3 = tbOtherUser3.Text; voInfo.Amount = tbOtherFee.Text; voInfo.OtherName = tbOtherName.Text; voInfo.CurrencyID = ddlCurrencyOther.SelectedValue; if (string.IsNullOrEmpty(voInfo.ID)) { new VoyageOther().Add(voInfo); } else { new VoyageOther().Update(voInfo); } lbOtherRMB.Text = new ExchangeRate().GetRMB(voInfo.Amount, voInfo.CurrencyID, voInfo.CreateTime).ToString(); ShowMsg("操作成功!"); } catch (ArgumentNullException aex) { ShowMsg(aex.Message); } catch (Exception ex) { ShowMsg(ex.Message); Log(ex); } }
/// <summary> /// 更新费用类别 /// </summary> /// <param name="cInfo">实体</param> public void Update(VoyageOtherInfo 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); }
/// <summary> /// 添加费用类别 /// </summary> /// <param name="ID">实体主键</param> /// <returns></returns> public void Delete(string ID) { VoyageOtherInfo cInfo = new VoyageOtherInfo(ID); dal.Delete(cInfo); }
/// <summary> /// 添加费用类别 /// </summary> /// <param name="cInfo">实体</param> /// <returns>新增实体的主键</returns> public string Add(VoyageOtherInfo cInfo) { return dal.Add(cInfo); }