Example #1
0
        private void btnEqui_update_Click(object sender, EventArgs e)
        {
            if (validateInvUpdate_Equipment())
            {
                Buisness_Logic.repairableItem_repository rirepo = new Buisness_Logic.repairableItem_repository();
                Buisness_Logic.repairablerable_Items     prd    = new Buisness_Logic.repairablerable_Items();


                prd.name  = txtEqui_name.Text;
                prd.make  = txtEqui_make.Text;
                prd.model = txtEqui_Model.Text;
                prd.price = double.Parse(txtEqui_price.Text);
                prd.invID = int.Parse(txtEqui_code.Text);

                MemoryStream ms = new MemoryStream();
                pictureBoxEqui.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                byte[] photo_prod = ms.ToArray();
                prd.photo = photo_prod;



                if (rirepo.update_Equipments(prd))
                {
                    MessageBox.Show("Record update succesfull.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Example #2
0
        private void btnEqui_search_Click(object sender, EventArgs e)
        {
            if (validateRepItem_search())
            {
                Buisness_Logic.repairablerable_Items     prd   = new Buisness_Logic.repairablerable_Items();
                Buisness_Logic.repairableItem_repository rirep = new Buisness_Logic.repairableItem_repository();


                bool x = rirep.searchEqui_Items((string.IsNullOrEmpty(txtEqui_code.Text) ? 0 : int.Parse(txtEqui_code.Text)), txtEqui_name.Text.ToString(), prd);
                if (x)
                {
                    MessageBox.Show("Record found.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtEqui_name.Text  = prd.name;
                    txtEqui_price.Text = prd.price.ToString();
                    txtEqui_make.Text  = prd.make.ToString();
                    txtEqui_Model.Text = prd.model;
                    txtEqui_code.Text  = prd.invID.ToString();

                    pictureBoxEqui.SizeMode = PictureBoxSizeMode.StretchImage;

                    MemoryStream ms = new MemoryStream(prd.photo);

                    ms.Read(prd.photo, 0, prd.photo.Length);
                    pictureBoxEqui.Image = Image.FromStream(ms);
                }
                else
                {
                    MessageBox.Show("No record found.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #3
0
        private void btnEqui_delete_Click(object sender, EventArgs e)
        {
            int pid;

            pid = int.Parse(txtEqui_code.Text);

            Buisness_Logic.repairableItem_repository pa = new Buisness_Logic.repairableItem_repository();

            if (pa.deleteEqui(pid))
            {
                MessageBox.Show("Record delete succesfull.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Record deletion failed.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
 private void inventory_Load(object sender, EventArgs e)
 {
     if (radio_nonRep.Checked)
     {
         lblQty.Visible    = true;
         lblWeight.Visible = true;
         lblWeight.Refresh();
         lblQty.Refresh();
     }
     else if (radio_repItems.Checked)
     {
         lblQty.Visible    = false;
         lblWeight.Visible = false;
         lblWeight.Refresh();
         lblQty.Refresh();
     }
     Buisness_Logic.repairableItem_repository er = new Buisness_Logic.repairableItem_repository();
     dataGridINV1.DataSource = er.searchEqui_Items();
     this.dataGridINV1.Columns[5].Visible = false;
 }
Example #5
0
        private void btnsave_Int1_Click(object sender, EventArgs e)
        {
            if (validateInvAdd())
            {
                try
                {
                    Buisness_Logic.inventory inv = new Buisness_Logic.inventory();



                    if (radio_nonRep.Checked)
                    {
                        Buisness_Logic.nonRepairable_Item nr = new Buisness_Logic.nonRepairable_Item();

                        //initialize image
                        MemoryStream memt1p1 = new MemoryStream();
                        pictureBox_i2.Image.Save(memt1p1, System.Drawing.Imaging.ImageFormat.Jpeg);
                        byte[] photo_inv = memt1p1.ToArray();
                        nr.name   = txtI1_iname.Text;
                        nr.make   = txtI1_imake.Text;
                        nr.model  = txtI1_imodel.Text;
                        nr.price  = double.Parse(txtI1_iprice.Text);
                        nr.qty    = int.Parse(txtInv_1qty.Text);
                        nr.weight = double.Parse(txtInv1Weight.Text);
                        nr.photo  = photo_inv;

                        Buisness_Logic.nonRepairableItem_repository nrir = new Buisness_Logic.nonRepairableItem_repository();

                        if (nrir.addNonRepairabItems(nr))
                        {
                            MessageBox.Show("Success", "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            txtI1_icode.Text = nr.invID.ToString();
                        }
                        else
                        {
                            MessageBox.Show("Data insertion failed.", "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else if (radio_repItems.Checked)
                    {
                        Buisness_Logic.repairablerable_Items repi = new Buisness_Logic.repairablerable_Items();

                        MemoryStream memt1p1 = new MemoryStream();
                        pictureBox_i2.Image.Save(memt1p1, System.Drawing.Imaging.ImageFormat.Jpeg);
                        byte[] photo_inv = memt1p1.ToArray();
                        repi.name  = txtI1_iname.Text;
                        repi.make  = txtI1_imake.Text;
                        repi.model = txtI1_imodel.Text;
                        repi.price = double.Parse(txtI1_iprice.Text);
                        repi.photo = photo_inv;

                        Buisness_Logic.repairableItem_repository repirep = new Buisness_Logic.repairableItem_repository();



                        if (repirep.addRepItems(repi))
                        {
                            MessageBox.Show("Success", "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            txtI1_icode.Text = repi.invID.ToString();
                        }
                        else
                        {
                            MessageBox.Show("Data insertion failed.", "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }

                    else
                    {
                        MessageBox.Show("Select either Repair or non Repair button.", "Caution", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (Exception EX)
                {
                    MessageBox.Show(EX.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw;
                }
            }
        }