コード例 #1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            _body      = new FishEntity.AccountsreceivableBody( );
            _body.yfId = dataGridView1.Rows [e.RowIndex].Cells ["yfId"].Value.ToString( );

            isOk = _bll.head_two(_body.yfId, FishEntity.Variable.User.username);

            List <FishEntity.AccountsreceivableBody> modelList = _bll.getLists(_body.yfId);

            setValueBody(modelList);
        }
コード例 #2
0
        public override void Save( )
        {
            if (dataGridView2.Rows.Count > 0)
            {
                dataGridView2.EndEdit( );

                List <FishEntity.AccountsreceivableBody> modelList = new List <FishEntity.AccountsreceivableBody> ( );

                for (int i = 0; i < dataGridView2.Rows.Count; i++)
                {
                    _body               = new FishEntity.AccountsreceivableBody( );
                    _body.yfId          = dataGridView2.Rows [i].Cells ["yfId_one"].Value.ToString( );
                    _body.code          = dataGridView2.Rows [i].Cells ["code"].Value.ToString( );
                    _body.settlementNum = string.IsNullOrEmpty(dataGridView2.Rows [i].Cells ["settlementNum"].Value.ToString( )) == true ? 0 : Convert.ToDecimal(dataGridView2.Rows [i].Cells ["settlementNum"].Value.ToString( ));
                    modelList.Add(_body);
                }

                if (modelList.Count > 0)
                {
                    isOk = _bll.Add(modelList, FishEntity.Variable.User.username);
                    if (isOk == true)
                    {
                        MessageBox.Show("保存成功");
                        if (state.Equals("query"))
                        {
                            Query( );
                        }
                        else
                        {
                            btnQuery_Click(null, null);
                        }
                    }
                    else
                    {
                        MessageBox.Show("保存失败");
                    }
                }
            }

            base.Save( );
        }