Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            switch (this.Tag.ToString().Trim())
            {
            case "shop.shop_user":
                MaMall.execlppy("shop", "shop_user", "plot");
                break;

            case "category.category_shop":
                MaMall.execlppy("category", "category_shop", "plot");
                break;

            case "sales.volume":
                MaMall.execlppy("shop", "shop_prices", "plot");
                break;

            case "sales.volume.shop":
                MaMall.execlppy("product", "product_prices", "plot", dataGridView1.Tag.ToString());    //userId
                break;

            case "avgCustByHoursInAShop":
                MaMall.execlppy("invoice", "avgCustByHoursInAShop", "plot", dataGridView1.Tag.ToString());    //userId
                break;

            case "customerInShopInWeek":
                MaMall.execlppy("invoice", "customerInShopInWeek", "plot", dataGridView1.Tag.ToString());    //userId
                break;
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            String employee = this.Tag.ToString(), username = textBox1.Text, password = textBox2.Text;
            int    employeeId;



            string output = MaMall.execlppy("checkAccount", employee, username, password);

            employeeId = int.Parse(output); //adminId or userId


            if (employeeId != -1)
            {
                if (employee == "admin")
                {
                    Form3 f3 = new Form3();
                    f3.Tag = employeeId;
                    f3.ShowDialog();
                    this.Close();
                }
                else
                {
                    Form4 f4 = new Form4();
                    f4.Tag = employeeId;
                    f4.ShowDialog();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("invalid username or password");
            }
        }
Ejemplo n.º 3
0
        private void Form4_Load(object sender, EventArgs e)
        {
            string userId = this.Tag.ToString().Trim();
            string output = MaMall.execlppy("employee", "user", userId);

            //MessageBox.Show(output);
            string[] properties = output.Trim().Split('\n');

            label1.Text = properties[7];
            //MessageBox.Show(properties[7]); MessageBox.Show(properties[6]);

            pictureBox2.Image = new Bitmap("images\\employee\\" + properties[6].Trim() + ".jpg");
            pictureBox2.Tag   = properties[6].Trim();

            string output1 = MaMall.execlppy("shop", "specificshop", userId);

            //MessageBox.Show(output1);
            string[] properties1 = output1.Trim().Split('\n');

            label2.Text = properties1[0];
            //MessageBox.Show(properties[7]); MessageBox.Show(properties[6]);

            pictureBox1.Image = new Bitmap("images\\shop\\" + properties1[0].Trim() + ".jpg");
            pictureBox1.Tag   = properties1[0].Trim();

            shopId = properties1[3];
        }
Ejemplo n.º 4
0
        private void button3_Click(object sender, EventArgs e)
        {
            string categoryId = textBox1.Tag.ToString().Trim();

            string output = MaMall.execlppy("category", "delete", categoryId);

            button3.Enabled = false;
            try
            {
                File.Delete("images\\category\\" + textBox1.Text.Trim() + ".jpg");
            }
            catch { }
            button2_Click(null, null);
        }
Ejemplo n.º 5
0
        private void button3_Click(object sender, EventArgs e)
        {
            string supplierID = textBox1.Tag.ToString().Trim();
            string fulladdID  = textBox7.Tag.ToString().Trim();
            string output     = MaMall.execlppy("supplier", "delete", supplierID, fulladdID);

            button3.Enabled = false;
            try
            {
                File.Delete("images\\supplier\\" + textBox1.Text.Trim() + ".jpg");
            }
            catch { }
            button2_Click(null, null);
        }
Ejemplo n.º 6
0
        private void button3_Click(object sender, EventArgs e)
        {
            string personId   = textBox1.Tag.ToString().Trim();
            string employeeID = textBox5.Tag.ToString().Trim();
            string fulladdID  = textBox7.Tag.ToString().Trim();
            string output     = MaMall.execlppy("employee", "delete", personId, employeeID, fulladdID);

            button3.Enabled = false;
            try
            {
                File.Delete("images\\employee\\" + textBox1.Text.Trim() + textBox2.Text.Trim() + ".jpg");
            }
            catch { }
            button2_Click(null, null);
        }
Ejemplo n.º 7
0
        private void Form3_Load(object sender, EventArgs e)
        {
            string adminId = this.Tag.ToString().Trim();
            string output  = MaMall.execlppy("employee", "admin", adminId);

            //MessageBox.Show(output);
            string[] properties = output.Trim().Split('\n');

            label1.Text = properties[7];
            //MessageBox.Show(properties[7]); MessageBox.Show(properties[6]);



            pictureBox2.Image = new Bitmap("images\\employee\\" + properties[6].Trim() + ".jpg");
            pictureBox2.Tag   = properties[6].Trim();
        }
Ejemplo n.º 8
0
        private void Form8_Load(object sender, EventArgs e)
        {
            button1.Enabled = false;
            button3.Enabled = false;

            string output = MaMall.execlppy("category", "get");

            string[] categoryItems = output.Trim().Split(' ', '\n');

            comboBox1.DisplayMember = "Text";
            comboBox1.ValueMember   = "Value";


            for (int i = 0; i < categoryItems.Length; i = i + 2)
            {
                comboBox1.Items.Add(new { Text = categoryItems[i], Value = categoryItems[i + 1] });
            }
        }
Ejemplo n.º 9
0
        private void exportToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            MaMall.execlppy("product", "product_groups", "export", shopId);
            OpenFileDialog folderBrowser = new OpenFileDialog();

            // Set validate names and check file exists to false otherwise windows will
            // not let you select "Folder Selection."
            folderBrowser.ValidateNames   = false;
            folderBrowser.CheckFileExists = false;
            folderBrowser.CheckPathExists = true;
            // Always default to Folder Selection.
            folderBrowser.FileName = "Folder Selection.";
            if (folderBrowser.ShowDialog() == DialogResult.OK)
            {
                string folderPath = Path.GetDirectoryName(folderBrowser.FileName);
                // ...
                File.Copy("temp.csv", folderPath + @"\data.csv");
            }
        }
