Beispiel #1
0
        private void AddItemToAssy(string itemno, string qty, string assyno)
        {
            SPMSQLCommands connectAPI           = new SPMSQLCommands();
            DateTime       datecreated          = DateTime.Now;
            string         sqlFormattedDatetime = datecreated.ToString("yyyy-MM-dd HH:mm:ss");
            string         username             = connectAPI.getuserfullname();

            try
            {
                if (_connection.State == ConnectionState.Closed)
                {
                    _connection.Open();
                }
                SqlCommand cmd = _connection.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "INSERT INTO [SPM_Database].[dbo].[ItemDependencies] ([AssyNo],[ItemNo],[Qty]," +
                                  "DateCreated, CreatedBy, LastSaved, LastUser)" +
                                  " VALUES('" + assyno + "','" + itemno + "','" + qty + "','" + sqlFormattedDatetime + "','" + username + "','" + sqlFormattedDatetime + "','" + username + "')";
                cmd.ExecuteNonQuery();
                _connection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "SPM Connect - Error on Add item to dependency", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                _connection.Close();
            }
        }
Beispiel #2
0
 private void OpenModelToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (SPMSQLCommands sc = new SPMSQLCommands())
     {
         if (connectapi.ConnectUser.Dept == Department.Eng)
         {
             sc.Checkforspmfile(GetAssynumber());
         }
         else
         {
             sc.Checkforspmfileprod(GetAssynumber());
         }
     }
 }