Пример #1
0
        private void bttnAddNew_Click(object sender, System.EventArgs e)
        {
            FORMLibrarian_Modify.ADD_STATE = true;
            FORMLibrarian_Modify sForm = new FORMLibrarian_Modify();

            sForm.ShowDialog();
        }
Пример #2
0
 private void bttnModify_Click(object sender, System.EventArgs e)
 {
     if (lvLibrarian.Items[lvLibrarian.FocusedItem.Index].SubItems[0].Text == clsVariables.sLibrarianID)
     {
         if (lvLibrarian.Items.Count > 0)
         {
             try
             {
                 FORMLibrarian_Modify.ADD_STATE    = false;
                 FORMLibrarian_Modify.sLibrarianID = lvLibrarian.Items[lvLibrarian.FocusedItem.Index].SubItems[0].Text;
                 FORMLibrarian_Modify sForm = new FORMLibrarian_Modify();
                 sForm.ShowDialog();
             }
             catch (ArgumentOutOfRangeException aooreE) { MessageBox.Show("" + aooreE.Message); }
             catch (NullReferenceException nreE) {}
         }
         else
         {
             MessageBox.Show("No record to edit.", clsVariables.sMSGBOX, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("Cannot Edit the Profile of " + lvLibrarian.Items[lvLibrarian.FocusedItem.Index].SubItems[1].Text + ". Pls. try again later.", clsVariables.sMSGBOX, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #3
0
        private void FORMLibrarian_Modify_Load(object sender, System.EventArgs e)
        {
            if (ADD_STATE == true)
            {
                picLOGO.Image = MDIFORM.i32x32.Images[13];

                //Set Add OleDbCommand
                cmdAddLibrarian = new OleDbCommand("INSERT INTO tblLibrarian(LibrarianID,FirstName,MiddleName,LastName,StreetAddress,ZipCode,ContactNo,EmailAddress,UserName,UPassword) VALUES(@getLibrarianID,@getFirstName,@getMiddleName,@getLastName,@getStreetAddress,@getZipCode,@getContactNo,@getEmailAddress,@getUserName,@getUPassword)", clsConnections.CN);
                this.Text       = "Add New";
            }
            else
            {
                picLOGO.Image = MDIFORM.i32x32.Images[14];

                //Picture Details
                try
                {
                    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\@Pictures\\@Librarian\\" + sLibrarianID + ".lms") == true)
                    {
                        picLibrarian.Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\@Pictures\\@Librarian\\" + sLibrarianID + ".lms", true);
                    }
                }
                catch (Exception ex) {}

                txtLibraryID.ReadOnly = true;

                //Set Edit OleDbCommand
                cmdAddLibrarian = new OleDbCommand("UPDATE tblLibrarian SET LibrarianID =@getLibrarianID, FirstName =@getFirstName, MiddleName =@getMiddleName, LastName =@getLastName, StreetAddress =@getStreetAddress, ZipCode =@getZipCode, ContactNo =@getContactNo, EmailAddress =@getEmailAddress, UserName =@getUserName, UPassword =@getUPassword WHERE LibrarianID LIKE '" + sLibrarianID + "' ", clsConnections.CN);
                FillFields();
                this.Text = "Edit Existing";
            }

            cmdAddLibrarian.Parameters.Add("@getLibrarianID", OleDbType.VarChar);
            cmdAddLibrarian.Parameters.Add("@getFirstName", OleDbType.VarChar);
            cmdAddLibrarian.Parameters.Add("@getMiddleName", OleDbType.VarChar);
            cmdAddLibrarian.Parameters.Add("@getLastName", OleDbType.VarChar);
            cmdAddLibrarian.Parameters.Add("@getStreetAddress", OleDbType.VarChar);
            cmdAddLibrarian.Parameters.Add("@getZipCode", OleDbType.VarChar);
            cmdAddLibrarian.Parameters.Add("@getContactNo", OleDbType.VarChar);
            cmdAddLibrarian.Parameters.Add("@getEmailAddress", OleDbType.VarChar);
            cmdAddLibrarian.Parameters.Add("@getUserName", OleDbType.VarChar);
            cmdAddLibrarian.Parameters.Add("@getUPassword", OleDbType.VarChar);

            publcLibrarianList = this;
        }