Пример #1
0
        private void button_GD_edit_JobD_Click(object sender, EventArgs e)
        {
            ConnectToMySQL dbc = new ConnectToMySQL(user_id_lbl.Text, user_hash_lbl.Text);

            string query = "";
            //string gang_id = dbc.SelectSingle("id", "gang_number", "gang_number_id", comboBox_GD_edit_PoD0x1.SelectedItem.ToString());

            for (int i = 0; i < Int32.Parse(tableLayoutPanel_GD_edit_JobD.GetControlFromPosition(3, 0).Tag.ToString()); i++)
            {
                string gang_id = dbc.SelectSingle("id", "gang_number", "gang_number_id", tableLayoutPanel_GD_edit_JobD.GetControlFromPosition(1, i + 1).Text);
                query = "UPDATE po_details SET ";
                query += " gang_number_id = '" + gang_id + "', ";
                query += " sheet_size = '" + textBox_GD_edit_PoD1x5.Text + "', ";
                query += " print_qty = '" + textBox_GD_edit_PoD2x7.Text + "', ";
                query += " issue_qty = '" + textBox_GD_edit_PoD2x9.Text + "', ";
                query += " PrintOnFaceFront = '" + textBox_GD_edit_PoD0x7.Text + "', ";
                query += " PrintOnFaceBack = '" + textBox_GD_edit_PoD1x7.Text + "', ";
                query += " SideGuideFront = '" + textBox_GD_edit_PoD0x11.Text + "', ";
                query += " SideGuideBack = '" + textBox_GD_edit_PoD1x11.Text + "', ";
                query += " UVCoatingBack = '" + textBox_GD_edit_PoD1x13.Text + "',";
                query += " job_number = '" + tableLayoutPanel_GD_edit_JobD.GetControlFromPosition(0, i + 1).Text + "', ";
                query += " up_size = '" + tableLayoutPanel_GD_edit_JobD.GetControlFromPosition(3, i + 1).Text + "' ";
                query += " WHERE id = '" + tableLayoutPanel_GD_edit_JobD.GetControlFromPosition(0, i + 1).Tag.ToString() + "' ;";

                dbc.Update(query); // TODO: uncomment
            }
            label_GD_edit_update_status.Visible = true;
            label_GD_edit_update_status.Text = "Update Successful !";
        }
Пример #2
0
        void t_gangjob_button_Click(object sender, EventArgs e)
        {
            ConnectToMySQL dbc = new ConnectToMySQL(user_id_lbl.Text, user_hash_lbl.Text);
            string str_buttonTag = ((Button)sender).Tag.ToString();

            string gang_number = "Initial";
            if (comboBox_GD_insert_0x0.SelectedItem.ToString() == "New")
                gang_number = textBox_GD_insert_0x1.Text;
            else if(comboBox_GD_insert_0x0.SelectedItem != null)
                gang_number = comboBox_GD_insert_0x0.SelectedItem.ToString();

            string query = " UPDATE graphics_vars_job ";
            query += " SET graphics_vars_gang_id = " + gang_number + ", ";
            query += " up_size = " + label_GD_insert_2x3.Tag.ToString();
            query += " WHERE id = " + str_buttonTag;

            dbc.Update(query);

            // Updating total up size in graphics_vars_gang table -->
            query = " SELECT up_size, id, sales_vars_id ";
            query += " FROM graphics_vars_gang ";
            query += " WHERE gang_number = '" + dbc.SelectSingle("graphics_vars_gang_id", "graphics_vars_job", "id", str_buttonTag) + "'; ";

            DataSet ds = new DataSet();
            int up_size = 0;
            ds = dbc.SelectMyDA(query);

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                if (label_GD_insert_0x3.Text != ds.Tables[0].Rows[i][2].ToString())
                    up_size += Int32.Parse(ds.Tables[0].Rows[i][0].ToString());
            }
            up_size += Int32.Parse(label_GD_insert_2x3.Tag.ToString());

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                query = " UPDATE graphics_vars_gang ";
                query += " SET up_size = " + up_size.ToString() + " ";
                query += " WHERE id = " + ds.Tables[0].Rows[i][1].ToString();

                dbc.Update(query);
            }
            //<--
        }
