示例#1
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();
                }
            }
        }