Ejemplo n.º 1
0
 /// <summary>
 /// 创建消费记录
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Press(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(RBCC))     //判断成本中心是否已经选择
         {
             throw new Exception("请选择成本中心!");
         }
         else
         {
             RBInputDto RB = new RBInputDto(); //定义一个新的报销单
             RB.CC_ID   = RBCC;                //成本中心编号
             RB.RB_Note = this.TxtNote.Text;   //报销单备注
             //将选中的消费记录行项添加到报销单中
             foreach (ListViewRow Row in listRBRowData.Rows)
             {
                 frmRBCreateLayout layout = Row.Control as frmRBCreateLayout;
                 //如果当前行项消费记录被选中
                 if (layout.checkNum() == 1)
                 {
                     //把选中行的消费记录行项的数据添加到报销单中
                     int             RID      = layout.getID();
                     RB_RowsDto      RBRow    = AutofacConfig.rBService.GetRowByRowID(RID);
                     RB_RowsInputDto NewRBRow = new RB_RowsInputDto();
                     NewRBRow.R_ID          = RBRow.R_ID;          //消费记录编号
                     NewRBRow.R_TypeID      = RBRow.R_TypeID;      //消费类型编号
                     NewRBRow.R_Amount      = RBRow.R_Amount;      //消费记录金额
                     NewRBRow.R_Note        = RBRow.R_Note;        //消费记录日期
                     NewRBRow.R_ConsumeDate = RBRow.R_ConsumeDate; //消费日期
                     RB.RB_Rows.Add(NewRBRow);
                 }
             }
             RB.RB_CreateUser = Client.Session["U_ID"].ToString();               //创建用户
             ReturnInfo r = AutofacConfig.rBService.CreateRB(RB);
             if (r.IsSuccess == true)
             {
                 //如果数据库添加报销记录成功
                 this.ShowResult = ShowResult.Yes;
                 this.Close();
                 Toast("报销提交成功!");
             }
             else
             {
                 throw new Exception(r.ErrorInfo);
             }
         }
     }
     catch (Exception ex)
     {
         Toast(ex.Message);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新全选状态
        /// </summary>
        public void upCheckState()
        {
            int selectUserQty = 0;      //设置当前选中行项为0

            foreach (ListViewRow Row in listRBRowData.Rows)
            {
                frmRBCreateLayout layout = Row.Control  as frmRBCreateLayout;
                int num = layout.checkNum();
                selectUserQty += num;
            }
            if (selectUserQty == listRBRowData.Rows.Count)                //当选中所有行项时
            {
                Checkall.Checked = true;
            }
            else                               //当没有选中所有行项时
            {
                Checkall.Checked = false;
            }
        }