Exemple #1
0
        private static ListViewItem GenerateItem(itemper it)
        {
            string[]     arr = { it.code, it.name, it.supplier, Convert.ToString(it.qty) };
            ListViewItem ret = new ListViewItem(arr);

            return(ret);
        }
Exemple #2
0
        private void listView1_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            itemper tempitem = items_filter[e.Item.Index];

            tempitem.item_checked      = e.Item.Checked;
            items_filter[e.Item.Index] = tempitem;
            items[items.FindIndex(r => r.code == tempitem.code)] = tempitem;
            listView1.SetObjects(items_filter);
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (itemper i in items)
            {
                if (i.item_checked == true)
                {
                    itemper temp = i;
                    chosenits.Add(temp);
                }
            }
            if (comboBox1.SelectedItem != null && chosenits != null)
            {
                string              path;
                string              totalitems = null;
                DataTable           table;
                FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
                DialogResult        result = folderBrowserDialog1.ShowDialog();
                if (result == DialogResult.OK)
                {
                    try
                    {
                        string okk = folderBrowserDialog1.SelectedPath;

                        path = okk + "//" + DateTime.Today.ToString("dd-MM-yyyy") + "اذن صرف " + comboBox1.Text + ".pdf";
                        foreach (itemper i in chosenits)
                        {
                            totalitems = i.code + "&&++" + Convert.ToString(i.qty) + "++&&";
                        }
                        table = ConvertListToDataTable(chosenits);

                        SqlConnection conn = new SqlConnection(util.GetConnectionString());
                        SqlCommand    cmd  = new SqlCommand("Insert into Permit (date, items,clientname) Values ('" + textBox1.Text + "' ,'" + totalitems + "', N'" + comboBox1.Text + "' )", conn);
                        conn.Open();
                        cmd.ExecuteNonQuery();
                        conn.Close();

                        ExportDataTableToPdf(table, path, "Fady Co.,");
                        this.Dispose();
                    }
                    catch
                    {
                    }
                }
            }
        }
Exemple #4
0
 private void listView1_CellEditFinished(object sender, BrightIdeasSoftware.CellEditEventArgs e)
 {
     try
     {
         itemper tempitem = items_filter[listView1.SelectedIndex];
         if (e.Column.Text == "Quantity")
         {
             string test = Convert.ToString(e.NewValue);
             tempitem.qty = test;
             items_filter[listView1.SelectedIndex] = tempitem;
             int index = items.FindIndex(r => r.code == tempitem.code);
             items[index] = tempitem;
         }
     }
     catch
     {
         MessageBox.Show("Editing error");
     }
 }
Exemple #5
0
        private void Permit_Load(object sender, EventArgs e)
        {
            textBox1.Enabled = false;
            textBox1.Text    = monthCalendar1.SelectionRange.Start.ToString("dd/MM/yyyy");
            SqlConnection conn   = new SqlConnection(util.GetConnectionString());
            string        query  = "Select * from Item";
            string        query2 = "Select * from Client";

            SqlCommand cmdq = new SqlCommand(query, conn);
            SqlCommand cmd2 = new SqlCommand(query2, conn);

            SqlDataReader rdr, rdr2;

            listView1.CheckBoxes             = true;
            listView1.View                   = View.Details;
            listView1.GridLines              = true;
            listView1.FullRowSelect          = true;
            listView1.AlwaysGroupBySortOrder = System.Windows.Forms.SortOrder.None;

            try
            {
                conn.Open();
                rdr = cmdq.ExecuteReader();

                while (rdr.Read())
                {
                    itemper itm = new itemper(rdr.GetString(0), rdr.GetString(1), rdr.GetString(2), Convert.ToString(0));
                    items.Add(itm);
                }
                rdr.Close();

                rdr2 = cmd2.ExecuteReader();
                while (rdr2.Read())
                {
                    cli.Add(new cx(rdr2.GetInt32(0), rdr2.GetString(1), (float)rdr2.GetDouble(2), rdr2.GetString(3), (float)rdr2.GetDouble(4), (float)rdr2.GetDouble(5), rdr2.GetString(6), rdr2.GetString(7), rdr2.GetString(8)));
                }
                rdr2.Close();
                items_filter = items;
                listView1.SetObjects(items_filter);

                AutoCompleteStringCollection codecollection = new AutoCompleteStringCollection();

                foreach (cx c in cli)
                {
                    codecollection.Add(c.cname);
                    comboBox1.Items.Add(c.cname);
                }


                comboBox1.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                comboBox1.AutoCompleteMode         = AutoCompleteMode.Append;
                comboBox1.AutoCompleteCustomSource = codecollection;
                comboBox1.DropDownStyle            = ComboBoxStyle.DropDownList;

                conn.Close();
            }
            catch
            {
                MessageBox.Show("Database access error");
            }
        }