private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 || e.ColumnIndex >= 0) { try { //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterGridClick, clsUtility.IsAdmin); ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterGridClick); ID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["ProductID"].Value); txtProductName.Text = dataGridView1.SelectedRows[0].Cells["ItemName"].Value.ToString(); cmbCategory.SelectedValue = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["CategoryID"].Value); cmbActiveStatus.SelectedItem = dataGridView1.SelectedRows[0].Cells["ActiveStatus"].Value.ToString(); if (dataGridView1.SelectedRows[0].Cells["Photo"].Value != DBNull.Value) { PicProductMaster.Image = ObjUtil.GetImage((byte[])dataGridView1.SelectedRows[0].Cells["Photo"].Value); } grpProduct.Enabled = false; txtProductName.Focus(); } catch (Exception ex) { clsUtility.ShowErrorMessage(ex.ToString(), clsUtility.strProjectTitle); } } }
private void dgvEmployee_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 || e.ColumnIndex >= 0) { try { ClearAll(); //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterGridClick, clsUtility.IsAdmin); ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterGridClick); EmployeeID = Convert.ToInt32(dgvEmployee.SelectedRows[0].Cells["EmpID"].Value); txtEmployeeCode.Text = dgvEmployee.SelectedRows[0].Cells["EmployeeCode"].Value.ToString(); txtName.Text = dgvEmployee.SelectedRows[0].Cells["Name"].Value.ToString(); cmbShop.SelectedValue = Convert.ToInt32(dgvEmployee.SelectedRows[0].Cells["ShopID"].Value); if (dgvEmployee.SelectedRows[0].Cells["Gender"].Value != DBNull.Value && dgvEmployee.SelectedRows[0].Cells["Gender"].Value.ToString() == "Male") { radMale.Checked = true; //radFemale.Checked = false; } else if (dgvEmployee.SelectedRows[0].Cells["Gender"].Value != DBNull.Value && dgvEmployee.SelectedRows[0].Cells["Gender"].Value.ToString() == "Female") { radFemale.Checked = true; //radMale.Checked = false; } //else //{ // radMale.Checked = false; // radFemale.Checked = false; //} if (dgvEmployee.SelectedRows[0].Cells["DOB"].Value != DBNull.Value) { dtpDOB.Value = Convert.ToDateTime(dgvEmployee.SelectedRows[0].Cells["DOB"].Value); } if (dgvEmployee.SelectedRows[0].Cells["Address"].Value != DBNull.Value) { txtAdd.Text = dgvEmployee.SelectedRows[0].Cells["Address"].Value.ToString(); } if (dgvEmployee.SelectedRows[0].Cells["Photo"].Value != DBNull.Value) { PicEmployee.Image = ObjUtil.GetImage((byte[])dgvEmployee.SelectedRows[0].Cells["Photo"].Value); } grpEmployee.Enabled = false; BindUserDetails(); } catch { } } }
private Image GetProductPhoto(int ProductID) { Image imgProduct = null; DataTable dt = ObjDAL.ExecuteSelectStatement("select Photo from " + clsUtility.DBName + ".dbo.ProductMaster where ProductID=" + ProductID); if (dt != null && dt.Rows.Count >= 0) { if (dt.Rows[0]["Photo"] != DBNull.Value) { byte[] imgData = (byte[])(dt.Rows[0]["Photo"]); imgProduct = ObjUtil.GetImage(imgData); } } return(imgProduct); }