Ejemplo n.º 1
0
        public void infolistCell(object sender, EventArgs e)
        {
            CommodityInfoforSearch commodityInfoforSearch = sender as CommodityInfoforSearch;

            frsm.addOnecommodity(commodityInfoforSearch.barcode, "", "", "", "");
            frsm.Show();
            Close();
        }
Ejemplo n.º 2
0
 private void infolist_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 5)
     {
         if (Program.SystemMode == 1)
         {
             frs.addCropAndPest(count, infolist.CurrentRow.Cells[3].Value.ToString(), infolist.CurrentRow.Cells[4].Value.ToString());
             frs.Hide();
             frs.setfocus();
             frs.Show();
             Hide();
         }
         else
         {
             frsm.addCropAndPest(count, infolist.CurrentRow.Cells[3].Value.ToString(), infolist.CurrentRow.Cells[4].Value.ToString());
             frsm.Hide();
             frsm.setfocus();
             frsm.Show();
             Hide();
         }
     }
 }
Ejemplo n.º 3
0
        private void clslit4_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            bool   flag  = false;
            string text  = DateTime.Now.ToString("yyyyMMdd");
            string text2 = clslit4.CurrentRow.Cells["cropGuideId"].Value.ToString();
            string text3 = clslit4.CurrentRow.Cells["pestGuideId"].Value.ToString();
            string text4 = clslit4.CurrentRow.Cells["pesticideId"].Value.ToString();
            string text5 = clslit4.CurrentRow.Cells["formcode1"].Value.ToString();
            string text6 = clslit4.CurrentRow.Cells["content"].Value.ToString();

            string[] strWhereParameterArray = new string[6]
            {
                text2,
                text3,
                text4,
                text5,
                text6,
                text
            };
            if (((DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "hs.*", "HyScope as hs", "hs.cropId={0} and hs.pestId={1} and hs.pesticideId={2} and hs.formCode={3} and hs.contents={4}  and hs.regStoreName =''  and hs.isDelete in ('N','') ", "", null, strWhereParameterArray, CommandOperationType.ExecuteReaderReturnDataTable)).Rows.Count > 0)
            {
                string[] strWhereParameterArray2 = new string[1]
                {
                    fpg.realcropcode
                };
                DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "name", "HyCrop", "code={0}", "", null, strWhereParameterArray2, CommandOperationType.ExecuteReaderReturnDataTable);
                string[]  strWhereParameterArray3 = new string[1]
                {
                    fpg.pestcode
                };
                DataTable dataTable2 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "name", "HyBlight", "code={0}", "", null, strWhereParameterArray3, CommandOperationType.ExecuteReaderReturnDataTable);
                if (Program.SystemMode == 1)
                {
                    frs.addOnecommodity(clslit4.CurrentRow.Cells[1].Value.ToString(), fpg.realcropcode, fpg.pestcode, dataTable.Rows[0]["name"].ToString(), dataTable2.Rows[0]["name"].ToString());
                    frs.setfocus();
                    frs.Show();
                }
                else
                {
                    frsm.addOnecommodity(clslit4.CurrentRow.Cells[1].Value.ToString(), fpg.realcropcode, fpg.pestcode, dataTable.Rows[0]["name"].ToString(), dataTable2.Rows[0]["name"].ToString());
                    frsm.setfocus();
                    frsm.Show();
                }
                Hide();
                return;
            }
            string[] strWhereParameterArray4 = new string[6]
            {
                text2,
                text3,
                text4,
                text5,
                text6,
                text
            };
            DataTable dataTable3 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "hs.*", "HyScope as hs", "hs.cropId={0} and hs.pestId={1} and hs.pesticideId={2} and hs.formCode={3} and hs.contents={4}  and hs.approveDate != ''  and (hs.approveDate + 19190000) >= CAST ({5} as INTEGER)  and hs.regStoreName !=''  and hs.regStoreName !='99999999'  and hs.isDelete in ('N','') ", "", null, strWhereParameterArray4, CommandOperationType.ExecuteReaderReturnDataTable);

            if (dataTable3.Rows.Count > 0)
            {
                flag = true;
                foreach (DataRow row in dataTable3.Rows)
                {
                    string[] strWhereParameterArray5 = new string[4]
                    {
                        row["pesticideId"].ToString(),
                        row["formCode"].ToString(),
                        row["contents"].ToString(),
                        row["regStoreName"].ToString()
                    };
                    DataTable dataTable4 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "hg.GDSNO", "HyLicence as hl,hypos_GOODSLST as hg", "hl.pesticideId ={0} and hl.formCode={1} and hl.contents={2} and hl.licType = hg.licType and hl.licNo = hg.domManufId and hl.domManufId in (" + row["regStoreName"].ToString() + ") and hl.isDelete='N' and hg.status !='D' ", "", null, strWhereParameterArray5, CommandOperationType.ExecuteReaderReturnDataTable);
                    if (dataTable4.Rows.Count <= 0)
                    {
                        continue;
                    }
                    foreach (DataRow row2 in dataTable4.Rows)
                    {
                        barcodelist.Add(row2["GDSNO"].ToString());
                    }
                }
            }
            if (flag && barcodelist.Count > 0)
            {
                bool flag2 = false;
                foreach (string item in barcodelist)
                {
                    if (item.Equals(clslit4.CurrentRow.Cells[1].Value.ToString()))
                    {
                        flag2 = true;
                    }
                }
                if (flag2)
                {
                    string[] strWhereParameterArray6 = new string[1]
                    {
                        fpg.realcropcode
                    };
                    DataTable dataTable5 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "name", "HyCrop", "code={0}", "", null, strWhereParameterArray6, CommandOperationType.ExecuteReaderReturnDataTable);
                    string[]  strWhereParameterArray7 = new string[1]
                    {
                        fpg.pestcode
                    };
                    DataTable dataTable6 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "name", "HyBlight", "code={0}", "", null, strWhereParameterArray7, CommandOperationType.ExecuteReaderReturnDataTable);
                    if (Program.SystemMode == 1)
                    {
                        frs.addOnecommodity(clslit4.CurrentRow.Cells[1].Value.ToString(), fpg.realcropcode, fpg.pestcode, dataTable5.Rows[0]["name"].ToString(), dataTable6.Rows[0]["name"].ToString());
                        frs.setfocus();
                        frs.Show();
                    }
                    else
                    {
                        frsm.addOnecommodity(clslit4.CurrentRow.Cells[1].Value.ToString(), fpg.realcropcode, fpg.pestcode, dataTable5.Rows[0]["name"].ToString(), dataTable6.Rows[0]["name"].ToString());
                        frsm.setfocus();
                        frsm.Show();
                    }
                    Hide();
                    return;
                }
                List <string> list = new List <string>();
                foreach (string item2 in barcodelist)
                {
                    string[] strWhereParameterArray8 = new string[1]
                    {
                        item2
                    };
                    DataTable dataTable7 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "brandName", "hypos_GOODSLST", "GDSNO={0}", "", null, strWhereParameterArray8, CommandOperationType.ExecuteReaderReturnDataTable);
                    list.Add(dataTable7.Rows[0]["brandName"].ToString());
                }
                list = Enumerable.ToList(Enumerable.Distinct(list));
                string text7 = "";
                foreach (string item3 in list)
                {
                    text7 = text7 + "[" + item3 + "]";
                }
                AutoClosingMessageBox.Show("此用藥配對尚於資料保護期間,僅可選擇" + text7 + "用藥");
            }
            else
            {
                string[] strWhereParameterArray9 = new string[1]
                {
                    fpg.realcropcode
                };
                DataTable dataTable8 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "name", "HyCrop", "code={0}", "", null, strWhereParameterArray9, CommandOperationType.ExecuteReaderReturnDataTable);
                string[]  strWhereParameterArray10 = new string[1]
                {
                    fpg.pestcode
                };
                DataTable dataTable9 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "name", "HyBlight", "code={0}", "", null, strWhereParameterArray10, CommandOperationType.ExecuteReaderReturnDataTable);
                if (Program.SystemMode == 1)
                {
                    frs.addOnecommodity(clslit4.CurrentRow.Cells[1].Value.ToString(), fpg.realcropcode, fpg.pestcode, dataTable8.Rows[0]["name"].ToString(), dataTable9.Rows[0]["name"].ToString());
                    frs.setfocus();
                    frs.Show();
                }
                else
                {
                    frsm.addOnecommodity(clslit4.CurrentRow.Cells[1].Value.ToString(), fpg.realcropcode, fpg.pestcode, dataTable8.Rows[0]["name"].ToString(), dataTable9.Rows[0]["name"].ToString());
                    frsm.setfocus();
                    frsm.Show();
                }
                Hide();
            }
        }
