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
        private void regularserchTXT_ButtonClick(object sender, EventArgs e)
        {
            regularserchTXT.Text = regularserchTXT.Text.Replace("'", "`").Trim();
            regularserchTXT.Text = regularserchTXT.Text.Replace("\"", "``").Trim();

            CallinTableClass b     = new CallinTableClass(this);
            string           query = "select " + rowcounter(rownumber1.Text) + " " + b.callintbcolumns + " from callintb where project like '%" + regularserchTXT.Text + "%'";

            b.findcallin(query);
        }
Beispiel #3
0
 public void buttonsearchclick(Control objectname, string column)
 {
     objectname.Text = objectname.Text.Replace("'", "`");
     objectname.Text = objectname.Text.Replace("\"", "``");
     if (objectname.Text == "")
     {
         MetroMessageBox.Show(this, "Please enter " + column + " to search", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         CallinTableClass b   = new CallinTableClass(this);
         newcallinclass   a   = new newcallinclass(this);
         string           str = "select " + b.callintbcolumns + " from callintb where " + column + " like '%" + objectname.Text + "%' order by autonum desc";
         a.loadsearchresult(str);
     }
 }
Beispiel #4
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 #5
0
        private void dropsearchpanelBTN_Click(object sender, EventArgs e)
        {
            Transition T1 = new Transition(new TransitionType_EaseInEaseOut(200));
            int        H  = callinGRID.Height;

            if (callinGRID.Location.Y == 174)
            {
                T1.add(callinGRID, "Top", 64);
                T1.run();
                callinGRID.Height = H + 110;
            }
            else
            {
                T1.add(callinGRID, "Top", 174);
                T1.run();
                callinGRID.Height = H - 110;
            }
            CallinTableClass b = new CallinTableClass(this);

            b.loadsuggestions();
        }
Beispiel #6
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 #7
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 #8
0
        private void refreshBTN_Click(object sender, EventArgs e)
        {
            CallinTableClass b = new CallinTableClass(this);

            b.loadcallintb();
        }
Beispiel #9
0
        private void findBTN_Click(object sender, EventArgs e)
        {
            cleanSearchfields();

            string cola = "STATUS";
            string colb = "CDATE";
            string colc = "CIN";
            string cold = "PROJECT";
            string colf = "ADDRESS";
            string colg = "RECIPIENT";

            string a = statusSearch.Text;
            string b = dateSearch.Text;
            string c = cinSearch.Text;
            string d = projectSearch.Text;
            string f = addressSearch.Text;
            string g = recipientSearch.Text;

            if (a == "")
            {
                a = "STATUS";
            }
            else
            {
                a = "'%" + a + "%'";
            }

            if (b == "")
            {
                b = "CDATE";
            }
            else
            {
                b = "'%" + b + "%'";
            }

            if (c == "")
            {
                c = "CIN";
            }
            else
            {
                c = "'%" + c + "%'";
            }

            if (d == "")
            {
                d = "PROJECT";
            }
            else
            {
                d = "'%" + d + "%'";
            }

            if (f == "")
            {
                f = "ADDRESS";
            }
            else
            {
                f = "'%" + f + "%'";
            }

            if (g == "")
            {
                g = "RECIPIENT";
            }
            else
            {
                g = "'%" + g + "%'";
            }

            CallinTableClass y     = new CallinTableClass(this);
            string           query = "select " + rowcounter(rownumber1.Text) + " " + y.callintbcolumns + " from callintb where " + cola + " like " + a + " and " +
                                     "" + colb + " like " + b + " and " +
                                     "" + colc + " like " + c + " and " +
                                     "" + cold + " like " + d + " and " +
                                     "" + colf + " like " + f + " and " +
                                     "" + colg + " like " + g + " order by autonum desc";

            y.findcallin(query);
        }