Exemple #1
0
 private void smartGrid_DoubleClick(object sender, EventArgs e)
 {
     if (smartGrid.SelectedCell.RowIndex >= 0)
     {
         GlobalContext.HHDoc  = smartGrid.Rows[smartGrid.SelectedCell.RowIndex]["DocNo"].ToString();
         GlobalContext.ZDoc   = smartGrid.Rows[smartGrid.SelectedCell.RowIndex]["SAPDocNo"].ToString();
         GlobalContext.PDocNo = smartGrid.Rows[smartGrid.SelectedCell.RowIndex]["PDocNo"].ToString();
         var frm = new TopstockItemsDisplay();
         frm.ShowDialog();
         GlobalContext.HHDoc  = "";
         GlobalContext.ZDoc   = "";
         GlobalContext.PDocNo = "";
     }
 }
Exemple #2
0
 private void smartGrid_DoubleClick(object sender, EventArgs e)
 {
     if (smartGrid.SelectedCell.RowIndex >= 0)
     {
         GlobalContext.HHDoc  = smartGrid.Rows[smartGrid.SelectedCell.RowIndex]["DocNo"].ToString();
         GlobalContext.ZDoc   = smartGrid.Rows[smartGrid.SelectedCell.RowIndex]["SAPDocNo"].ToString();
         GlobalContext.PDocNo = "";
         GlobalContext.IsLoad = true;
         if (smartGrid.Rows[smartGrid.SelectedCell.RowIndex]["Branch"].ToString() == GlobalContext.BranchCode.Trim() &&
             smartGrid.Rows[smartGrid.SelectedCell.RowIndex]["Warehouse"].ToString() == GlobalContext.WarehouseCode.Trim()
             )
         {
             try
             {
                 using (SqlCeConnection con = new SqlCeConnection(SqlHelper.SqlCeConnectionString))
                 {
                     con.Open();
                     using (SqlCeCommand com = new SqlCeCommand("Update TopstockDoc Set PDocNo = '' WHERE DocNo = @Doc", con))
                     {
                         com.Parameters.AddWithValue("@Doc", GlobalContext.HHDoc);
                         com.ExecuteNonQuery();
                         com.CommandText = "Select FNAME FROM TopstockItems WHERE DocNo = '" + GlobalContext.HHDoc + "'";
                         com.Parameters.Clear();
                         using (var reader = com.ExecuteReader())
                         {
                             while (reader.Read())
                             {
                                 GlobalContext.FormType = reader["FNAME"].ToString();
                                 break;
                             }
                         }
                     }
                 }
             }
             catch (Exception ex)
             {
             }
             this.Close();
         }
         else
         {
             MessageBox.Show("สาขาหรือคลังสินค้าที่ล็อคอินไม่ตรงกับที่มีในเอกสาร \r\n คุณจะไม่สามารถแก้ไขเอกสารนี้ได้");
             var frm = new TopstockItemsDisplay();
             frm.ShowDialog();
         }
     }
 }