Ejemplo n.º 4
0
 private void infolist_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == 2)
     {
         string[] strWhereParameterArray = new string[5]
         {
             _pesticideId,
             _formCode,
             _content,
             infolist.CurrentRow.Cells["cropId"].Value.ToString(),
             infolist.CurrentRow.Cells["pestId"].Value.ToString()
         };
         if (((DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "HyScope", " pesticideId = {0} AND formCode = {1} AND contents = {2} AND cropId = {3} AND pestId = {4} AND isDelete in ('N','') ", "", null, strWhereParameterArray, CommandOperationType.ExecuteReaderReturnDataTable)).Rows.Count > 0)
         {
             if (Program.SystemMode == 1)
             {
                 frs.addCropAndPest(count, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString());
                 frs.Hide();
                 frs.setfocus();
                 frs.Show();
                 Hide();
             }
             else
             {
                 frsm.addCropAndPest(count, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString());
                 frsm.Hide();
                 frsm.setfocus();
                 frsm.Show();
                 Hide();
             }
         }
         else
         {
             MessageBox.Show(string.Format("此配對已不存在,請選擇其他配對。此配對將自您的常用配對紀錄中移除。", Application.ProductName), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             try
             {
                 string[] strParameterArray = new string[3]
                 {
                     barcodeid,
                     infolist.CurrentRow.Cells["cropId"].Value.ToString(),
                     infolist.CurrentRow.Cells["pestId"].Value.ToString()
                 };
                 string sql = " DELETE FROM hypos_user_pair WHERE barcode = {0} AND cropId = {1} AND pestId = {2} ";
                 DataBaseUtilities.DBOperation(Program.ConnectionString, sql, strParameterArray, CommandOperationType.ExecuteNonQuery);
                 infolist.Rows.RemoveAt(infolist.CurrentRow.Index);
             }
             catch (Exception)
             {
                 throw;
             }
         }
     }
     if (e.ColumnIndex == 3)
     {
         new dialogMedDescription(_pesticideId, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString(), _formCode, _content).ShowDialog();
     }
 }
