private void grid_DoubleClick(object sender, EventArgs e) { try { DataGridView datagrid = this.dataGridView1; Int64 index; if (datagrid.RowCount > 0) { BizRegisterRFID = new BIZ.RegisterRFID(); index = datagrid.CurrentRow.Index; EclockEntryID = Convert.ToInt64(datagrid.Rows[Convert.ToInt32(index)].Cells[0].Value); if (EclockEntryID > 0) { if ((string)datagrid.CurrentCell.Value.ToString().ToUpper() == "EDIT") { BandID = (Int64)datagrid.Rows[Convert.ToInt32(index)].Cells[1].Value; MemberRFIDRegisterID = (Int64)datagrid.Rows[Convert.ToInt32(index)].Cells[2].Value; txtBandNumber.Text = datagrid.Rows[Convert.ToInt32(index)].Cells[3].Value.ToString(); txtRFID.Text = datagrid.Rows[Convert.ToInt32(index)].Cells[4].Value.ToString(); Isverified = true; } else if ((string)datagrid.CurrentCell.Value.ToString().ToUpper() == "DELETE") { Delete(); } } } } catch (Exception ex) { MessageBox.Show(BIZ.Common.CustomError(ex.Message), "Error"); } }
private void btnGo_Click(object sender, EventArgs e) { try { BizRegisterRFID = new BIZ.RegisterRFID(); DataSet dsMemberDetails = new DataSet(); BizRegisterRFID.ClubID = Parent.ClubID; BizRegisterRFID.MemberIDNo = txtMemberIDNo.Text; dsMemberDetails = BizRegisterRFID.GetMemberDetails(); if (dsMemberDetails.Tables.Count > 0) { if (dsMemberDetails.Tables[0].Rows.Count > 0) { DataRow dr = dsMemberDetails.Tables[0].Rows[0]; txtName.Text = dr["MemberName"].ToString(); txtLoftName.Text = dr["LoftName"].ToString(); txtCoordinates.Text = dr["Coordinates"].ToString(); txtMemberID.Text = dr["MemberID"].ToString(); PopulateDataGrid(); } } } catch (Exception ex) { MessageBox.Show(BIZ.Common.CustomError(ex.Message), "Error"); } }
private BIZ.RegisterRFID PopulateBizLayer(BIZ.RegisterRFID bizData) { try { bizData.MemberID = 0; if (txtMemberID.Text != "") { bizData.MemberID = Convert.ToInt64(txtMemberID.Text); } bizData.MemberIDNo = txtMemberIDNo.Text; bizData.BandNumber = txtBandNumber.Text; bizData.ClubID = Parent.ClubID; bizData.RFID = txtRFID.Text; bizData.Season = cmbRaceSeason.Text; BizRegisterRFID.BandID = BandID; BizRegisterRFID.MemberRFIDRegistrationID = MemberRFIDRegisterID; bizData.Type = "Season Ring"; //Default bizData.Picture = Picture; bizData.BirdCategory = this.cmbBirdCategory.Text; if (rdbTestRing.Checked == true) { bizData.Type = "Test Ring"; } return(bizData); } catch (Exception ex) { throw ex; } }
private void FillFormEmtryControl() { try { BizRegisterRFID = new BIZ.RegisterRFID(); DataSet dsReason = new DataSet(); BizRegisterRFID.ClubID = Parent.ClubID; dsReason = BizRegisterRFID.GetSeason(); cmbRaceSeason.Items.Clear(); if (dsReason.Tables.Count > 0) { if (dsReason.Tables[0].Rows.Count > 0) { foreach (DataRow item in dsReason.Tables[0].Rows) { cmbRaceSeason.Items.Add(item["RaceScheduleName"].ToString()); } } } cmbBirdCategory.Items.Add("Young Bird(s)"); cmbBirdCategory.Items.Add("Old Bird(s)"); cmbBirdCategory.Items.Add("Both"); } catch (Exception ex) { throw ex; } }
private void Delete() { try { if ((MessageBox.Show("Are you sure! You would like to delete this record?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)) { BizRegisterRFID = new BIZ.RegisterRFID(); BizRegisterRFID = PopulateBizLayer(BizRegisterRFID); if (BizRegisterRFID.Delete()) { string ApplicationDirectory = BIZ.Common.GetApplicationDirectory(); string Extension = ""; string infExtesionFile = ApplicationDirectory + "\\DataCollection\\Admin\\Picture\\" + txtRFID.Text + ".inf"; if (File.Exists(infExtesionFile)) { TextReader tr = new StreamReader(infExtesionFile); using (tr) { Extension = tr.ReadLine(); } } this.pbPicturePigeon.Image = null; string fullpath = ApplicationDirectory + "\\DataCollection\\Admin\\Picture\\" + txtRFID.Text + Extension; if (File.Exists(fullpath)) { File.Delete(fullpath); } if (File.Exists(infExtesionFile)) { File.Delete(infExtesionFile); } MessageBox.Show("RFID Record Deleted."); PopulateDataGrid(); Clear(); } } } catch (Exception ex) { throw ex; } }
private BIZ.RegisterRFID PopulateRegisterRFIDBizLayer(BIZ.RegisterRFID bizData) { try { bizData.MemberID = 0; if (txtMemberID.Text != "") { bizData.MemberID = Convert.ToInt64(txtMemberID.Text); } bizData.MemberIDNo = txtMemberIDNo.Text; bizData.ClubID = Parent.ClubID; return(bizData); } catch (Exception ex) { throw ex; } }
private void grid_DoubleClick(object sender, EventArgs e) { try { DataGridView datagrid = this.dataGridView1; Int64 index; if (datagrid.RowCount > 0) { BizRegisterRFID = new BIZ.RegisterRFID(); index = datagrid.CurrentRow.Index; MemberRFIDRegisterID = Convert.ToInt64(datagrid.Rows[Convert.ToInt32(index)].Cells[0].Value); if (MemberRFIDRegisterID > 0) { if ((string)datagrid.CurrentCell.Value.ToString().ToUpper() == "EDIT") { BandID = (Int64)datagrid.Rows[Convert.ToInt32(index)].Cells[1].Value; txtBandNumber.Text = datagrid.Rows[Convert.ToInt32(index)].Cells[4].Value.ToString(); txtRFID.Text = datagrid.Rows[Convert.ToInt32(index)].Cells[3].Value.ToString(); //if (datagrid.Rows[Convert.ToInt32(index)].Cells[2].Value.ToString() != "") LoadPicture(this.pbPicturePigeon,(byte[])datagrid.Rows[Convert.ToInt32(index)].Cells[2].Value); cmbBirdCategory.Text = datagrid.Rows[Convert.ToInt32(index)].Cells[5].Value.ToString(); rdbSeasonRing.Checked = true; GetPicture(datagrid.Rows[Convert.ToInt32(index)].Cells[3].Value.ToString()); if (datagrid.Rows[Convert.ToInt32(index)].Cells[6].Value.ToString() == "Test Ring") { rdbTestRing.Checked = true; } } else if ((string)datagrid.CurrentCell.Value.ToString().ToUpper() == "DELETE") { txtRFID.Text = datagrid.Rows[Convert.ToInt32(index)].Cells[3].Value.ToString(); Delete(); } } } } catch (Exception ex) { MessageBox.Show(BIZ.Common.CustomError(ex.Message), "Error"); } }
private void PopulateDataGrid() { try { if (txtMemberID.Text != "" && cmbRaceSeason.Text != "") { DataTable dt = new DataTable(); BizRegisterRFID = new BIZ.RegisterRFID(); BizRegisterRFID = PopulateBizLayer(BizRegisterRFID); dt = BizRegisterRFID.GetMemberRFIDRegisterGetByID().Tables[0]; this.dataGridView1.DataSource = dt; this.lblTotal.Text = "Total : " + dt.Rows.Count.ToString(); this.dataGridView1.Columns[0].Visible = false; this.dataGridView1.Columns[1].Visible = false; this.dataGridView1.Columns[2].Visible = false; this.dataGridView1.Columns[3].Visible = false; } } catch (Exception ex) { throw ex; } }
private void btnSave_Click(object sender, EventArgs e) { try { BizRegisterRFID = new BIZ.RegisterRFID(); BizRegisterRFID = PopulateBizLayer(BizRegisterRFID); if (BizRegisterRFID.Save()) { SavePicture(txtRFID.Text, this.Picture); MessageBox.Show("RFID registration complete."); Clear(); PopulateDataGrid(); } else { MessageBox.Show("RFID registration failed."); } } catch (Exception ex) { MessageBox.Show(BIZ.Common.CustomError(ex.Message), "Error"); } }