コード例 #1
0
        private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            String _DocNUM = dataGridView1.Rows[e.RowIndex].Cells["DocNum"].Value.ToString();
            String _DocType = dataGridView1.Rows[e.RowIndex].Cells["DocType"].Value.ToString();
            String _ProductID = "";
            String _Quantity = dataGridView1.Rows[e.RowIndex].Cells["Quantity"].Value.ToString();
            String _ServiceProductType = dataGridView1.Rows[e.RowIndex].Cells["ServiceProductType"].Value.ToString();
            String _comment = "";
            AddServiceOrderItem pas = new AddServiceOrderItem(ident, _ServiceProductType, _DocNUM, _DocType, _ProductID, _Quantity, _comment);
            pas.ShowDialog();
            string myString = pas.ResultString;
            if (!String.IsNullOrEmpty(myString))
            {
                string[] fields = myString.ToString().Split(',');
                //MessageBox.Show("debug Getting REturn String" + "PRODTYPE : " + fields[0] + " PRODTYPEdesc  : " + fields[1]);

                DataRow[] newServiceOrderDTLRow = ds.Tables[0].Select("DocNum = '"+ _DocNUM + "' AND DocType = '"+ _DocType + "' and ServiceProductType = '"+  _ServiceProductType + "'");

                newServiceOrderDTLRow[0]["DocNum"] = Int32.Parse(_DocNUM);
                newServiceOrderDTLRow[0]["DocType"] = Int32.Parse(_DocType);
                newServiceOrderDTLRow[0]["Quantity"] = Int32.Parse("1");
                newServiceOrderDTLRow[0]["ServiceProductType"] = Int32.Parse(fields[0]);
                newServiceOrderDTLRow[0]["ServiceProductDescription"] = fields[1];
                newServiceOrderDTLRow[0]["Hours"] = double.Parse(fields[3]);
                newServiceOrderDTLRow[0]["Price"] = double.Parse(fields[4]);
                newServiceOrderDTLRow[0]["Status"] = Int32.Parse("0");

               // newServiceOrderDTLRow[0]["Comments"] = fields[5].Trim();
              //  ds.Tables[0].Rows.Add(newServiceOrderDTLRow);
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            String _DocNUM = DocNum.Text;
            String _DocType = Doctype.Text;
            String _ProductID = "";
            String _Quantity = "1";
            String _ServiceProductType = "";
            String _comment = "This is To pass existing comments";
            AddServiceOrderItem pas = new AddServiceOrderItem(ident, _ServiceProductType, _DocNUM, _DocType, _ProductID, _Quantity, _comment);
            pas.ShowDialog();
            string myString = pas.ResultString;
            if (!String.IsNullOrEmpty(myString))
            {
                string[] fields = myString.ToString().Split(',');
             //   MessageBox.Show("debug Getting REturn String" + "PRODTYPE : " + fields[0] + " PRODTYPEdesc  : " + fields[1]);

                DataRow newServiceOrderDTLRow = ds.Tables[0].NewRow();

                newServiceOrderDTLRow["DocNum"] = Int32.Parse(DocNum.Text);
                newServiceOrderDTLRow["DocType"] = Int32.Parse(Doctype.Text);
                newServiceOrderDTLRow["Quantity"] = Int32.Parse("1");
                newServiceOrderDTLRow["ServiceProductType"] = Int32.Parse(fields[0]);
                newServiceOrderDTLRow["ServiceProductDescription"] = fields[1];
                newServiceOrderDTLRow["Hours"] = double.Parse(fields[3]);
                newServiceOrderDTLRow["Price"] = double.Parse(fields[4]);
                newServiceOrderDTLRow["Status"] = Int32.Parse("0");
               // newServiceOrderDTLRow["Comments"] = fields[5].Trim();
                ds.Tables[0].Rows.Add(newServiceOrderDTLRow);

            }
        }