Ejemplo n.º 10
0
        private void Form7_Load(object sender, EventArgs e)
        {
            button1.Enabled = false;
            button3.Enabled = false;

            string output = MaMall.execlppy("supplier", "get");

            string[] supplierItems = output.Trim().Split(' ', '\n');
            //MessageBox.Show(supplierItems[0]);

            comboBox1.DisplayMember = "Text";
            comboBox1.ValueMember   = "Value";


            for (int i = 0; i < supplierItems.Length; i = i + 2)
            {
                comboBox1.Items.Add(new { Text = supplierItems[i], Value = supplierItems[i + 1] });
            }
        }
Ejemplo n.º 11
0
        private void Form6_Load(object sender, EventArgs e)
        {
            button1.Enabled = false;
            button3.Enabled = false;

            dateTimePicker2.Value = DateTime.Now;
            dateTimePicker1.Value = DateTime.Now;
            string output = MaMall.execlppy("employee", "get");

            string[] employeeItems = output.Trim().Split(' ', '\n');

            comboBox1.DisplayMember = "Text";
            comboBox1.ValueMember   = "Value";


            for (int i = 0; i < employeeItems.Length; i = i + 3)
            {
                comboBox1.Items.Add(new { Text = employeeItems[i] + " " + employeeItems[i + 1], Value = employeeItems[i + 2] });
            }
        }
Ejemplo n.º 12
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string output = MaMall.execlppy("category", "getinf", (comboBox1.SelectedItem as dynamic).Value);//categoryID

            string[] properties = output.Trim().Split('\n');
            //MessageBox.Show("{0}", string.Join("\n", properties));

            textBox1.Text = properties[0];
            textBox2.Text = properties[1];


            textBox1.Tag = properties[4];



            pictureBox1.Image = new Bitmap("images\\category\\" + properties[2].Trim() + ".jpg");
            pictureBox1.Tag   = properties[2].Trim();


            button3.Enabled = true;
        }
Ejemplo n.º 13
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string output = MaMall.execlppy("supplier", "getinf", (comboBox1.SelectedItem as dynamic).Value);//supplierID

            string[] properties = output.Trim().Split('\n');
            //MessageBox.Show("{0}", string.Join("\n", properties));
            textBox1.Text = properties[1]; textBox7.Text = properties[7]; textBox12.Text = properties[12];
            textBox2.Text = properties[2]; textBox8.Text = properties[8];
            textBox3.Text = properties[4]; textBox9.Text = properties[9];
            textBox4.Text = properties[3]; textBox10.Text = properties[10];
            textBox5.Text = properties[6]; textBox11.Text = properties[11];


            textBox1.Tag = properties[0];
            textBox7.Tag = properties[13];


            pictureBox1.Image = new Bitmap("images\\supplier\\" + properties[5].Trim() + ".jpg");
            pictureBox1.Tag   = properties[5].Trim();

            button3.Enabled = true;
        }
Ejemplo n.º 14
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string output = MaMall.execlppy("employee", "getinf", (comboBox1.SelectedItem as dynamic).Value);//employeeID

            string[] properties = output.Trim().Split('\n');
            //MessageBox.Show("{0}", string.Join("\n", properties));
            textBox1.Text = properties[1]; textBox7.Text = properties[9]; textBox12.Text = properties[14];
            textBox2.Text = properties[2]; textBox8.Text = properties[10]; textBox13.Text = properties[16];
            textBox3.Text = properties[4]; textBox9.Text = properties[11]; textBox14.Text = properties[18];
            textBox4.Text = properties[3]; textBox10.Text = properties[12]; textBox15.Text = properties[19];
            textBox5.Text = properties[7]; textBox11.Text = properties[13];
            textBox6.Text = properties[8];

            textBox1.Tag = properties[20];
            textBox5.Tag = properties[0];
            textBox7.Tag = properties[21];

            dateTimePicker1.Value        = DateTime.ParseExact(properties[5].Trim(), "yyyy-MM-dd", CultureInfo.InvariantCulture);
            dateTimePicker1.CustomFormat = "dd   MMMM    .yyyy";
            dateTimePicker1.Format       = DateTimePickerFormat.Custom;

            pictureBox1.Image = new Bitmap("images\\employee\\" + properties[6].Trim() + ".jpg");
            pictureBox1.Tag   = properties[6].Trim();

            dateTimePicker2.Value        = DateTime.ParseExact(properties[15].Trim(), "yyyy-MM-dd", CultureInfo.InvariantCulture);
            dateTimePicker2.CustomFormat = "dd   MMMM    .yyyy";
            dateTimePicker2.Format       = DateTimePickerFormat.Custom;

            if (properties[17].Trim() == "0")
            {
                checkBox1.Checked = false;
            }
            else
            {
                checkBox1.Checked = true;
            }

            button3.Enabled = true;
        }
