/// <summary> /// 保存报销编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Press(object sender, EventArgs e) { try { RBInputDto ReimBur = new RBInputDto(); ReimBur.RB_Rows = new List <RB_RowsInputDto>(); ReimBur.RB_ID = this.lblRBNO.Text; //报销单编号 ReimBur.CC_ID = RBCC; //成本中心编号 ReimBur.RB_Note = this.TxtNote.Text; //备注 //消费记录行项更改 foreach (ListViewRow Row in listRBRowData.Rows) { //判断消费记录是否选中 frmConsumption1Layout layout = Row.Control as frmConsumption1Layout; if (layout.checkNum() == 1) { //把选中行的Row的数据添加到报销单中 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; ReimBur.RB_Rows.Add(NewRBRow); } } ReturnInfo r = AutofacConfig.rBService.UpdateRB(ReimBur); //将报销记录更新到数据库中 if (r.IsSuccess == true) { this.ShowResult = ShowResult.Yes; this.Close(); Toast("报销提交成功!"); } else { throw new Exception(r.ErrorInfo); } } catch (Exception ex) { Toast(ex.Message); } }
/// <summary> /// 更新全选状态 /// </summary> public void upCheckState() { int selectUserQty = 0; //设置当前选中行项为0 foreach (ListViewRow Row in listRBRowData.Rows) { frmConsumption1Layout layout = Row.Control as frmConsumption1Layout; int num = layout.checkNum(); selectUserQty += num; } if (selectUserQty == listRBRowData.Rows.Count) //当选中所有行项时 { Checkall.Checked = true; } else //当没有选中所有行项时 { Checkall.Checked = false; } }