Пример #3
0
        void editBox_LostFocus(object sender, EventArgs e)
        {
            if (hitInfo.SubItem.Text != editBox.Text)
            {
                ConnectToMySQL dbc = new ConnectToMySQL(user_id_lbl.Text, user_hash_lbl.Text);

                string query = "UPDATE po_entry SET ";
                if (hitInfo.Item.SubItems.IndexOf(hitInfo.SubItem) == 0)
                    query += " cust_name = '" + editBox.Text + "' ";
                if (hitInfo.Item.SubItems.IndexOf(hitInfo.SubItem) == 3)
                    query += " notes = '" + editBox.Text + "' ";
                query += " WHERE id = '" + hitInfo.Item.Tag.ToString() + "';";

                dbc.Update(query); // TODO: uncomment
            }
            hitInfo.SubItem.Text = editBox.Text;
            editBox.Hide();
        }
Пример #4
0
        void t_btn1_Click(object sender, EventArgs e)
        {
            TableLayoutPanel tlp_gd_insert_mid = (TableLayoutPanel)tabControl_GD_insert.TabPages[tabControl_GD_insert.TabPages.Count - 1].Controls[0];
            ConnectToMySQL dbc = new ConnectToMySQL(user_id_lbl.Text, user_hash_lbl.Text);

            string gang_number = tlp_gd_insert_mid.GetControlFromPosition(0, 1).Text;
            List<string> fldVals = new List<string>();
            fldNames.Clear();

            for (int row = 0; row < 7; row++)
            {
                for (int col = 0; col < 1; col++)
                {
                    if (((CheckBox)tlp_gd_insert_mid.GetControlFromPosition(col, ((row * 2) + 3))).CheckState == CheckState.Checked)
                    {
                        fldNames.Add(tlp_gd_insert_mid.GetControlFromPosition(col, ((row * 2) + 2)).Text);
                        fldVals.Add("Y");

                        fldNames.Add(tlp_gd_insert_mid.GetControlFromPosition(col + 1, ((row * 2) + 2)).Text);
                        fldVals.Add(tlp_gd_insert_mid.GetControlFromPosition(col + 1, ((row * 2) + 3)).Text);
                    }
                }
            }

            string query = "UPDATE graphics_vars_gang SET ";
            for (int i = 0; i < fldVals.Count; i++)
                query += fldNames[i] + "=" + "\"" + fldVals[i] + "\" ,";
            query = query.Remove((query.Length - 1), 1);
            query += " WHERE gang_number = \"" + gang_number + "\"";

            dbc.Update(query);

            tlp_gd_insert_mid.GetControlFromPosition(1, 1).Enabled = true;
            tlp_gd_insert_mid.GetControlFromPosition(1, 1).Tag = gang_number;
        }
