Ejemplo n.º 1
0
        //private string WR()
        //{
        //    DateTime curr_data = DateTime.Now;
        //    string q = "";
        //    if (dateTimePicker2.Value.Date <= curr_data) { q = @"UPDATE orderr SET ready = '" + "Не выполнено" + @"' WHERE expiration_date<=CURDATE();"; }
        //    else q = @"UPDATE orderr SET readyy = '"+"Выполнено"+ @"' WHERE expiration_date>=CURDATE();";
        //    return q;
        //}

        private void button1_Click(object sender, EventArgs e)
        {
            double        OC     = 0;
            string        readyy = "Не выполнено";
            ClassDataBase db     = new ClassDataBase();
            string        qq     = @"insert into clientt(s_cl, n_cl, p_cl) values ('" + clF.Text + @"','" + clN.Text + @"','" + clP.Text + @"')";

            db.ExecuteNonQuery("ALD_V2.db", qq, 0);
            string qq2 = @"select id_cl, s_cl, n_cl, p_cl from clientt order by id_cl desc limit 1;";

            db.Execute <Client>("ALD_V2.db", qq2, ref listClient);
            string qqq = @"insert into orderr(id_cl, footage, date_of_conclusion, expiration_date, order_cost, readyy) values (" + listClient[0].Id_cl + @"," + ordSq.Text + @",'" + dateTimePicker1.Text + @"','" + dateTimePicker2.Text + @"'," + OC + @",'" + readyy + @"');";

            db.ExecuteNonQuery("ALD_V2.db", qqq, 0);
            listOrder.Clear();
            string qqq2 = @"select id_order, id_cl, footage, date_of_conclusion, expiration_date, order_cost, readyy from orderr order by id_cl desc limit 1;";

            db.Execute <Order>("ALD_V2.db", qqq2, ref listOrder);
            string qqq3 = @"insert into order_empl(id_order,id_empl) values ('" + listOrder[0].Id_order + @"','" + GetIDE(cbEmpl.Text.Trim()) + @"')";

            db.ExecuteNonQuery("ALD_V2.db", qqq3, 0);
            OrdersProjects newForm = new OrdersProjects();

            newForm.Show();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClassDataBase db = new ClassDataBase();
            double        TC = 0;
            string        ll = @"select id_order, id_cl, footage, date_of_conclusion, expiration_date, order_cost, readyy from orderr order by id_order desc limit 1;";

            db.Execute <Order>("ALD_V2.db", ll, ref listOrder);
            string ll2 = @"select id_proj, cat_proj, name_proj, cost_of_work, min_square, work_time from projects where cat_proj = '" + cbCatProj.Text + @"' and name_proj='" + cbNameProj.Text + @"'";

            db.Execute <Projects>("ALD_V2.db", ll2, ref listProj);
            //string lll = @"insert into order_proj(id_order, id_proj) values (" + listOrder[0].Id_order + @"," + listProj[0].Id_proj + @")";
            string s = @"INSERT INTO order_proj (id_order, id_proj) VALUES (" + "(select id_order from orderr order by 1  desc limit 1)" + @"," + GetIDP(cbNameProj.Text) + @")";

            //db.Execute<Order>("ALD_V2.db", s, ref listOrder);
            db.ExecuteNonQuery("ALD_V2.db", s, 0);
            string z = @"select o.id_order, c.s_cl , c.n_cl , c.p_cl , o.footage, o.date_of_conclusion, o.expiration_date, o.order_cost,  p.id_proj,  p.cat_proj, p.name_proj, p.cost_of_work, p.min_square, p.work_time, o.readyy from projects p natural join orderr o natural join clientt c;";

            db.Execute <OrderProj>("ALD_V2.db", z, ref listOrderProj);
            for (int i = 0; i < listProj.Count; i++)
            {
                if (listProj[i].Cat_proj == cbCatProj.Text && listProj[i].Name_proj == cbNameProj.Text)
                {
                    TC = TC + listProj[i].Cost_of_work;
                }
            }
            s = @"UPDATE orderr SET order_cost = order_cost +'" + TC + @"' WHERE id_order = '" + listOrder[0].Id_order + @"'";
            db.ExecuteNonQuery("ALD_V2.db", s, 0);
            s = @"UPDATE Materials SET order_cost = order_cost +'" + TC + @"' WHERE id_order = '" + listOrder[0].Id_order + @"'";
            db.ExecuteNonQuery("ALD_V2.db", s, 0);
            Close();
        }
