Exemplo n.º 1
0
        private void btUpdate_Click(object sender, RoutedEventArgs e)
        {
            IdDialog updateId = new IdDialog("Please enter Id of the field you wish to update:");

            if (updateId.ShowDialog() == true)
            {
                giftaidConnection.Update(conn, cbStatus.Text.ToString(), Convert.ToInt32(updateId.Id));
            }
            else
            {
            }
        }
Exemplo n.º 2
0
        private void btBarcode_Click(object sender, RoutedEventArgs e)
        {
            IdDialog barcodeId = new IdDialog("Please Enter Id of Barcode You wish to generate:");

            try
            {
                Barcode_Generator giftaidBarcodeGenerator = new Barcode_Generator();
                if (File.Exists("Connection.xml"))
                {
                    conn = giftaidConnection.CreateConn("Connection.xml");
                }

                Barcode giftaidBarcode = new Barcode()
                {
                    IncludeLabel   = true,
                    Alignment      = AlignmentPositions.CENTER,
                    LabelPosition  = LabelPositions.BOTTOMCENTER,
                    Width          = 150,
                    Height         = 150,
                    RotateFlipType = RotateFlipType.RotateNoneFlipNone,
                    BackColor      = Color.White,
                    ForeColor      = Color.Black,
                };

                DataSet   ds = new DataSet();
                DataTable dt = new DataTable();

                if (barcodeId.ShowDialog() == true)
                {
                    giftaidConnection.OpenConn(conn);
                    string            sql = "SELECT * FROM giftaid WHERE ID = " + barcodeId.Id + "";
                    NpgsqlDataAdapter da  = new NpgsqlDataAdapter(sql, conn);
                    ds.Reset();
                    da.Fill(ds);
                    dt = ds.Tables[0];

                    giftaidBarcodeGenerator.BarcodePicbox.Image = giftaidBarcode.Encode(TYPE.ITF14, "" + dt.Rows[0][2] + "");
                    giftaidBarcodeGenerator.Show();
                    giftaidConnection.CloseConn(conn);
                }
                else
                {
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Make sure the id of the row entered into the textbox exists in table", "Barcode-Generator", MessageBoxButton.OK, MessageBoxImage.Error);
                giftaidConnection.CloseConn(conn);
            }
        }
Exemplo n.º 3
0
        private void btRemove_Click(object sender, RoutedEventArgs e)
        {
            IdDialog removeId = new IdDialog("Please enter Id of the field you wish to remove:");

            if (removeId.ShowDialog() == true)
            {
                try
                {
                    giftaidConnection.Delete(conn, Convert.ToInt32(removeId.Id));
                }
                catch (Exception msg)
                {
                    MessageBox.Show(msg.ToString());
                    giftaidConnection.OpenConn(conn);
                }
            }
        }