Ejemplo n.º 15
0
 private void viewToolStripMenuItem2_Click(object sender, EventArgs e)
 {
     MaMall.execlppy("product", "product_groups", "plot", shopId);
 }
Ejemplo n.º 16
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (this.Tag.ToString().Trim())
            {
            case "shop.supplier.product":
            {
                MaMall.execlppy("shop", "shopSupplierProduct", (comboBox1.SelectedItem as dynamic).Value);        //shopID
                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();
                comboBox1.Visible = true;
                comboBox1.Items.Clear();
                string output = MaMall.execlppy("shop", "get");

                string[] shopItems = output.Trim().Split(' ', '\n');

                comboBox1.DisplayMember = "Text";
                comboBox1.ValueMember   = "Value";


                for (int i = 0; i < shopItems.Length; i = i + 2)
                {
                    comboBox1.Items.Add(new { Text = shopItems[i], Value = shopItems[i + 1] });
                }
                break;
            }

            case "category.category_shop":
            {
                button1.Visible = false;
                MaMall.execlppy("category", "category_shop", "view", (comboBox1.SelectedItem as dynamic).Value);        //categoryID

                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;

                con.Close();
                comboBox1.Visible = true;
                string output = MaMall.execlppy("category", "get");

                string[] categoryItems = output.Trim().Split(' ', '\n');

                comboBox1.DisplayMember = "Text";
                comboBox1.ValueMember   = "Value";


                for (int i = 0; i < categoryItems.Length; i = i + 2)
                {
                    comboBox1.Items.Add(new { Text = categoryItems[i], Value = categoryItems[i + 1] });
                }
                break;
            }

            case "salaries.shop":
            {
                MaMall.execlppy("shop", "salaries_shop", (comboBox1.SelectedItem as dynamic).Value, "0");       //shopId

                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;

                con.Close();
                string output = MaMall.execlppy("shop", "get");

                string[] shopItems = output.Trim().Split(' ', '\n');

                comboBox1.DisplayMember = "Text";
                comboBox1.ValueMember   = "Value";


                for (int i = 0; i < shopItems.Length; i = i + 2)
                {
                    comboBox1.Items.Add(new { Text = shopItems[i], Value = shopItems[i + 1] });
                }
                break;
            }
            }
        }
Ejemplo n.º 17
0
        private void Form16_Load(object sender, EventArgs e)
        {
            switch (this.Tag.ToString().Trim())
            {
            case "customerInShopInWeek":
            {
                MaMall.execlppy("invoice", "customerInShopInWeek", "view", dataGridView1.Tag.ToString());

                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();
                break;
            }

            case "avgCustByHoursInAShop":
            {
                MaMall.execlppy("invoice", "avgCustByHoursInAShop", "view", dataGridView1.Tag.ToString());

                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();
                break;
            }

            case "operations":
            {
                MaMall.execlppy("invoice", "operation", "view", dataGridView1.Tag.ToString());

                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();
                button1.Visible = false;

                break;
            }

            case "emplinf":
            {
                MaMall.execlppy("employee", "emplinf", "view", dataGridView1.Tag.ToString());

                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();
                button1.Visible = false;
                break;
            }

            case "shop.shop_user":
            {
                MaMall.execlppy("shop", "shop_user", "view");

                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();

                break;
            }

            case "category.category_shop":
            {
                MaMall.execlppy("category", "category_shop", "view", "0");

                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;

                con.Close();
                comboBox1.Visible = true;
                string output = MaMall.execlppy("category", "get");

                string[] categoryItems = output.Trim().Split(' ', '\n');

                comboBox1.DisplayMember = "Text";
                comboBox1.ValueMember   = "Value";


                for (int i = 0; i < categoryItems.Length; i = i + 2)
                {
                    comboBox1.Items.Add(new { Text = categoryItems[i], Value = categoryItems[i + 1] });
                }
                break;
            }

            case "sales.volume":
            {
                MaMall.execlppy("shop", "shop_prices", "view");
                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();
                break;
            }

            case "sales.volume.shop":
            {
                MaMall.execlppy("product", "product_prices", "view", dataGridView1.Tag.ToString());        //userId
                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();
                break;
            }

            case "shop.supplier.product":
            {
                MaMall.execlppy("shop", "shopSupplierProduct", "0");        //all shop
                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();
                comboBox1.Visible = true; button1.Visible = false;
                string output = MaMall.execlppy("shop", "get");

                string[] shopItems = output.Trim().Split(' ', '\n');

                comboBox1.DisplayMember = "Text";
                comboBox1.ValueMember   = "Value";


                for (int i = 0; i < shopItems.Length; i = i + 2)
                {
                    comboBox1.Items.Add(new { Text = shopItems[i], Value = shopItems[i + 1] });
                }
                break;
            }

            case "salaries.shop":
            {
                MaMall.execlppy("shop", "salaries_shop", "0", this.dataGridView1.Tag.ToString());       //all shop or userId
                string file = "temp.xlsx";

                String name   = "Sheet1";
                String constr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" +
                                file +
                                ";Extended Properties='Excel 12.0 XML;HDR=YES;';";

                OleDbConnection con   = new OleDbConnection(constr);
                OleDbCommand    oconn = new OleDbCommand("Select * From [" + name + "$]", con);
                con.Open();

                OleDbDataAdapter sda  = new OleDbDataAdapter(oconn);
                DataTable        data = new DataTable();
                sda.Fill(data);
                dataGridView1.DataSource = data;
                con.Close();
                if (this.dataGridView1.Tag.ToString() == "0")
                {
                    comboBox1.Visible = true;
                }
                button1.Visible = false;
                string output = MaMall.execlppy("shop", "get");

                string[] shopItems = output.Trim().Split(' ', '\n');

                comboBox1.DisplayMember = "Text";
                comboBox1.ValueMember   = "Value";


                for (int i = 0; i < shopItems.Length; i = i + 2)
                {
                    comboBox1.Items.Add(new { Text = shopItems[i], Value = shopItems[i + 1] });
                }
                break;
            }
            }
        }
