示例#1
0
        private void btnWli_search_Click(object sender, EventArgs e)
        {
            if (validateNonRepItem_search())
            {
                Buisness_Logic.nonRepairable_Item           prd    = new Buisness_Logic.nonRepairable_Item();
                Buisness_Logic.nonRepairableItem_repository nrirep = new Buisness_Logic.nonRepairableItem_repository();


                bool x = nrirep.searchWL_Items((string.IsNullOrEmpty(txtwl_code.Text) ? 0 : int.Parse(txtwl_code.Text)), txtwl_name.Text.ToString(), prd);
                if (x)
                {
                    MessageBox.Show("Record found.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtwl_name.Text   = prd.name;
                    txtwl_qty.Text    = prd.qty.ToString();
                    txtwl_price.Text  = prd.price.ToString();
                    txtwl_make.Text   = prd.make.ToString();
                    txtwl_weight.Text = prd.weight.ToString();
                    txtwl_model.Text  = prd.model;
                    txtwl_code.Text   = prd.invID.ToString();

                    picboxWli.SizeMode = PictureBoxSizeMode.StretchImage;

                    MemoryStream ms = new MemoryStream(prd.photo);

                    ms.Read(prd.photo, 0, prd.photo.Length);
                    picboxWli.Image = Image.FromStream(ms);
                }
                else
                {
                    MessageBox.Show("No record found.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#2
0
        private void btnwliUpdate_Click(object sender, EventArgs e)
        {
            if (validateInvUpdate_weightLifting())
            {
                Buisness_Logic.nonRepairableItem_repository nrirepo = new Buisness_Logic.nonRepairableItem_repository();
                Buisness_Logic.nonRepairable_Item           prd     = new Buisness_Logic.nonRepairable_Item();

                int newq = (string.IsNullOrEmpty(txtwl_Newqty.Text) ? 0 : int.Parse(txtwl_Newqty.Text)) + int.Parse(txtwl_qty.Text);
                prd.name   = txtwl_name.Text;
                prd.make   = txtwl_make.Text;
                prd.model  = txtwl_model.Text;
                prd.qty    = newq;
                prd.price  = double.Parse(txtwl_price.Text);
                prd.weight = double.Parse(txtwl_weight.Text);
                prd.invID  = int.Parse(txtwl_code.Text);

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



                if (nrirepo.updateWeightLiftingItems(prd))
                {
                    MessageBox.Show("Record update succesfull.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtwl_qty.Text = prd.qty.ToString();
                }
            }
        }
示例#3
0
        private void btnwlidelete_Click(object sender, EventArgs e)
        {
            int pid;

            pid = int.Parse(txtwl_code.Text);

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

            if (pa.deleteWLI(pid))
            {
                MessageBox.Show("Record delete succesfull.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Record deletion failed.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#4
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;
                }
            }
        }