Ejemplo n.º 5
0
 private void infolist_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == 2)
     {
         string[] strWhereParameterArray = new string[1]
         {
             barcodeNum
         };
         DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "pesticideId,formCode,contents", "hypos_GOODSLST", "GDSNO = {0}", "", null, strWhereParameterArray, CommandOperationType.ExecuteReaderReturnDataTable);
         string[]  strWhereParameterArray2 = new string[5]
         {
             dataTable.Rows[0]["pesticideId"].ToString(),
             dataTable.Rows[0]["formCode"].ToString(),
             dataTable.Rows[0]["contents"].ToString(),
             infolist.CurrentRow.Cells["cropId"].Value.ToString(),
             infolist.CurrentRow.Cells["pestId"].Value.ToString()
         };
         if (((DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "HyScope", " pesticideId = {0} AND formCode = {1} AND contents = {2} AND cropId = {3} AND pestId = {4} AND isDelete in ('N','') ", "", null, strWhereParameterArray2, CommandOperationType.ExecuteReaderReturnDataTable)).Rows.Count > 0)
         {
             if (Program.SystemMode == 1)
             {
                 fms.addOnecommodity(barcodeNum, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString(), infolist.CurrentRow.Cells["commodity"].Value.ToString(), infolist.CurrentRow.Cells["quantity"].Value.ToString());
                 fms.Show();
                 Close();
                 if (fcd != null)
                 {
                     fcd.Close();
                 }
                 if (search != null)
                 {
                     search.Close();
                 }
             }
             else
             {
                 frsm.addOnecommodity(barcodeNum, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString(), infolist.CurrentRow.Cells["commodity"].Value.ToString(), infolist.CurrentRow.Cells["quantity"].Value.ToString());
                 frsm.Show();
                 Close();
                 if (fcd != null)
                 {
                     fcd.Close();
                 }
                 if (search != null)
                 {
                     search.Close();
                 }
             }
         }
         else
         {
             MessageBox.Show(string.Format("此配對已不存在,請選擇其他配對。此配對將自您的常用配對紀錄中移除。", Application.ProductName), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             try
             {
                 string[] strParameterArray = new string[3]
                 {
                     barcodeNum,
                     infolist.CurrentRow.Cells["cropId"].Value.ToString(),
                     infolist.CurrentRow.Cells["pestId"].Value.ToString()
                 };
                 string sql = " DELETE FROM hypos_user_pair WHERE barcode = {0} AND cropId = {1} AND pestId = {2} ";
                 DataBaseUtilities.DBOperation(Program.ConnectionString, sql, strParameterArray, CommandOperationType.ExecuteNonQuery);
                 infolist.Rows.RemoveAt(infolist.CurrentRow.Index);
             }
             catch (Exception)
             {
                 throw;
             }
         }
     }
     if (e.ColumnIndex == 3)
     {
         new dialogMedDescription(barcodeNum, infolist.CurrentRow.Cells["cropId"].Value.ToString(), infolist.CurrentRow.Cells["pestId"].Value.ToString()).ShowDialog();
     }
 }