Ejemplo n.º 18
0
        private void button1_Click(object sender, EventArgs e)
        {
            int    saved;
            string adminId = this.Tag.ToString();
            string
                categoryname = textBox1.Text.Trim(),
                description  = textBox2.Text.Trim().Replace(" ", "_");

            if (profile != "category")
            {
                profile = categoryname;
            }

            string output;

            if (comboBox1.Visible == false)
            {
                output = MaMall.execlppy("category", "add", categoryname, description, profile, adminId);
            }

            else
            {
                string categoryId = (comboBox1.SelectedItem as dynamic).Value;
                output = MaMall.execlppy("category", "editinfo", categoryname, description, profile, categoryId);
                //string output1 = Form6.execlppy("getcategory");

                //string[] categoryItems = output1.Trim().Split(' ', '\n');

                //comboBox1.DisplayMember = "Text";
                //comboBox1.ValueMember = "Value";


                //for (int i = 0; i < categoryItems.Length; i = i + 2)
                //{
                //    comboBox1.Items.Add(new { Text = categoryItems[i] , Value = categoryItems[i + 1] });

                //}
            }
            //  MessageBox.Show(output);
            saved = int.Parse(output);

            if (saved >= 1)
            {
                if (profile != "category")
                {
                    try
                    {
                        File.Delete("images\\category\\" + profile + ".jpg");
                    }
                    catch { }
                    try { File.Copy(pictureBox1.Tag.ToString(), "images\\category\\" + profile + ".jpg"); }
                    catch { }
                }
                button1.Enabled = false;
            }
            else
            {
                switch (saved)
                {
                case -1: MessageBox.Show("category name  is unuseful \ntry to change it"); break;
                }
            }
        }
Ejemplo n.º 19
0
        private void button1_Click(object sender, EventArgs e)
        {
            int saved;

            string
                supplierName = textBox1.Text.Trim(),
                fax          = textBox2.Text.Trim(),

                country = textBox4.Text.Trim(),
                city    = textBox3.Text.Trim();

            string webPage     = textBox5.Text.Trim(),
                   street      = textBox7.Text.Trim(),
                   building    = textBox8.Text.Trim(),
                   floor       = textBox9.Text.Trim(),
                   doorId      = textBox10.Text.Trim(),
                   postalCode  = textBox11.Text.Trim(),
                   phoneNumber = textBox12.Text.Trim();

            string output;

            if (profile != "supplier")
            {
                profile = supplierName;
            }
            if (comboBox1.Visible == false)
            {
                output = MaMall.execlppy("supplier", "add", supplierName, fax, country, city, profile, webPage, street, building, floor, doorId, postalCode, phoneNumber);
            }

            else
            {
                string supplierID = textBox1.Tag.ToString().Trim();
                string fulladdID  = textBox7.Tag.ToString().Trim();
                output = MaMall.execlppy("supplier", "editinfo", supplierName, fax, country, city, profile, webPage, street, building, floor, doorId, postalCode, phoneNumber, supplierID, fulladdID);
                //string output1 = execlppy("getemployee");

                //string[] employeeItems = output1.Trim().Split(' ', '\n');

                //comboBox1.DisplayMember = "Text";
                //comboBox1.ValueMember = "Value";


                //for (int i = 0; i < employeeItems.Length; i = i + 3)
                //{
                //    comboBox1.Items.Add(new { Text = employeeItems[i] + " " + employeeItems[i + 1], Value = employeeItems[i + 2] });

                //}
            }

            saved = int.Parse(output);

            if (saved >= 1)//in this case saved=supplierId
            {
                if (profile != "supplier")
                {
                    try { File.Delete("images\\supplier\\" + profile + ".jpg");
                          File.Copy(pictureBox1.Tag.ToString(), "images\\supplier\\" + profile + ".jpg"); }
                    catch { }
                }
                button1.Enabled = false;
            }
            else
            {
                switch (saved)
                {
                case -2: MessageBox.Show("phonenumber and address details are unuseful \ntry to change them"); break;

                case -3: MessageBox.Show("supplier name  and some details are unuseful \ntry to change them"); break;
                }
            }
        }
Ejemplo n.º 20
0
 private void viewToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     MaMall.execlppy("supplier", "supplier_products", "plot", shopId);
 }
