コード例 #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        IList<TargetVO> targetList = new List<TargetVO>();

        string ym = string.Format("{0}{1}", ddlSearchYear.SelectedValue, ddlSearchMonth.SelectedValue);

        for (int i = 0; i < gvList.Rows.Count; i++)
        {
            Label lblName = (Label)gvList.Rows[i].FindControl("lblName");
            TextBox txtTarget = (TextBox)gvList.Rows[i].FindControl("txtTarget");

            double amount = 0;

            double.TryParse(txtTarget.Text.Trim(), out amount);

            TargetVO targetVO = new TargetVO();
            targetVO.Id = string.Format("{0}{1}", ym, lblName.Text);
            targetVO.Name = lblName.Text;
            targetVO.Amount = amount;
            targetList.Add(targetVO);
        }

        for (int i = 0; i < gvListStore.Rows.Count; i++)
        {
            Label lblName = (Label)gvListStore.Rows[i].FindControl("lblName");
            TextBox txtTarget = (TextBox)gvListStore.Rows[i].FindControl("txtTarget");

            double amount = 0;

            double.TryParse(txtTarget.Text.Trim(), out amount);

            TargetVO targetVO = new TargetVO();
            targetVO.Id = string.Format("{0}{1}", ym, lblName.Text);
            targetVO.Name = lblName.Text;
            targetVO.Amount = amount;
            targetList.Add(targetVO);
        }

        m_AccountingService.UpdateTargetList(targetList);

        fillGridView();
    }
コード例 #2
0
        /// <summary>
        /// 建立或更新Target
        /// </summary>
        /// <param name="targetVO"></param>
        /// <returns></returns>
        public TargetVO SaveOrUpdateTarget(TargetVO targetVO)
        {
            NHibernateDao.SaveOrUpdate(targetVO);

            return targetVO;
        }
コード例 #3
0
        /// <summary>
        /// 更新業績
        /// </summary>
        /// <param name="targetList"></param>
        public void UpdateTargetList(IList<TargetVO> targetList)
        {
            if (targetList != null && targetList.Count > 0)
            {
                foreach (TargetVO targetVO in targetList)
                {
                    TargetVO t = GetTargetById(targetVO.Id);
                    if (t == null)
                    {
                        t = new TargetVO();
                        t.Id = targetVO.Id;
                    }

                    t.Name = targetVO.Name;
                    t.Amount = targetVO.Amount;

                    SaveOrUpdateTarget(t);
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// 建立或更新Target
 /// </summary>
 /// <param name="targetVO"></param>
 /// <returns></returns>
 public TargetVO SaveOrUpdateTarget(TargetVO targetVO)
 {
     return AccountingDao.SaveOrUpdateTarget(targetVO);
 }
コード例 #5
0
        public void Test_CreateTarget()
        {
            IList<TargetVO> targetList = new List<TargetVO>();

            double targetAmount = 20000;

            IList<LoginUserVO> userList = m_AuthService.GetAllLoginUserList();
            foreach (LoginUserVO user in userList)
            {
                TargetVO targetVO = new TargetVO();
                targetVO.Id = string.Format("{0}{1}", "201601", user.FullNameInChinese);
                targetVO.Name = user.FullNameInChinese;
                targetVO.Amount = targetAmount;
                targetAmount += 5000;
                targetList.Add(targetVO);
            }

            m_AccountingService.UpdateTargetList(targetList);
        }