protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             TitleInitial("集装箱箱体保险", "用户可以维护集装箱箱体保险相关信息。");
             this.DimID = GetRequest("dimID");
             BindCurrency();
             this.ID = GetRequest("ID");
             InsuranceOfContainerInfo wInfo = new InsuranceOfContainerInfo();
             if (string.IsNullOrEmpty(this.ID) == false)
             {
                 wInfo = new InsuranceOfContainer().GetByID(this.ID);
             }
             SetPageValue(wInfo);
             BindRate();
         }
     }
     catch (ArgumentNullException aex)
     {
         ShowMsg(aex.Message);
     }
     catch (Exception ex)
     {
         ShowMsg(ex.Message);
         Log(ex);
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string id = this.ID;
                InsuranceOfContainerInfo wInfo = new InsuranceOfContainerInfo();
                if (string.IsNullOrEmpty(id) == false)
                {
                    wInfo = new InsuranceOfContainer().GetByID(id);
                }

                wInfo.InputUserID = this.UserCacheInfo.ID;
                string year = tbYear.Text;
                string dimTimeID = new DimTime().GetIDByMonth(year, "12");
                wInfo.DimTimeID = dimTimeID;
                wInfo.CurrencyID = ddlCurrency.SelectedValue;
                wInfo.ExchangeRateID = this.RateID;

                wInfo.保险期限自 = DateTime.Parse(cBeginDate.Text);
                wInfo.保险期限到 = DateTime.Parse(cEndDate.Text);
                wInfo.柜号起始字母 = tb柜号起始字母.Text;
                wInfo.保费 = tb保费.Text;
                wInfo.集装箱数量20 = tb集装箱数量20.Text;
                wInfo.集装箱数量40 = tb集装箱数量40.Text;
                wInfo.单价20 = tb单价20.Text;
                wInfo.单价40 = tb单价40.Text;
                wInfo.保额 = tb保额.Text;
                wInfo.基本险保险费率 = tb基本险保险费率.Text;
                wInfo.备注 = tb备注.Text;

                if (string.IsNullOrEmpty(id) == true)
                {
                    this.ID = new InsuranceOfContainer().Add(wInfo);
                    ReportCatalog catalog = ReportCatalog.InsuranceOfContainer;
                    BindList(this.ID, catalog);
                }
                else
                {
                    new InsuranceOfContainer().Update(wInfo);
                }
                ShowMsg("报表保存成功。");
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
        /// <summary>
        /// 根据页面实体设置页面值
        /// </summary>
        /// <param name="wInfo"></param>
        private void SetPageValue(InsuranceOfContainerInfo wInfo)
        {
            tbUserName.Text = this.UserCacheInfo.Name;
            tbCreateTime.Text = wInfo.CreateTime.ToShortDateString();
            tbYear.Text = wInfo.CreateTime.Year.ToString();
            if (string.IsNullOrEmpty(wInfo.ID))
            {
                return;
            }
            DimTimeInfo dInfo = new DimTime().GetDimTimeInfo(wInfo.DimTimeID);
            tbYear.Text = dInfo.Year.ToString();
            tbUserName.Text = this.UserCacheInfo.Name;
            tbCreateTime.Text = wInfo.CreateTime.ToShortDateString();

            ddlCurrency.SelectedValue = wInfo.CurrencyID;
            ddlYear.SelectedValue = dInfo.Year.ToString();
            ddlMonth.SelectedValue = dInfo.MonthNumOfYear.ToString();

            cBeginDate.Text = wInfo.保险期限自.ToShortDateString();
            cEndDate.Text = wInfo.保险期限到.ToShortDateString();
            tb柜号起始字母.Text = wInfo.柜号起始字母;
            tb保费.Text = wInfo.保费;
            tb集装箱数量20.Text = wInfo.集装箱数量20;
            tb集装箱数量40.Text = wInfo.集装箱数量40;
            tb单价20.Text = wInfo.单价20;
            tb单价40.Text = wInfo.单价40;
            tb保额.Text = wInfo.保额;
            tb基本险保险费率.Text = wInfo.基本险保险费率;
            tb备注.Text = wInfo.备注;
            BindList(this.ID, ReportCatalog.InsuranceOfContainer);
        }
 /// <summary>
 /// 更新费用类别
 /// </summary>
 /// <param name="cInfo">实体</param>
 public void Update(InsuranceOfContainerInfo cInfo)
 {
     if (string.IsNullOrEmpty(cInfo.ID))
     {
         throw new ArgumentNullException("参数ID不能为空。");
     }
     dal.Update(cInfo);
 }
 /// <summary>
 /// 添加费用类别
 /// </summary>
 /// <param name="cInfo">实体</param>
 /// <returns>新增实体的主键</returns>
 public string Add(InsuranceOfContainerInfo cInfo)
 {
     return dal.Add(cInfo);
 }
 /// <summary>
 /// 添加费用类别
 /// </summary>
 /// <param name="ID">实体主键</param>
 /// <returns></returns>
 public void Delete(string ID)
 {
     InsuranceOfContainerInfo cInfo = new InsuranceOfContainerInfo(ID);
     dal.Delete(cInfo);
 }