Ejemplo n.º 3
0
        public void LoadData()
        {
            string q = @"select id_proj, cat_proj, name_proj, cost_of_work, min_square, work_time from projects";

            db.Execute <Projects>("ALD_V2.db", q, ref listProj);
            string qq = @"select id_proj, cat_proj, name_proj, cost_of_work, min_square, work_time from projects group by cat_proj";

            db.Execute <Projects>("ALD_V2.db", qq, ref listProjCat);
            for (int i = 0; i < listProjCat.Count; i++)
            {
                cbCatProj.Items.Add(listProj[i].Cat_proj);
            }
        }
Ejemplo n.º 4
0
        public void LoadData()
        {
            string l = @"select id_m, name_m, category_m, unit_of_measurement_m, quatnity_m, cost_m from materials";

            db1.Execute <Materials>("ALD_V2.db", l, ref listMat);
            for (int i = 0; i < listMat.Count; i++)
            {
                cbNM.Items.Add(listMat[i].Name_m);
            }
            l = @"select id_proj, cat_proj, name_proj, cost_of_work, min_square, work_time from projects";
            db1.Execute <Projects>("ALD_V2.db", l, ref listProj);
            l = @"select m.id_mat_proj, p.name_proj, ma.name_m, m.quantity_m_min_square from m_projects m join materials ma on ma.id_m = m.id_m join projects p on p.id_proj = m.id_proj";
            db1.Execute <MProjects>("ALD_V2.db", l, ref listMProj);
        }
Ejemplo n.º 5
0
        public void LoadData()
        {
            string q = @"select id_proj, cat_proj, name_proj, cost_of_work, min_square, work_time from projects";

            db.Execute <Projects>("ALD_V2.db", q, ref listProjects);
            for (int i = 0; i < listProjects.Count; i++)
            {
                dgvProj.Rows.Add(listProjects[i].Name_proj, listProjects[i].Cat_proj, listProjects[i].Cost_of_work, listProjects[i].Min_square, listProjects[i].Work_time);
            }
        }
Ejemplo n.º 6
0
        public void LoadData()
        {
            string q = @"select id_m, name_m, category_m, unit_of_measurement_m, quatnity_m, cost_m from materials";

            db.Execute <Materials>("ALD_V2.db", q, ref listMaterials);
            string l = @"select id_proj, cat_proj, name_proj, cost_of_work, min_square, work_time from projects";

            db.Execute <Projects>("ALD_V2.db", l, ref listProjects);
            for (int i = 0; i < listProjects.Count; i++)
            {
                comboBox1.Items.Add(listProjects[i].Name_proj);
            }
            l = @"select m.id_mat_proj, p.name_proj, ma.name_m, m.quantity_m_min_square from m_projects m join materials ma on ma.id_m = m.id_m join projects p on p.id_proj = m.id_proj";
            db.Execute <MProjects>("ALD_V2.db", l, ref listMProjects);
            for (int i = 0; i < listMProjects.Count; i++)
            {
                dataGridView1.Rows.Add(listMProjects[i].Name_proj, listMProjects[i].Name_m, listMaterials[i].Unit_of_measurement_m, listMProjects[i].Quantity_m_min_square);
            }
        }
Ejemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            string s = @"select o.id_order, c.s_cl, c.n_cl, c.p_cl, o.footage, o.date_of_conclusion, o.expiration_date, o.order_cost, o.readyy, e.s_empl, e.n_empl, e.p_empl from employee e natural join order_empl natural join orderr o natural join clientt c  where o.id_order = '" + comboBox1.Text + @"' group by id_order ;";

            db.Execute("ALD_V2.db", s, ref listOrder2);
            ClassSerialiaze.SerialiazeToXml <List <Order2> >(ref listOrder2, "data.xml");

            FormReport frmReport = new FormReport();

            frmReport.ShowDialog();
        }