Ejemplo n.º 21
0
        private void button1_Click(object sender, EventArgs e)//save
        {
            int saved;

            string
                firstname = textBox1.Text.Trim(),
                lastname  = textBox2.Text.Trim(),

                country = textBox4.Text.Trim(),
                city    = textBox3.Text.Trim();

            dateTimePicker1.CustomFormat = "yyyy-MM-dd";
            dateTimePicker1.Format       = DateTimePickerFormat.Custom;
            string birthdate = dateTimePicker1.Text;

            dateTimePicker1.CustomFormat = "dd   MMMM    .yyyy";
            dateTimePicker1.Format       = DateTimePickerFormat.Custom;



            string username    = textBox5.Text.Trim(),
                   password    = textBox6.Text.Trim(),
                   street      = textBox7.Text.Trim(),
                   building    = textBox8.Text.Trim(),
                   floor       = textBox9.Text.Trim(),
                   doorId      = textBox10.Text.Trim(),
                   postalCode  = textBox11.Text.Trim(),
                   phoneNumber = textBox12.Text.Trim();

            dateTimePicker2.CustomFormat = "yyyy-MM-dd";
            dateTimePicker2.Format       = DateTimePickerFormat.Custom;
            string hireDate = dateTimePicker2.Text;

            dateTimePicker2.CustomFormat = "dd   MMMM    .yyyy";
            dateTimePicker2.Format       = DateTimePickerFormat.Custom;

            string fixSalary = textBox13.Text.Trim();

            int    married    = (checkBox1.Checked == true) ? 1 : 0;
            string nbChildren = textBox14.Text.Trim();
            string email      = textBox15.Text.Trim();
            string output;

            if (profile != "employee")
            {
                profile = firstname + lastname;
            }
            if (comboBox1.Visible == false)
            {
                output = MaMall.execlppy("employee", "add", firstname, lastname, country, city, birthdate, profile, username, password, street, building, floor, doorId, postalCode, phoneNumber, hireDate, fixSalary, married.ToString(), nbChildren, email);
            }

            else
            {
                string personId   = textBox1.Tag.ToString().Trim();
                string employeeID = textBox5.Tag.ToString().Trim();
                string fulladdID  = textBox7.Tag.ToString().Trim();
                output = MaMall.execlppy("employee", "editinfo", firstname, lastname, country, city, birthdate, profile, username, password, street, building, floor, doorId, postalCode, phoneNumber, hireDate, fixSalary, married.ToString(), nbChildren, email, personId, employeeID, fulladdID);
                //string output1 = execlppy("getemployee");

                //string[] employeeItems = output1.Trim().Split(' ', '\n');

                //comboBox1.DisplayMember = "Text";
                //comboBox1.ValueMember = "Value";


                //for (int i = 0; i < employeeItems.Length; i = i + 3)
                //{
                //    comboBox1.Items.Add(new { Text = employeeItems[i] + " " + employeeItems[i + 1], Value = employeeItems[i + 2] });

                //}
            }

            saved = int.Parse(output);

            if (saved >= 1)//in this case saved=employeeId
            {
                if (profile != "employee")
                {
                    try {
                        File.Delete("images\\employee\\" + profile + ".jpg");
                        File.Copy(pictureBox1.Tag.ToString(), "images\\employee\\" + profile + ".jpg");
                    }
                    catch { }
                }
                button1.Enabled = false;
            }
            else
            {
                switch (saved)
                {
                case -1: MessageBox.Show("firstname and second name are unuseful \ntry to change them"); break;

                case -2: MessageBox.Show("phonenumber and address details are unuseful \ntry to change them"); break;

                case -3: MessageBox.Show("username and password and email are unuseful \ntry to change them"); break;
                }
            }
        }
Ejemplo n.º 22
0
        private void Form17_Load(object sender, EventArgs e)
        {
            string userId = this.Tag.ToString().Trim();

            switch (panel1.Tag.ToString())
            {
            case "endEmployee":
            {
                string   output;
                string[] properties;
                output = MaMall.execlppy("employee", "endEmployee");
                string[] empendItems = output.Trim().Split('\n');
                foreach (string raw in empendItems)
                {
                    properties = raw.Trim().Split(' ');

                    PictureBox pic = new PictureBox();
                    pic.Image       = new Bitmap(@"images\employee\" + properties[2] + ".jpg");
                    pic.Tag         = properties[2];
                    pic.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pic.Size        = new Size(240, 200);
                    pic.BorderStyle = BorderStyle.Fixed3D;
                    pic.Left        = 40 + (pic.Width + 40) * (nbempend % 3);
                    pic.Top         = 40 + (pic.Height + 120) * (nbempend / 3);
                    panel1.Controls.Add(pic);
                    nbempend++;



                    Label name = new Label();
                    name.Width = pic.Width;
                    name.Text  = properties[0] + " " + properties[1];
                    name.Left  = pic.Left;
                    name.Top   = pic.Top + pic.Height;
                    panel1.Controls.Add(name);


                    Label desc = new Label();
                    desc.Width = pic.Width;
                    desc.Text  = properties[3];
                    desc.Left  = pic.Left;
                    desc.Top   = pic.Top + pic.Height + name.Height;
                    panel1.Controls.Add(desc);


                    Label unitPrice = new Label();
                    unitPrice.Width = pic.Width;

                    unitPrice.Text = properties[4].Trim();
                    unitPrice.Left = pic.Left;
                    unitPrice.Top  = pic.Top + pic.Height + name.Height + desc.Height;
                    panel1.Controls.Add(unitPrice);


                    Label discount = new Label();        //discount means here the price after the discount
                    discount.Text  = properties[5];
                    discount.Width = pic.Width;

                    discount.Left = pic.Left;
                    discount.Top  = pic.Top + pic.Height + name.Height + desc.Height + unitPrice.Height;
                    panel1.Controls.Add(discount);
                }

                break;
            }

            case "allEmp":
            {
                string   output;
                string[] properties;
                output = MaMall.execlppy("employee", "allEmp");
                string[] empItems = output.Trim().Split('\n');
                foreach (string raw in empItems)
                {
                    properties = raw.Trim().Split(' ');

                    PictureBox pic = new PictureBox();
                    pic.Image       = new Bitmap(@"images\employee\" + properties[2] + ".jpg");
                    pic.Tag         = properties[2];
                    pic.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pic.Size        = new Size(240, 200);
                    pic.BorderStyle = BorderStyle.Fixed3D;
                    pic.Left        = 90 + (pic.Width + 40) * (nbemp % 3);
                    pic.Top         = 40 + (pic.Height + 120) * (nbemp / 3);
                    panel1.Controls.Add(pic);
                    nbemp++;



                    Label name = new Label();
                    name.Width = pic.Width;
                    name.Text  = properties[0] + " " + properties[1];
                    name.Left  = pic.Left;
                    name.Top   = pic.Top + pic.Height;
                    panel1.Controls.Add(name);


                    Label desc = new Label();
                    desc.Width = pic.Width;
                    desc.Text  = properties[3];
                    desc.Left  = pic.Left;
                    desc.Top   = pic.Top + pic.Height + name.Height;
                    panel1.Controls.Add(desc);


                    Label unitPrice = new Label();
                    unitPrice.Width = pic.Width;

                    unitPrice.Text = properties[4].Trim();
                    unitPrice.Left = pic.Left;
                    unitPrice.Top  = pic.Top + pic.Height + name.Height + desc.Height;
                    panel1.Controls.Add(unitPrice);


                    Label discount = new Label();        //discount means here the price after the discount
                    discount.Text  = properties[5];
                    discount.Width = pic.Width;

                    discount.Left = pic.Left;
                    discount.Top  = pic.Top + pic.Height + name.Height + desc.Height + unitPrice.Height;
                    panel1.Controls.Add(discount);
                }

                break;
            }

            case "allCategory":
            {
                string   output;
                string[] properties;
                output = MaMall.execlppy("category", "allCategory");
                string[] catItems = output.Trim().Split('\n');
                foreach (string raw in catItems)
                {
                    properties = raw.Trim().Split(' ');

                    PictureBox pic = new PictureBox();
                    pic.Image       = new Bitmap(@"images\category\" + properties[1].Trim() + ".jpg");
                    pic.Tag         = properties[1];
                    pic.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pic.Size        = new Size(160, 160);
                    pic.BorderStyle = BorderStyle.Fixed3D;
                    pic.Left        = 40 + (pic.Width + 80) * (nbcatma % 4);
                    pic.Top         = 40 + (pic.Height + 50) * (nbcatma / 4);
                    panel1.Controls.Add(pic);
                    nbcatma++;



                    Label name = new Label();
                    name.Font  = new Font(this.Font.FontFamily, this.Font.Size, FontStyle.Bold);
                    name.Width = pic.Width;

                    name.Text = " " + properties[0];
                    name.Left = pic.Left;
                    name.Top  = pic.Top + pic.Height;
                    panel1.Controls.Add(name);
                }
                break;
            }

            case "allShop":
            {
                string   output;
                string[] properties;
                output = MaMall.execlppy("shop", "allShop");
                string[] shopItems = output.Trim().Split('\n');
                foreach (string raw in shopItems)
                {
                    properties = raw.Trim().Split(' ');

                    PictureBox pic = new PictureBox();
                    pic.Image       = new Bitmap(@"images\shop\" + properties[1] + ".jpg");
                    pic.Tag         = properties[1];
                    pic.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pic.Size        = new Size(160, 160);
                    pic.BorderStyle = BorderStyle.Fixed3D;
                    pic.Left        = 40 + (pic.Width + 80) * (nbshopma % 4);
                    pic.Top         = 40 + (pic.Height + 80) * (nbshopma / 4);
                    panel1.Controls.Add(pic);
                    nbshopma++;



                    Label name = new Label();
                    name.Text  = properties[0];
                    name.Left  = pic.Left;
                    name.Top   = pic.Top + pic.Height;
                    name.Width = pic.Width;
                    panel1.Controls.Add(name);


                    Label desc = new Label();
                    desc.Width = pic.Width;

                    desc.Text = properties[2];
                    desc.Left = pic.Left;
                    desc.Top  = pic.Top + pic.Height + name.Height;
                    panel1.Controls.Add(desc);
                }

                break;
            }

            case "productinthemall":
            {
                string   output;
                string[] properties;
                output = MaMall.execlppy("product", "productinthemall", userId);
                string[] productItems = output.Trim().Split('\n');
                foreach (string raw in productItems)
                {
                    properties = raw.Trim().Split(' ');

                    PictureBox pic = new PictureBox();
                    pic.Image       = new Bitmap(@"images\product\" + properties[4] + ".jpg");
                    pic.Tag         = properties[1];
                    pic.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pic.Size        = new Size(200, 200);
                    pic.BorderStyle = BorderStyle.Fixed3D;
                    pic.Left        = 40 + (pic.Width + 30) * (nbProductma % 4);
                    pic.Top         = 40 + (pic.Height + 120) * (nbProductma / 4);
                    panel1.Controls.Add(pic);
                    nbProductma++;



                    Label name = new Label();
                    name.Width = pic.Width;
                    name.Text  = properties[0];
                    name.Left  = pic.Left;
                    name.Top   = pic.Top + pic.Height;
                    panel1.Controls.Add(name);


                    Label desc = new Label();
                    desc.Width = pic.Width;
                    desc.Text  = "desc: " + properties[2];
                    desc.Left  = pic.Left;
                    desc.Top   = pic.Top + pic.Height + name.Height;
                    panel1.Controls.Add(desc);


                    Label unitPrice = new Label();
                    unitPrice.Width = pic.Width;
                    if (double.Parse(properties[5].Trim()) != 0)
                    {
                        unitPrice.Text = properties[3];
                    }
                    else
                    {
                        unitPrice.Text = "-";
                    }
                    unitPrice.Font = new Font(this.Font.FontFamily, this.Font.Size, FontStyle.Strikeout | FontStyle.Italic);
                    unitPrice.Left = pic.Left;
                    unitPrice.Top  = pic.Top + pic.Height + name.Height + desc.Height;
                    panel1.Controls.Add(unitPrice);


                    Label discount = new Label();        //discount means here the price after the discount
                    discount.Width = pic.Width;
                    double price = double.Parse(properties[3].Trim()) - (double.Parse(properties[5].Trim()) / 100) * double.Parse(properties[3].Trim());
                    discount.Text = price.ToString();
                    discount.Left = pic.Left;
                    discount.Top  = pic.Top + pic.Height + name.Height + desc.Height + unitPrice.Height;
                    panel1.Controls.Add(discount);


                    Label discType = new Label();
                    discType.Width = pic.Width;
                    if (properties[6] != "None")
                    {
                        discType.Text = "offerDesc: " + properties[6];
                    }
                    else
                    {
                        discType.Text = "-";
                    }
                    discType.Tag         = properties[6];
                    discType.Left        = pic.Left;
                    discType.Top         = pic.Top + pic.Height + name.Height + desc.Height + unitPrice.Height + discount.Height;
                    discType.MouseHover += new System.EventHandler(mouseOverTheDiscType);
                    panel1.Controls.Add(discType);
                }

                break;
            }

            case "AllSupplier":
            {
                string   output;
                string[] properties;
                output = MaMall.execlppy("supplier", "AllSupplier");
                string[] SuppItems = output.Trim().Split('\n');
                foreach (string raw in SuppItems)
                {
                    properties = raw.Trim().Split(' ');

                    PictureBox pic = new PictureBox();
                    pic.Image       = new Bitmap(@"images\supplier\" + properties[1] + ".jpg");
                    pic.Tag         = properties[1];
                    pic.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pic.Size        = new Size(200, 200);
                    pic.BorderStyle = BorderStyle.Fixed3D;
                    pic.Left        = 30 + (pic.Width + 40) * (nbSupp % 4);
                    pic.Top         = 40 + (pic.Height + 90) * (nbSupp / 4);
                    panel1.Controls.Add(pic);
                    nbSupp++;



                    Label name = new Label();
                    name.Text  = properties[0];
                    name.Width = pic.Width;
                    name.Left  = pic.Left;
                    name.Top   = pic.Top + pic.Height;
                    panel1.Controls.Add(name);


                    Label desc = new Label();
                    desc.Width = pic.Width;

                    desc.Text = properties[2];
                    desc.Left = pic.Left;
                    desc.Top  = pic.Top + pic.Height + name.Height;
                    panel1.Controls.Add(desc);
                }

                break;
            }

            case "ProductInStock":
            {
                string   output;
                string[] properties;
                output = MaMall.execlppy("product", "ProductInStock", userId);
                string[] productItems = output.Trim().Split('\n');
                foreach (string raw in productItems)
                {
                    properties = raw.Trim().Split(' ');

                    PictureBox pic = new PictureBox();
                    pic.Image       = new Bitmap(@"images\product\" + properties[1] + ".jpg");
                    pic.Tag         = properties[1];
                    pic.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pic.Size        = new Size(200, 200);
                    pic.BorderStyle = BorderStyle.Fixed3D;
                    pic.Left        = 150 + (pic.Width + 40) * (nbPro % 3);
                    pic.Top         = 40 + (pic.Height + 60) * (nbPro / 3);
                    panel1.Controls.Add(pic);
                    nbPro++;



                    Label name = new Label();
                    name.Text = properties[0];
                    name.Left = pic.Left;
                    name.Top  = pic.Top + pic.Height;
                    panel1.Controls.Add(name);


                    Label desc = new Label();
                    desc.Width = pic.Width;
                    desc.Text  = properties[2] + " units in stock";
                    desc.Left  = pic.Left;
                    desc.Top   = pic.Top + pic.Height + name.Height;
                    panel1.Controls.Add(desc);
                }

                break;
            }

            case "productInThisShop":
            {
                string   output;
                string[] properties;
                output = MaMall.execlppy("product", "getdetails", userId);
                string[] productItems = output.Trim().Split('\n');
                foreach (string raw in productItems)
                {
                    properties = raw.Trim().Split(' ');

                    PictureBox pic = new PictureBox();
                    pic.Image       = new Bitmap(@"images\product\" + properties[4] + ".jpg");
                    pic.Tag         = properties[1];
                    pic.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pic.Size        = new Size(200, 200);
                    pic.BorderStyle = BorderStyle.Fixed3D;
                    pic.Left        = 150 + (pic.Width + 40) * (nbProduct % 3);
                    pic.Top         = 40 + (pic.Height + 120) * (nbProduct / 3);
                    panel1.Controls.Add(pic);
                    nbProduct++;



                    Label name = new Label();
                    name.Text = properties[0];
                    name.Left = pic.Left;
                    name.Top  = pic.Top + pic.Height;
                    panel1.Controls.Add(name);


                    Label desc = new Label();
                    desc.Text = properties[2];
                    desc.Left = pic.Left;
                    desc.Top  = pic.Top + pic.Height + name.Height;
                    panel1.Controls.Add(desc);


                    Label unitPrice = new Label();
                    if (double.Parse(properties[5].Trim()) != 0)
                    {
                        unitPrice.Text = properties[3];
                    }
                    else
                    {
                        unitPrice.Text = "-";
                    }
                    unitPrice.Font = new Font(this.Font.FontFamily, this.Font.Size, FontStyle.Strikeout | FontStyle.Italic);
                    unitPrice.Left = pic.Left;
                    unitPrice.Top  = pic.Top + pic.Height + name.Height + desc.Height;
                    panel1.Controls.Add(unitPrice);


                    Label  discount = new Label();       //discount means here the price after the discount
                    double price    = double.Parse(properties[3].Trim()) - (double.Parse(properties[5].Trim()) / 100) * double.Parse(properties[3].Trim());
                    discount.Text = price.ToString();
                    discount.Left = pic.Left;
                    discount.Top  = pic.Top + pic.Height + name.Height + desc.Height + unitPrice.Height;
                    panel1.Controls.Add(discount);


                    Label discType = new Label();
                    if (properties[6] != "None")
                    {
                        discType.Text = properties[6];
                    }
                    else
                    {
                        discType.Text = "-";
                    }
                    discType.Tag         = properties[6];
                    discType.Left        = pic.Left;
                    discType.Top         = pic.Top + pic.Height + name.Height + desc.Height + unitPrice.Height + discount.Height;
                    discType.MouseHover += new System.EventHandler(mouseOverTheDiscType);
                    panel1.Controls.Add(discType);
                }

                break;
            }

            case "ShopGroup":
            {
                string   output;
                string[] properties;
                output = MaMall.execlppy("group", "ShopGroup", userId);
                string[] groupItems = output.Trim().Split('\n');
                foreach (string raw in groupItems)
                {
                    properties = raw.Trim().Split(' ');

                    PictureBox pic = new PictureBox();
                    pic.Image       = new Bitmap(@"images\product\" + properties[5] + ".jpg");
                    pic.Tag         = properties[0];
                    pic.SizeMode    = PictureBoxSizeMode.StretchImage;
                    pic.Size        = new Size(200, 200);
                    pic.BorderStyle = BorderStyle.Fixed3D;
                    pic.Left        = 150 + (pic.Width + 40) * (nbGroup % 3);
                    pic.Top         = 40 + (pic.Height + 120) * (nbGroup / 3);
                    panel1.Controls.Add(pic);
                    nbGroup++;



                    Label groupId = new Label();
                    groupId.Text = "id: " + properties[0];
                    groupId.Left = pic.Left;
                    groupId.Top  = pic.Top + pic.Height;
                    panel1.Controls.Add(groupId);


                    Label prodName = new Label();
                    prodName.Text = properties[1];
                    prodName.Left = pic.Left;
                    prodName.Top  = pic.Top + pic.Height + groupId.Height;
                    panel1.Controls.Add(prodName);


                    Label qty = new Label();
                    qty.Text = "qty: " + properties[2];
                    qty.Left = pic.Left;
                    qty.Top  = pic.Top + pic.Height + groupId.Height + prodName.Height;
                    panel1.Controls.Add(qty);


                    Label dateBuy = new Label();        //discount means here the price after the discount
                    dateBuy.Text = properties[3];
                    dateBuy.Left = pic.Left;
                    dateBuy.Top  = pic.Top + pic.Height + groupId.Height + prodName.Height + qty.Height;
                    panel1.Controls.Add(dateBuy);


                    Label dateExp = new Label();

                    dateExp.Text = "exp:" + properties[4];
                    dateExp.Left = pic.Left;
                    dateExp.Top  = pic.Top + pic.Height + groupId.Height + prodName.Height + qty.Height + dateBuy.Height;
                    panel1.Controls.Add(dateExp);
                }
                break;
            }
            }
        }