private void myGrid1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     // MessageBox.Show(e.RowIndex.ToString() + "," + e.ColumnIndex.ToString());
     if (e.ColumnIndex == 2)
     {
         DAL.ProductManual pm = new DAL.ProductManual();
         pm.ProductId = Convert.ToInt32(myGrid1.Rows[e.RowIndex].Cells["colproductid"].Value);
         if (pm.SelectById())
         {
             FolderBrowserDialog fbd = new FolderBrowserDialog();
             fbd.ShowDialog();
             if (fbd.SelectedPath == null || fbd.SelectedPath == "")
             {
                 return;
             }
             MyControls.FileImage.FileFromByte(pm.Manual, fbd.SelectedPath + "/" + pm.FileName);
             MessageBox.Show("Downloaded");
         }
     }
 }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ep.Clear();
            int er = 0;

            if (cmbProduct.SelectedValue == null || cmbProduct.SelectedValue.ToString() == " ")

            {
                er++;
                ep.SetError(cmbProduct, "Select One");
            }
            if (txtManual.Text == "")
            {
                er++;
                ep.SetError(txtManual, "Required");
            }
            if (er > 0)
            {
                return;
            }

            DAL.ProductManual pm = new DAL.ProductManual();
            pm.ProductId = Convert.ToInt32(cmbProduct.SelectedValue);
            pm.Manual    = MyControls.FileImage.FileToByte(txtManual.Text);
            pm.FileName  = System.IO.Path.GetFileName(txtManual.Text);
            if (pm.Insert())
            {
                MessageBox.Show("Data Saved");
                MyControls.Helper.clear(this);
                cmbProduct.Focus();
            }
            else
            {
                MessageBox.Show(pm.Error);
            }
        }
 private void btnSearch_Click(object sender, EventArgs e)
 {
     DAL.ProductManual pm = new DAL.ProductManual();
     myGrid1.DataSource = pm.Select().Tables[0];
 }