Ejemplo n.º 8
0
        public void LoadData()
        {
            string q = @"select id_empl, n_empl, s_empl, p_empl, exper from employee;";

            db.Execute <Employee>("ALD_V2.db", q, ref listEmployee);
            string epl = "";

            for (int i = 0; i < listEmployee.Count; i++)
            {
                epl = listEmployee[i].S_empl + " " + listEmployee[i].N_empl + " " + listEmployee[i].P_empl;
                cbEmpl.Items.Add(epl);
            }
        }
Ejemplo n.º 9
0
        public void Serch()
        {
            string[] val    = comboBox2.Text.Split('|');
            double   profit = 0;
            string   q      = @"select id_order, id_cl, footage, date_of_conclusion, expiration_date, order_cost, readyy from orderr where year(expiration_date) = '" + comboBox1.Text + @"'and month(expiration_date) = '" + val[1] + @"'; ";

            db.Execute <Order>("ALD_V2.db", q, ref listOrder);
            for (int i = 0; i < listOrder.Count; i++)
            {
                if (listOrder[i].Readyy == "Выполнено")
                {
                    dataGridView1.Rows.Add(listOrder[i].Id_order, listOrder[i].Footage, listOrder[i].Date_of_conclusion, listOrder[i].Expiration_date, listOrder[i].Order_cost, listOrder[i].Readyy);
                    profit = profit + listOrder[i].Order_cost;
                }
            }
            textBox1.Text = Convert.ToString(profit);
        }
Ejemplo n.º 10
0
        public void LoadData()
        {
            string a = @"select id_order, id_empl from order_empl; ";

            db.Execute <Order_Empl>("ALD_V2.db", a, ref listOrderEmpl);
            string z = @"select o.id_order, c.s_cl , c.n_cl , c.p_cl , o.footage, o.date_of_conclusion, o.expiration_date, o.order_cost,  p.id_proj,  p.cat_proj, p.name_proj, p.cost_of_work, p.min_square, p.work_time, o.readyy from projects p natural join orderr o natural join clientt c;";

            db.Execute <OrderProj>("ALD_V2.db", z, ref listOrderProj);
            string q = @"select o.id_order, o.id_cl, o.footage, o.date_of_conclusion, o.expiration_date, o.order_cost, o.readyy from orderr o;";

            db.Execute <Order>("ALD_V2.db", q, ref listOrder);
            string qq1 = @"select id_empl, s_empl, n_empl, p_empl, exper from employee;";

            db.Execute <Employee>("ALD_V2.db", qq1, ref listEmployee);
            string s = @"select o.id_order, c.s_cl, c.n_cl, c.p_cl, o.footage, o.date_of_conclusion, o.expiration_date, o.order_cost, o.readyy, e.s_empl, e.n_empl, e.p_empl from employee e natural join order_empl natural join orderr o natural join clientt c  group by id_order;";

            db.Execute("ALD_V2.db", s, ref listOrder2);
            WR();
            string qq = @"select id_cl, s_cl, n_cl, p_cl from clientt;";

            db.Execute <Client>("ALD_V2.db", qq, ref listClient);
            string client = "";
            string empl   = "";
            double qwe    = 0;

            for (int i = 0; i < listOrder.Count; i++)
            {
                //qwe = TC(i+1);
                client = listClient[i].S_cl + " " + listClient[i].N_cl + " " + listClient[i].P_cl;
                dgvOR.Rows.Add(listOrder[i].Id_order, client, listOrder[i].Footage, listOrder[i].Date_of_conclusion, listOrder[i].Expiration_date, listOrder[i].Order_cost, listOrder[i].Readyy);
            }
            for (int i = 0; i < listClient.Count; i++)
            {
                comboBox1.Items.Add(client = listClient[i].S_cl + " " + listClient[i].N_cl + " " + listClient[i].P_cl);
            }
            for (int i = 0; i < listOrder.Count; i++)
            {
                comboBox2.Items.Add(listOrder[i].Date_of_conclusion);
            }
            for (int i = 0; i < listEmployee.Count; i++)
            {
                empl = listEmployee[i].S_empl + " " + listEmployee[i].N_empl + " " + listEmployee[i].P_empl;
                comboBox3.Items.Add(empl);
            }
            comboBox4.Items.Add("Выполнено");
            comboBox4.Items.Add("Не выполнено");
        }