Beispiel #1
0
 /// <summary>
 /// 获取列表
 /// </summary>
 /// <param name="dateID">通过报告期查询</param>
 /// <returns>列表</returns>
 public IList<RentContainerInfo> GetList(string reportID)
 {
     IList<RentContainerInfo> list = new List<RentContainerInfo>();
     if (string.IsNullOrEmpty(reportID) == false)
     {
         list = dal.GetList(reportID);
     }
     RentContainerInfo rInfo = new RentContainerInfo();
     list.Add(rInfo);
     return list;
 }
Beispiel #2
0
 /// <summary>
 /// 添加费用类别
 /// </summary>
 /// <param name="cInfo">实体</param>
 /// <returns>新增实体的主键</returns>
 public string Add(RentContainerInfo 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);
 }
Beispiel #3
0
 /// <summary>
 /// 更新费用类别
 /// </summary>
 /// <param name="cInfo">实体</param>
 public void Update(RentContainerInfo 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);
 }
Beispiel #4
0
 /// <summary>
 /// 添加费用类别
 /// </summary>
 /// <param name="ID">实体主键</param>
 /// <returns></returns>
 public void Delete(string ID)
 {
     RentContainerInfo cInfo = new RentContainerInfo(ID);
     dal.Delete(cInfo);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(this.RentContainerReportID))
                {
                    ShowMsg("货柜租金报表未保存,无法为特定箱种的租金进行编辑。");
                    return;
                }
                string id = e.CommandArgument.ToString();
                GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                if (e.CommandName == "btnDel")
                {
                    new InstalmentOfCompensation().Delete(id);
                }
                else
                {
                    #region 控件
                    DropDownList rblContainerTypeID = (DropDownList)gvr.FindControl("rblContainerTypeID");
                    TextBox tbAmount = (TextBox)gvr.FindControl("tbAmount");
                    TextBox tbPrice = (TextBox)gvr.FindControl("tbPrice");
                    TextBox tbRentFee = (TextBox)gvr.FindControl("tbRentFee");
                    TextBox tbRemark = (TextBox)gvr.FindControl("tbRemark");
                    #endregion

                    RentContainerInfo info = new RentContainerInfo();
                    if (string.IsNullOrEmpty(id) == false)
                    {
                        info = new RentContainer().GetByID(id);
                    }
                    info.ReportID = this.RentContainerReportID;
                    info.ContainerTypeID = rblContainerTypeID.SelectedValue;
                    info.Amount = tbAmount.Text;
                    info.Price = tbPrice.Text;
                    info.RentFee = tbRentFee.Text;
                    info.Remark = tbRemark.Text;
                    if (e.CommandName == "btnEdit")
                    {
                        new RentContainer().Update(info);
                    }

                    if (e.CommandName == "btnAdd")
                    {
                        new RentContainer().Add(info);
                    }
                }
                gvList.DataSource = new RentContainer().GetList(this.RentContainerReportID);
                gvList.DataBind();

                RentContainerReportInfo rInfo = new RentContainerReport().GetByID(this.RentContainerReportID);
                lbTotal.Text = new RentContainerReport().GetAmout(rInfo.ID);
                lbCName.Text = rInfo.CurrencyName;
                lbTotalRMB.Text = new ExchangeRate().GetRMB(lbTotal.Text, rInfo.CurrencyID, rInfo.CreateTime).ToString();

                ShowMsg("更新成功!");
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }