예제 #1
0
 public ProductOrdered(MadeToOrder o, string todo)
 {
     InitializeComponent();
     order = o;
     //op = new OrderedProduct();
     type = todo;
     if (type == "edit")
     {
         //op.TransactionId = o.TransactionId;
         sowebsvc = new SOWebSvcClient();
         //op.GetProductInfo();
         op = sowebsvc.GetOrderedProductInfo(o.TransactionId);
         sowebsvc.Close();
     }
     else
     {
         op = new OrderedProduct();
     }
 }
예제 #2
0
        private void btnPOSave_Click(object sender, EventArgs e)
        {
            if (txtPOCloth.Text == "")
            {
                MessageBox.Show("Please provide cloth type.");
            }
            else if (txtPODet.Text == "")
            {
                MessageBox.Show("Please provide the details of the product.");
            }
            else
            {
                sowebsvc = new SOWebSvcClient();
                if (type == "add")
                {
                    //saves order transaction

                    sowebsvc.SaveTransaction(order);
                    //order.SaveTransaction();

                    //gets the rent id
                    SelectList slist = new SelectList();
                    slist.GetMaxOrdersID();
                    DataRow oRow = slist.DTable.Rows[0];

                    //gets the order number
                    order.TransactionId = Int32.Parse(oRow["Max"].ToString());

                    //gets inputs
                    op.TransactionId = order.TransactionId;
                    op.ClothType     = txtPOCloth.Text;
                    op.Details       = txtPODet.Text;
                    op.Chest         = Double.Parse(txtPOChest.Text);
                    op.Waist         = Double.Parse(txtPOWaist.Text);
                    op.Length        = Double.Parse(txtPOLength.Text);
                    //op.SaveInfo();
                    if (sowebsvc.SaveOrderedProductInfo(op))
                    {
                        MessageBox.Show("Transaction Complete!");
                    }
                }
                else
                {
                    //gets inputs
                    op.TransactionId = order.TransactionId;
                    op.ClothType     = txtPOCloth.Text;
                    op.Details       = txtPODet.Text;
                    op.Chest         = Double.Parse(txtPOChest.Text);
                    op.Waist         = Double.Parse(txtPOWaist.Text);
                    op.Length        = Double.Parse(txtPOLength.Text);
                    // op.UpdateInfo();
                    if (sowebsvc.UpdateOrderedProductInfo(op))
                    {
                        MessageBox.Show("Ordered Product Updated!");
                    }
                }

                sowebsvc.Close();

                isDone = true;
                this.Close();
            }
        }