Exemple #1
0
 /// <summary>
 /// 添加费用类别
 /// </summary>
 /// <param name="ID">实体主键</param>
 /// <returns></returns>
 public void Delete(string ID)
 {
     WuliaoInputInfo cInfo = new WuliaoInputInfo(ID);
     dal.Delete(cInfo);
 }
Exemple #2
0
 /// <summary>
 /// 更新费用类别
 /// </summary>
 /// <param name="cInfo">实体</param>
 public void Update(WuliaoInputInfo cInfo)
 {
     if (string.IsNullOrEmpty(cInfo.ID))
     {
         throw new ArgumentNullException("参数ID不能为空。");
     }
     // 加载报表之前的状态,如果状态一致,则直接更新,否则保存到文档库
     WuliaoInputInfo preInfo = GetByID(cInfo.ID);
     if (preInfo.ReportTypeID == cInfo.ReportTypeID)
     {
         dal.Update(cInfo);
         return;
     }
     if (preInfo.ReportTypeID == "1")
     {
         // 之前为预估输入存入文档库
         string formID = new FormLibrary<WuliaoInputInfo>().Add(preInfo);
         cInfo.PreestimateFormID = formID;
     }
     if (preInfo.ReportTypeID == "2")
     {
         // 之前为预估输入存入文档库
         string formID = new FormLibrary<WuliaoInputInfo>().Add(preInfo);
         cInfo.AmendFormID = formID;
     }
     dal.Update(cInfo);
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string id = this.ReportID;
                WuliaoInputInfo wInfo = new WuliaoInputInfo();
                if (string.IsNullOrEmpty(id) == false)
                {
                    wInfo = new WuliaoInput().GetByID(id);
                }

                wInfo.UsageType = rblUsage.SelectedValue;
                string reportTypeID = rblReportType.SelectedValue;
                if (string.IsNullOrEmpty(reportTypeID))
                {
                    ShowMsg("请选择报表类型。");
                    return;
                }
                wInfo.ReportTypeID = rblReportType.SelectedValue;
                wInfo.InputUserID = this.UserCacheInfo.ID;
                string year = ddlReportYear.SelectedValue;
                string month = ddlReportMonth.SelectedValue;
                string dimTimeID = new DimTime().GetIDByMonth(year, month);
                wInfo.DimTimeID = dimTimeID;
                wInfo.ShipID = ddlShip.SelectedValue;
                wInfo.CurrencyID = ddlCurrency.SelectedValue;
                wInfo.ExchangeRateID = this.RateID;

                wInfo.办公用品 = tb办公用品.Text;
                wInfo.生产用品 = tb生产用品.Text;
                wInfo.生活用品 = tb生活用品.Text;
                wInfo.缆绳 = tb缆绳.Text;
                wInfo.其他 = tb其他.Text;
                wInfo.锁具 = tb锁具.Text;
                wInfo.药品 = tb药品.Text;
                wInfo.油漆 = tb油漆.Text;
                if (string.IsNullOrEmpty(id) == true)
                {
                    this.ReportID = new WuliaoInput().Add(wInfo);
                }
                else
                {
                    new WuliaoInput().Update(wInfo);
                }
                tb总数.Text = wInfo.总数;
                ShowMsg("物料报表保存成功。");
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
Exemple #4
0
 /// <summary>
 /// 添加费用类别
 /// </summary>
 /// <param name="cInfo">实体</param>
 /// <returns>新增实体的主键</returns>
 public string Add(WuliaoInputInfo cInfo)
 {
     return dal.Add(cInfo);
 }
        /// <summary>
        /// 根据页面实体设置页面值
        /// </summary>
        /// <param name="wInfo"></param>
        private void SetPageValue(WuliaoInputInfo wInfo, string selectValue)
        {
            DimTimeInfo dInfo = new DimTime().GetDimTimeInfo(wInfo.DimTimeID);
            ddlReportMonth.SelectedValue = dInfo.MonthNumOfYear.ToString();
            ddlReportYear.SelectedValue = dInfo.Year.ToString();
            tbUserName.Text = this.UserCacheInfo.Name;
            tbCreateTime.Text = wInfo.CreateTime.ToShortDateString();

            rblReportType.SelectedValue = selectValue;
            rblUsage.SelectedValue = wInfo.UsageType;
            ddlShip.SelectedValue = wInfo.ShipID;
            ddlCurrency.SelectedValue = wInfo.CurrencyID;
            ddlYear.SelectedValue = dInfo.Year.ToString();
            ddlMonth.SelectedValue = dInfo.MonthNumOfYear.ToString();

            tb总数.Text = wInfo.总数;
            tb办公用品.Text = wInfo.办公用品;
            tb生产用品.Text = wInfo.生产用品;
            tb生活用品.Text = wInfo.生活用品;
            tb缆绳.Text = wInfo.缆绳;
            tb其他.Text = wInfo.其他;
            tb锁具.Text = wInfo.锁具;
            tb药品.Text = wInfo.药品;
            tb油漆.Text = wInfo.油漆;
        }