/// <summary> /// 增改船舶装箱情况 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.VoyageId)) { ShowMsg("请先保存航次信息。"); return; } ShipInfo sInfo = new Ship().GetByID(ddlShipName.SelectedValue); switch (sInfo.LoadTypeEnum) { case ShipType.FCL: //集装箱 VoyageLoadInfo vfInfo = new VoyageLoad().GetByVoyageID(this.VoyageId); if (vfInfo == null) { vfInfo = new VoyageLoadInfo(); } vfInfo.TEUEmpty = tbTEUEmpty.Text; vfInfo.TEUHeavy = tbTEUHeavy.Text; vfInfo.TEUFrost = tbTEUFROST.Text; vfInfo.FEUEmpty = tbFEUEmpty.Text; vfInfo.FEUHeavy = tbFEUHeavy.Text; vfInfo.FEUFrost = tbFEUFROST.Text; vfInfo.FEUDanger = tbFEUDANG.Text; vfInfo.FFEUEmpty = tbFFEUEmpty.Text; vfInfo.FFEUHeavy = tbFFEUHeavy.Text; vfInfo.FFEUFrost = tbFFEUFROST.Text; vfInfo.FFEUDanger = tbFFEUDANG.Text; vfInfo.Rest = tbRest.Text; vfInfo.EqualTo = tbEqualTo.Text; vfInfo.TotalNat = tbTotalNatu.Text; vfInfo.TotalStand = tbTotalStand.Text; vfInfo.VoyageID = this.VoyageId; if (string.IsNullOrEmpty(vfInfo.ID)) { new VoyageLoad().Add(vfInfo); } else { new VoyageLoad().Update(vfInfo); } break; default: break; } ShowMsg("操作成功!"); } catch (ArgumentNullException aex) { ShowMsg(aex.Message); } catch (Exception ex) { ShowMsg(ex.Message); Log(ex); } }
/// <summary> /// 更新费用类别 /// </summary> /// <param name="cInfo">实体</param> public void Update(VoyageLoadInfo 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) { VoyageLoadInfo cInfo = new VoyageLoadInfo(ID); dal.Delete(cInfo); }
/// <summary> /// 添加费用类别 /// </summary> /// <param name="cInfo">实体</param> /// <returns>新增实体的主键</returns> public string Add(VoyageLoadInfo 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); }