Beispiel #1
0
 //ADD NEW RECORD INTO CALLIN TABLE
 public void addcallin(string calldate, string project,
                       string address, string recipient,
                       string contact, string email,
                       string foil, string screen,
                       string windows, string doors,
                       string others, string datevisited,
                       string assignedpersonnel)
 {
     try
     {
         sql.sqlcon.Open();
         string query = "Declare @autonum as integer = (select max(autonum)+1 from callintb)" +
                        "insert into callintb" +
                        "(AUTONUM," +
                        "CDATE," +
                        "PROJECT," +
                        "ADDRESS," +
                        "RECIPIENT," +
                        "CONTACT," +
                        "EMAIL," +
                        "FOIL," +
                        "SCREEN," +
                        "WINDOWS," +
                        "DOORS," +
                        "OTHER," +
                        "DATEVISITED," +
                        "ASSIGNEDPERSONNEL)" +
                        "values" +
                        "(@autonum, " +
                        "'" + calldate + "' , " +
                        "'" + project + "' , " +
                        "'" + address + "' , " +
                        "'" + recipient + "' , " +
                        "'" + contact + "' , " +
                        "'" + email + "' , " +
                        "'" + foil + "' , " +
                        "'" + screen + "' , " +
                        "'" + windows + "' , " +
                        "'" + doors + "' , " +
                        "'" + others + "' , " +
                        "'" + datevisited + "' , " +
                        "'" + assignedpersonnel + "')";
         sqlcmd = new SqlCommand(query, sql.sqlcon);
         sqlcmd.ExecuteNonQuery();
         MetroMessageBox.Show(Form1.ActiveForm, "Data Added Successfully", "SQL Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         sql.sqlcon.Close();
         CallinTableClass b = new CallinTableClass(frm1);
         b.loadcallintb();
     }
     catch (SqlException e)
     {
         MetroMessageBox.Show(Form1.ActiveForm, "" + e.Message + "", "Sql Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         sql.sqlcon.Close();
     }
 }
Beispiel #2
0
 public void updatecallin(string tempcin, string calldate, string project,
                          string address, string recipient,
                          string contact, string email,
                          string foil, string screen,
                          string windows, string doors,
                          string others, string datevisited,
                          string assignedpersonnel)
 {
     try
     {
         sql.sqlcon.Open();
         string query = "update callintb set " +
                        "CDATE = '" + calldate + "', " +
                        "PROJECT = '" + project + "', " +
                        "ADDRESS = '" + address + "', " +
                        "RECIPIENT = '" + recipient + "', " +
                        "CONTACT = '" + contact + "', " +
                        "EMAIL = '" + email + "', " +
                        "FOIL = '" + foil + "', " +
                        "SCREEN = '" + screen + "', " +
                        "WINDOWS = '" + windows + "', " +
                        "DOORS = '" + doors + "', " +
                        "OTHER = '" + others + "', " +
                        "DATEVISITED = '" + datevisited + "', " +
                        "ASSIGNEDPERSONNEL = '" + assignedpersonnel + "' " +
                        "where cin = '" + tempcin + "'";
         sqlcmd = new SqlCommand(query, sql.sqlcon);
         sqlcmd.ExecuteNonQuery();
         MetroMessageBox.Show(Form1.ActiveForm, "Data Updated Successfully", "SQL Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         sql.sqlcon.Close();
         CallinTableClass b = new CallinTableClass(frm1);
         b.loadcallintb();
     }
     catch (SqlException e)
     {
         MetroMessageBox.Show(Form1.ActiveForm, "" + e.Message + "", "Sql Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         sql.sqlcon.Close();
     }
 }
Beispiel #3
0
 public void deletecallin(string cin)
 {
     try
     {
         sql.sqlcon.Open();
         string str = "delete from callintb where cin = '" + cin + "'";
         sqlcmd = new SqlCommand(str, sql.sqlcon);
         sqlcmd.ExecuteNonQuery();
         sql.sqlcon.Close();
         CallinTableClass b = new CallinTableClass(frm1);
         b.loadcallintb();
     }
     catch (SqlException e)
     {
         MetroMessageBox.Show(Form1.ActiveForm, "" + e.Message + "", "Sql Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         sql.sqlcon.Close();
     }
 }
Beispiel #4
0
 private void MetroTabControl1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (MetroTabControl1.SelectedIndex == 1)
     {
         if (firstload == false)
         {
         }
         else
         {
             CallinTableClass b = new CallinTableClass(this);
             b.loadcallintb();
             firstload = false;
         }
     }
     else if (MetroTabControl1.SelectedIndex == 2)
     {
         if (firstloadservicing == false)
         {
         }
         else
         {
             ServicingClass c = new ServicingClass(this, NSF);
             c.loadservicingtb("");
             firstloadservicing = false;
         }
     }
     else if (MetroTabControl1.SelectedIndex == 3)
     {
         if (firstloadqu == false)
         {
         }
         else
         {
             quClass q = new quClass(this, quf);
             q.loadquotaiontb("");
             firstloadqu = false;
         }
     }
 }
Beispiel #5
0
        private void refreshBTN_Click(object sender, EventArgs e)
        {
            CallinTableClass b = new CallinTableClass(this);

            b.loadcallintb();
        }