protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)  //if not logged in
            {
                Response.Redirect("/");
            }

            try
            {
                dsOrder = new OrdersDataSet();
                prod_orderTableAdapter daOrder = new prod_orderTableAdapter();

                daOrder.Fill(dsOrder.prod_order);


                if (Request.Cookies["ID"] != null) // Request the cookies which contaions the ID Of thr record that was carried over from the index page
                {
                    id = Convert.ToInt32(Request.Cookies["ID"].Value);
                }
                if (Request.Cookies["Action"] != null && Request.Cookies["Action"].Value == "Delete")
                {
                    pnlDeleteConfirm.Visible = true;
                    lblTitle.Text            = "Delete Sale";
                }
                else
                {
                    pnlDeleteConfirm.Visible = false;
                }
            }
            catch { return; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)  //if not logged in
            {
                Response.Redirect("/");
            }

            dsOrder = new OrdersDataSet();
            // on_orderTableAdapter daOrder = new on_orderTableAdapter();
            on_orderCRUDTableAdapter daOrder = new on_orderCRUDTableAdapter();

            daOrder.Fill(dsOrder.on_orderCRUD);
            rows = (Session["criteria"] != null) ? dsOrder.on_orderCRUD.Select(Session["criteria"].ToString()) : dsOrder.on_orderCRUD.Select();
            DisplayOn_Order();
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)  //if not logged in
            {
                Response.Redirect("/");
            }

            try
            {
                dsOrder = new OrdersDataSet();
                on_orderTableAdapter daOrder = new on_orderTableAdapter();
                daOrder.Fill(dsOrder.on_order);
                if (Request.Cookies["ID"] != null) // Request the cookies which contaions the ID Of thr record that was carried over from the index page
                {
                    id = Convert.ToInt32(Request.Cookies["ID"].Value);
                }
            }
            catch { return; }
            if (!IsPostBack)
            {
                if (id != -1)
                {
                    try
                    {
                        DataRow order = dsOrder.on_order.FindByid(id); // Find the related Record and fill the fields in the page with the data

                        if (order != null)
                        {
                            this.txtID.Text                   = order.ItemArray[0].ToString();
                            this.txtInvoiceNumber.Text        = order.ItemArray[1].ToString();
                            this.txtArriveDate.Text           = Convert.ToDateTime(order.ItemArray[2]).ToString("yyyy-MM-dd");
                            this.txtNumberInOrder.Text        = order.ItemArray[3].ToString();
                            this.txtPrice.Text                = order.ItemArray[4].ToString();
                            this.ddlInventoryID.SelectedValue = order.ItemArray[5].ToString();
                            this.ddlProdOrderID.SelectedValue = order.ItemArray[6].ToString();
                        }
                        else
                        {
                            lblStatus.Text = "Please Try Again";
                        }
                    }
                    catch
                    {
                        lblStatus.Text = "Database Error";
                    }
                }
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)  //if not logged in
            {
                Response.Redirect("/");
            }

            try
            {
                dsOrder = new OrdersDataSet();
                prod_orderTableAdapter daOrder = new prod_orderTableAdapter();
                daOrder.Fill(dsOrder.prod_order);
                rows = (Session["criteria"] != null) ? dsOrder.prod_order.Select(Session["criteria"].ToString()) : dsOrder.prod_order.Select();
                DisplayOrder();
            }
            catch (Exception ex)
            {
            }
            //data loaded successfully
        }
Пример #5
0
        static void Main(string[] args)
        {
            // PetShop
            OrdersDataSet      cds = new OrdersDataSet();
            OrdersDataAdapter  cda = new OrdersDataAdapter();
            ProductDataSet     pds = new ProductDataSet();
            ProductDataAdapter pda = new ProductDataAdapter();

            pda.FillByCategoryId(pds, "BIRDS");
            Console.Out.WriteLine(cds.Orders.Rows.Count);
            IEnumerator en = pds.Product.GetEnumerator();

            while (en.MoveNext())
            {
                ProductDataSet.ProductRow row = (ProductDataSet.ProductRow)en.Current;
                Console.Out.WriteLine(row.ProductId + " " + row.CategoryId + " " + row.Name + " " + row.Descn);
            }

            // fill all the records from the permission table.
            string[] columns = { "ShipCity", "Courier" };
            string[] values  = { "Nowhere", "Me" };
            DbType[] types   = { DbType.AnsiString, DbType.AnsiString };
            cda.Fill(cds, columns, values, types);


            Console.Out.WriteLine(cds.Orders.Rows.Count);
            Console.Out.WriteLine(cds.Orders.FindByOrderId(1) != null ? cds.Orders.FindByOrderId(1).OrderId.ToString() : "Nope");
            Console.Out.WriteLine(cds.Orders.FindByOrderId(4) != null ? cds.Orders.FindByOrderId(4).OrderId.ToString() : "Nope");
            Console.In.Read();

            cds.Clear();
            cda.Fill(cds);

            OrdersDataSet.OrdersRow newRow = cds.Orders.NewOrdersRow();
            newRow.OrderDate           = DateTime.Now;
            newRow.ShipAddr1           = "2001 Nowhere";
            newRow.ShipCity            = "Nowhere";
            newRow.ShipState           = "Tx";
            newRow.ShipZip             = "12345";
            newRow.UserId              = "joe";
            newRow.ShipCountry         = "USA";
            newRow.BillAddr1           = "2001 UHUH";
            newRow.BillCity            = "Nowhere";
            newRow.BillState           = "Tx";
            newRow.BillZip             = "12345";
            newRow.UserId              = "yoyDu";
            newRow.BillCountry         = "USA";
            newRow.Courier             = "Me";
            newRow.TotalPrice          = 12.12M;
            newRow.BillToFirstName     = "Yaba";
            newRow.BillToLastName      = "Daba";
            newRow.ShipToFirstName     = "Yoko";
            newRow.ShipToLastName      = "Ono";
            newRow.AuthorizationNumber = 123;
            newRow.Locale              = "Here";
            cds.Orders.AddOrdersRow(newRow);

            Console.In.Read();
            // make some changes and save
            //OrdersDataSet.OrdersRow editRow = cds.Orders.FindByOrderId(19);
            //editRow.BillZip = "33333";
            //editRow.Courier = "USPS";
            cda.Update(cds);

            //Console.In.Read();
            //// reset changes and save


            //Console.In.Read();
            //// Delete row and update
            //OrdersDataSet.OrdersRow deleteRow = cds.Orders.FindByOrderId(20);
            //deleteRow.Delete();
            //cda.Update(cds);
            //Console.In.Read();
        }