Пример #5
0
        private void button_SA_edit_PoD_Click(object sender, EventArgs e)
        {
            ConnectToMySQL dbc = new ConnectToMySQL(user_id_lbl.Text, user_hash_lbl.Text);
            List<string> fldVals = new List<string>();
            List<string> addtFldVals = new List<string>();
            TableLayoutPanel TLP = new TableLayoutPanel();
            string[] str = new string[] { };
            DataSet ds = new DataSet();

            if (((Control)sender).Name == "button_SA_edit_PoD")
                TLP = tableLayoutPanel1_SA_edit_addDetails;
            else
                TLP = (TableLayoutPanel)sender;

            // setting up start column and adding remaining values like user_id, po number, cust name, req date, notes -->
            int startColCount = 1;
            if (TLP.GetControlFromPosition(0, 0).Tag != null)
            {
                startColCount = Int32.Parse(TLP.GetControlFromPosition(0, 0).Tag.ToString()) + 1; // get col count from 0,0 position tag.
                string query = "SELECT cust_po_number, notes, cust_name, DATE_FORMAT(req_date, '%Y-%m-%d')";
                query += " FROM sales_vars WHERE cust_po_number = '" + TLP.GetControlFromPosition(startColCount, 20).Tag.ToString() + "'; ";
                ds = dbc.SelectMyDA(query);
                addtFldVals.Add(user_id_lbl.Text);
                for (int i = 0; i < ds.Tables[0].Rows[0].ItemArray.Length; i++)
                    addtFldVals.Add(ds.Tables[0].Rows[0].ItemArray[i].ToString());
            }
            else if(TLP.Name != "tableLayoutPanel1_SA_edit_addDetails")
            {
                addtFldVals.Add(user_id_lbl.Text);
                addtFldVals.Add(textBox_Cust_PO_Num.Text);
                addtFldVals.Add(textBox_Cust_Notes.Text);
                addtFldVals.Add(textBox_Cust_Name.Text);
                addtFldVals.Add(dateTimePicker_Cust_Req_Date.Value.Year.ToString() + "-" + dateTimePicker_Cust_Req_Date.Value.Month.ToString() + "-" + dateTimePicker_Cust_Req_Date.Value.Day.ToString());
            }
            // <--

            // adding field values and inserting for po_details table -->
            List<string> fldNames2 = new List<string>();
            fldNames2.Add("user_id");
            fldNames2.Add("cust_po_number");
            fldNames2.Add("notes");
            fldNames2.Add("cust_name");
            fldNames2.Add("req_date");
            for (int i = startColCount; i < TLP.ColumnCount; i++)
            {
                fldVals.Clear();
                for (int j = 1; j <= 21; j++)
                {
                    if (TLP.GetControlFromPosition(i, j).GetChildAtPoint(new Point(4, 6)).Text == "Other")
                        fldVals.Add(TLP.GetControlFromPosition(i, j).GetChildAtPoint(new Point(3, 30)).Text);
                    else
                        fldVals.Add(TLP.GetControlFromPosition(i, j).GetChildAtPoint(new Point(4, 6)).Text);
                }

                /*
                string s = TLP.GetControlFromPosition(i, 21).Tag.ToString();
                if (((Control)sender).Name == "button_SA_edit_PoD")
                    str = tableLayoutPanel1_SA_edit_addDetails.GetControlFromPosition(i, 21).Tag.ToString().Remove(TLP.GetControlFromPosition(i, 21).Tag.ToString().Length - 1).Split('&');
                else
                    str = TLP.GetControlFromPosition(i, 21).Tag.ToString().Remove(TLP.GetControlFromPosition(i, 21).Tag.ToString().Length - 1).Split('&');
                */

                fldVals.AddRange(addtFldVals.ToArray());
                //if (fldNames.Count == 21)
                //    fldNames.RemoveAt(21);
                if (fldNames.Count == 22)
                    fldNames.RemoveAt(21);

                if (Int32.Parse(TLP.GetControlFromPosition(startColCount, 21).Tag.ToString()) == 0)
                {
                    fldNames.AddRange(fldNames2);
                    dbc.Insert(fldNames, "sales_vars", fldVals, user_id_lbl.Text); // TODO: uncomment
                    fldNames2.Clear();
                }
                else
                {
                    fldNames.AddRange(new string[] {"DataApproved", "ArtApproved" });

                    if (((CheckBox)TLP.GetControlFromPosition(i, 24)).CheckState == CheckState.Checked)
                        fldVals.Add("Y");
                    else
                        fldVals.Add("N");

                    if (((CheckBox)TLP.GetControlFromPosition(i, 25)).CheckState == CheckState.Checked)
                        fldVals.Add("Y");
                    else
                        fldVals.Add("N");

                    string query = "UPDATE sales_vars SET ";
                    for (int j = 0; j < fldNames.Count; j++)
                    {
                        query += fldNames[j] + " = '" + fldVals[j] + "'";
                        if (j != fldNames.Count - 1)
                            query += ", ";
                    }
                    query += " WHERE id ='" + TLP.GetControlFromPosition(i, 21).Tag.ToString() + "';";
                    dbc.Update(query); // TODO: uncomment
                    fldNames.RemoveAt(22);
                }
            }
            // <--
            if (((Control)sender).Name == "button_SA_edit_PoD")
                label_SA_updateSuccess.Visible = true;
            else
                label_SA_insertPoDSuccess.Visible = true;
        }