private void grid_DoubleClick(object sender, EventArgs e) { try { DataGridView datagrid = this.dataGridView1; DataSet dtResult = new DataSet(); Int64 index; if (datagrid.RowCount > 0) { BIZ.PigeonDetails pigenDetails = new BIZ.PigeonDetails(); index = datagrid.CurrentRow.Index; if ((string)datagrid.CurrentCell.Value.ToString() == "VIEW DETAILS") { PigeonID = Convert.ToInt64(datagrid.Rows[Convert.ToInt32(index)].Cells[0].Value); if (PigeonID > 0) { PigeonProgram.PigeonDetails frmPigeonDetails = new PigeonDetails(); frmPigeonDetails.PigeonID = PigeonID; frmPigeonDetails.UserID = UserID; frmPigeonDetails.ShowDialog(); } } } } catch (Exception ex) { MessageBox.Show(Common.Common.CustomError(ex.Message), "Error"); } }
private void Save() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.PigeonID = PigeonID; pigeonDetails.TreatmentID = TreatmentID; pigeonDetails.Treatment = txtTreatment.Text; pigeonDetails.TreatmentDate = dtpTreatMentDate.Value; pigeonDetails.Illness = txtIllness.Text; pigeonDetails.Remarks = txtRemarks.Text; pigeonDetails.TreatmentSave(); //load list LoadTreatmentList(); //clear ClearControl(); MessageBox.Show("Treatment successfully save.", "Save"); } catch (Exception ex) { throw ex; } }
private void GetPedigreeSetup() { try { DataSet PedigreeSetup = new DataSet(); BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.UserID = UserID; PedigreeSetup = pigeonDetails.GetPedigreeSetup(); if (PedigreeSetup.Tables.Count > 0) { if (PedigreeSetup.Tables[0].Rows.Count > 0) { LoadPicture(pbLogo, (byte[])PedigreeSetup.Tables[0].Rows[0]["Logo"]); txtLoftName.Text = PedigreeSetup.Tables[0].Rows[0]["LoftName"].ToString(); txtName.Text = PedigreeSetup.Tables[0].Rows[0]["Name"].ToString(); txtAddress.Text = PedigreeSetup.Tables[0].Rows[0]["Address"].ToString(); txtContactNumber.Text = PedigreeSetup.Tables[0].Rows[0]["ContactNumber"].ToString(); txtresolution.Text = PedigreeSetup.Tables[0].Rows[0]["resolution"].ToString(); txtResolutionY.Text = PedigreeSetup.Tables[0].Rows[0]["resolutionY"].ToString(); } } } catch (Exception ex) { throw ex; } }
private void GetDetailsByKey() { try { DataSet dtResult = new DataSet(); BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.RaceResultID = RaceResultID; dtResult = pigeonDetails.RaceResultGetByKey(); if (dtResult.Tables.Count > 0) { if (dtResult.Tables[0].Rows.Count > 0) { txtDistance.Text = dtResult.Tables[0].Rows[0]["Distance"].ToString(); txtBirdClock.Text = dtResult.Tables[0].Rows[0]["BirdClock"].ToString(); txtBirdEntry.Text = dtResult.Tables[0].Rows[0]["BirdEntry"].ToString(); txtFlight.Text = dtResult.Tables[0].Rows[0]["Flight"].ToString(); dtpRaceDate.Value = (DateTime)dtResult.Tables[0].Rows[0]["ReleaseDate"]; txtRank.Text = dtResult.Tables[0].Rows[0]["Rank"].ToString(); txtReleasePoint.Text = dtResult.Tables[0].Rows[0]["ReleasePoint"].ToString(); txtRemarks.Text = dtResult.Tables[0].Rows[0]["Remarks"].ToString(); txtSpeed.Text = dtResult.Tables[0].Rows[0]["Speed"].ToString(); txtWeatherCondition.Text = dtResult.Tables[0].Rows[0]["WeatherCondition"].ToString(); } } } catch (Exception ex) { throw ex; } }
private void GetDetailsByKey() { try { DataSet dtResult = new DataSet(); BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.TreatmentID = TreatmentID; dtResult = pigeonDetails.TreatmentGetByKey(); if (dtResult.Tables.Count > 0) { if (dtResult.Tables[0].Rows.Count > 0) { txtTreatment.Text = dtResult.Tables[0].Rows[0]["Treatment"].ToString(); this.dtpTreatMentDate.Value = (DateTime)dtResult.Tables[0].Rows[0]["TreatmentDate"]; txtIllness.Text = dtResult.Tables[0].Rows[0]["Illness"].ToString(); txtRemarks.Text = dtResult.Tables[0].Rows[0]["Remarks"].ToString(); } } } catch (Exception ex) { throw ex; } }
private void Save() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.PigeonID = PigeonID; pigeonDetails.ReleasePoint = txtReleasePoint.Text; pigeonDetails.ReleaseDate = dtpRaceDate.Value; pigeonDetails.WeatherCondition = txtWeatherCondition.Text; pigeonDetails.BirdEntry = txtBirdEntry.Text; pigeonDetails.BirdClock = txtBirdClock.Text; pigeonDetails.Rank = txtRank.Text; pigeonDetails.Distance = txtDistance.Text; pigeonDetails.Flight = txtFlight.Text; pigeonDetails.Speed = txtSpeed.Text; pigeonDetails.Remarks = txtRemarks.Text; pigeonDetails.RaceResultSave(); //load list LoadRaceResultList(); //clear control ClearControl(); MessageBox.Show("Race Result Save", "Record Save"); } catch (Exception ex) { throw ex; } }
private void Save() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.PigeonID = PigeonID; pigeonDetails.PigeonName = txtPigeonName.Text.ToUpper(); pigeonDetails.BandNumber = txtBandNumber.Text.ToUpper(); pigeonDetails.Gender = cmbGender.Text.ToUpper(); pigeonDetails.TypeofBreeding = cmbTypeofBreeding.Text.ToUpper(); pigeonDetails.PigeonType = cmbPigeonType.Text.ToUpper(); pigeonDetails.EyeColor = txtEyeColor.Text.ToUpper(); pigeonDetails.Color = txtColor.Text.ToUpper(); pigeonDetails.Line = txtLine.Text.ToUpper(); pigeonDetails.Owner = txtOwner.Text.ToUpper(); pigeonDetails.Achievement = txtAchievement.Text.ToUpper(); pigeonDetails.Picture = Common.Common.GetImage(this.pbPigenPicture); //GetImage(); pigeonDetails.UserID = UserID; pigeonDetails.IsUnknown = checkBox1.Checked; pigeonDetails.HatchDate = dtDateHactchAcquired.Value; pigeonDetails.Year = cmbYear.Text.ToUpper(); pigeonDetails.Season = cmbSeason.Text.ToUpper(); pigeonDetails.Category = cmbRaceCategory.Text.ToUpper(); pigeonDetails.ParentCock = cmbParentCock.Text.ToUpper(); pigeonDetails.ParentHen = cmbParentHen.Text.ToUpper(); pigeonDetails.RFIDTag = txtrfid.Text; Color color = this.txtBackgroundColor.BackColor; pigeonDetails.BackColor = color.A.ToString() + ' ' + color.R + ' ' + color.G + ' ' + color.B;; pigeonDetails.PigeonDetailsSave(); if (IsAddParent) { AddBird = txtPigeonName.Text + "|" + txtBandNumber.Text; this.Close(); } //set list of Pigeon. LoadPigeonList(); //Clear Control ClearControl(); //Get All Hen GetAllHenPigeon(); //Get All C**k GetAllCockPigeon(); MessageBox.Show("Record has been save", "Save Record"); } catch (Exception ex) { throw ex; } }
private void grid_DoubleClick(object sender, EventArgs e) { try { ClearControl(); DataGridView datagrid = this.dtPigeonList; DataSet dtResult = new DataSet(); Int64 index; if (datagrid.RowCount > 0) { BIZ.PigeonDetails pigenDetails = new BIZ.PigeonDetails(); index = datagrid.CurrentRow.Index; if ((string)datagrid.CurrentCell.Value.ToString() == "EDIT") { PigeonID = Convert.ToInt64(datagrid.Rows[Convert.ToInt32(index)].Cells[0].Value); if (PigeonID > 0) { GetPigeonDetails(); } } if ((string)datagrid.CurrentCell.Value.ToString() == "PEDS") { PigeonID = Convert.ToInt64(datagrid.Rows[Convert.ToInt32(index)].Cells[0].Value); if (PigeonID > 0) { ShowPeds(); } } else if ((string)datagrid.CurrentCell.Value.ToString() == "DELETE") { PigeonID = Convert.ToInt64(datagrid.Rows[Convert.ToInt32(index)].Cells[0].Value); if (PigeonID > 0) { DialogResult dialogResult = new DialogResult(); dialogResult = MessageBox.Show("Are you sure you want to delete this Pigeon?", "Error", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { DeletePigeonDetails(PigeonID); LoadPigeonList(); ClearControl(); MessageBox.Show("Record has been deleted", "Delete Record"); } } } } } catch (Exception ex) { MessageBox.Show(Common.Common.CustomError(ex.Message), "Error"); } }
private void DeletePigeonDetails(Int64 PigeonID) { try { BIZ.PigeonDetails pigenDetails = new BIZ.PigeonDetails(); pigenDetails.PigeonID = PigeonID; pigenDetails.DeletePigeonDetails(); } catch (Exception ex) { throw ex; } }
private void Delete() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.RaceResultID = RaceResultID; pigeonDetails.RaceResultDelete(); } catch (Exception ex) { throw ex; } }
private void Delete() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.TreatmentID = TreatmentID; pigeonDetails.TreatmentDelete(); //MessageBox.Show("Treatment Successfully Deleted", "Delete Record"); } catch (Exception ex) { throw ex; } }
private void LoadTreatmentList() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.PigeonID = PigeonID; dtTreatmentList.DataSource = pigeonDetails.TreatmentGetAll().Tables[0]; dtTreatmentList.Columns[0].Visible = false; DataGridViewCellStyle style = new DataGridViewCellStyle(); style.Font = new Font(Font, FontStyle.Bold); } catch (Exception ex) { throw ex; } }
private void LoadRaceResultList() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.PigeonID = PigeonID; dtRaceResult.DataSource = pigeonDetails.RaceResultGetAll().Tables[0]; dtRaceResult.Columns[0].Visible = false; DataGridViewCellStyle style = new DataGridViewCellStyle(); style.Font = new Font(Font, FontStyle.Bold); //dtRaceResult.Columns[7].DefaultCellStyle = style; //dtRaceResult.Columns[8].DefaultCellStyle = style; } catch (Exception ex) { throw ex; } }
private void GetAllCockPigeon() { try { DataSet dtResult = new DataSet(); BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.Gender = "C**k"; pigeonDetails.UserID = UserID; dtResult = pigeonDetails.GetPigeonByGender(); this.cmbParentCock.Items.Clear(); this.cmbParentCock.Items.Add(""); foreach (DataRow item in dtResult.Tables[0].Rows) { this.cmbParentCock.Items.Add(item["PigeonName"].ToString().ToUpper()); } } catch (Exception ex) { throw ex; } }
private void GetPigeonOffspringList() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.PigeonID = PigeonID; DataSet ds = new DataSet(); ds = pigeonDetails.GetPigeonOffspring(); if (ds.Tables.Count > 0) { dataGridView1.DataSource = ds.Tables[0]; dataGridView1.Columns[0].Visible = false; DataGridViewCellStyle style = new DataGridViewCellStyle(); style.Font = new Font(Font, FontStyle.Bold); } } catch (Exception ex) { throw ex; } }
private void LoadPigeonList() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.UserID = UserID; pigeonDetails.FilterBreed = txtFilterLine.Text; pigeonDetails.FilterGender = cmbFilterGender.Text; pigeonDetails.FilterPigeonName = txtFilterPigeonName.Text; pigeonDetails.FilterYear = cmbFilterYear.Text; dtPigeonList.DataSource = ((DataSet)pigeonDetails.GetPigeonList()).Tables[0]; dtPigeonList.Columns[0].Visible = false; //for (int i = 0; i < dtPigeonList.Columns.Count; i++) //{ // this.dtPigeonList.Columns[i].Frozen = false; //} } catch (Exception ex) { throw ex; } }
private void LoadPedigree() { try { DataSet dtresult = new DataSet(); BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); pigeonDetails.PigeonID = PigeonID; dtresult = pigeonDetails.PigeonPedigree(); if (dtresult.Tables.Count > 0) { if (dtresult.Tables[0].Rows.Count > 0) { LoadPicture(pictureBox1, (byte[])dtresult.Tables[0].Rows[0]["Picture"]); txtRoot.Text = dtresult.Tables[0].Rows[0]["Root"].ToString(); string color = dtresult.Tables[0].Rows[0]["BackColor"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtRoot); } txtFirstLevelCock.Text = dtresult.Tables[0].Rows[0]["FirstLevelCock"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorFirstLevelCock"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtFirstLevelCock); } txtFirstLevelHen.Text = dtresult.Tables[0].Rows[0]["FirstLevelHen"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorFirstLevelHen"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtFirstLevelHen); } txtSecondLevelCock1.Text = dtresult.Tables[0].Rows[0]["SecondLevelCock1"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorSecondLevelCock1"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtSecondLevelCock1); } txtSecondLevelHen1.Text = dtresult.Tables[0].Rows[0]["SecondLevelHen1"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorSecondLevelHen1"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtSecondLevelHen1); } txtSecondLevelCock2.Text = dtresult.Tables[0].Rows[0]["SecondLevelCock2"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorSecondLevelCock2"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtSecondLevelCock2); } txtSecondLevelHen2.Text = dtresult.Tables[0].Rows[0]["SecondLevelHen2"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorSecondLevelHen2"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtSecondLevelHen2); } txtThirdLevelCock1.Text = dtresult.Tables[0].Rows[0]["ThirdLevelCock1"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorThirdLevelCock1"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtThirdLevelCock1); } txtThirdLevelCock2.Text = dtresult.Tables[0].Rows[0]["ThirdLevelCock2"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorThirdLevelCock2"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtThirdLevelCock2); } txtThirdLevelCock3.Text = dtresult.Tables[0].Rows[0]["ThirdLevelCock3"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorThirdLevelCock3"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtThirdLevelCock3); } txtThirdLevelCock4.Text = dtresult.Tables[0].Rows[0]["ThirdLevelCock4"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorThirdLevelCock4"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtThirdLevelCock4); } txtThirdLevelHen1.Text = dtresult.Tables[0].Rows[0]["ThirdLevelHen1"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorThirdLevelHen1"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtThirdLevelHen1); } txtThirdLevelHen2.Text = dtresult.Tables[0].Rows[0]["ThirdLevelHen2"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorThirdLevelHen2"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtThirdLevelHen2); } txtThirdLevelHen3.Text = dtresult.Tables[0].Rows[0]["ThirdLevelHen3"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorThirdLevelHen3"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtThirdLevelHen3); } txtThirdLevelHen4.Text = dtresult.Tables[0].Rows[0]["ThirdLevelHen4"].ToString(); color = dtresult.Tables[0].Rows[0]["ColorThirdLevelHen4"].ToString(); if (!string.IsNullOrEmpty(color)) { Common.Common.SetBackColor(color, txtThirdLevelHen4); } } } } catch (Exception ex) { throw ex; } }
private void GetPigeonDetails() { try { BIZ.PigeonDetails pigeonDetails = new BIZ.PigeonDetails(); DataSet dtResult = new DataSet(); pigeonDetails.PigeonID = PigeonID; pigeonDetails.BandNumber = BandNumber; pigeonDetails.RFIDTag = txtrfid.Text; dtResult = pigeonDetails.GetPigeonDetails(); if (dtResult.Tables.Count > 0) { if (dtResult.Tables[0].Rows.Count > 0) { ClearControl(); PigeonID = (Int64)dtResult.Tables[0].Rows[0]["PigeonDetailsID"]; PigeonName = dtResult.Tables[0].Rows[0]["PigeonName"].ToString().ToUpper(); txtPigeonName.Text = dtResult.Tables[0].Rows[0]["PigeonName"].ToString().ToUpper(); txtBandNumber.Text = dtResult.Tables[0].Rows[0]["BandNumber"].ToString().ToUpper(); txtColor.Text = dtResult.Tables[0].Rows[0]["Color"].ToString().ToUpper(); txtEyeColor.Text = dtResult.Tables[0].Rows[0]["EyeColor"].ToString().ToUpper(); cmbGender.SelectedItem = dtResult.Tables[0].Rows[0]["Gender"].ToString().ToUpper(); checkBox1.Checked = Convert.ToBoolean(dtResult.Tables[0].Rows[0]["IsUnknownDate"]); dtDateHactchAcquired.Value = (DateTime)dtResult.Tables[0].Rows[0]["HatchDateOrAcquiredDate"]; txtOwner.Text = dtResult.Tables[0].Rows[0]["Owner"].ToString().ToUpper(); txtLine.Text = dtResult.Tables[0].Rows[0]["Breed"].ToString().ToUpper(); txtrfid.Text = dtResult.Tables[0].Rows[0]["rfidtag"].ToString().ToUpper(); string color = dtResult.Tables[0].Rows[0]["BackColor"].ToString(); if (!string.IsNullOrEmpty(color)) { string[] rgb = dtResult.Tables[0].Rows[0]["BackColor"].ToString().Split(' '); txtBackgroundColor.BackColor = System.Drawing.Color.FromArgb(int.Parse(rgb[0]), int.Parse(rgb[1]), int.Parse(rgb[2]), int.Parse(rgb[3])); } if (dtResult.Tables[0].Rows[0]["ParentCock"].ToString() != "") { cmbParentCock.SelectedItem = dtResult.Tables[0].Rows[0]["ParentCock"].ToString().ToUpper(); } else { cmbParentCock.SelectedItem = null; } if (dtResult.Tables[0].Rows[0]["ParentHen"].ToString() != "") { cmbParentHen.SelectedItem = dtResult.Tables[0].Rows[0]["ParentHen"].ToString().ToUpper(); } else { cmbParentHen.SelectedItem = null; } cmbYear.Text = dtResult.Tables[0].Rows[0]["RaceYear"].ToString().ToUpper(); cmbSeason.SelectedItem = dtResult.Tables[0].Rows[0]["RaceSeason"].ToString().ToUpper(); cmbRaceCategory.SelectedItem = dtResult.Tables[0].Rows[0]["RaceCategory"].ToString().ToUpper(); cmbTypeofBreeding.SelectedItem = dtResult.Tables[0].Rows[0]["TypeOfBreeding"].ToString().ToUpper(); cmbPigeonType.SelectedItem = dtResult.Tables[0].Rows[0]["PigeonType"].ToString().ToUpper(); txtAchievement.Text = dtResult.Tables[0].Rows[0]["Remarks"].ToString().ToUpper(); LoadPicture(pbPigenPicture, (byte[])dtResult.Tables[0].Rows[0]["Photo"]); } } } catch (Exception ex) { throw ex; } }