Example #1
0
        //private String strcon = ConfigurationManager.ConnectionStrings["hr"].ConnectionString;

        //private dropdownlist ddlTest;

        protected void bindDropDownLists()
        {
            string         myConnection = "dsn=myOracle;uid=system;pwd=oracle1";
            OdbcConnection myConn       = new OdbcConnection(myConnection);

            myConn.Open();
            string      mySelectQuery = "select utl_raw.cast_to_varchar2(UTL_RAW.cast_to_raw(id)) as id, name from servicetype;";
            OdbcCommand command       = new OdbcCommand(mySelectQuery, myConn);

            DataTable       table   = new DataTable();
            OdbcDataAdapter adapter = new OdbcDataAdapter(command);

            adapter.Fill(table);
            ServiceDropDownList.DataSource     = table;
            ServiceDropDownList.DataTextField  = "name";
            ServiceDropDownList.DataValueField = "id";
            ServiceDropDownList.DataBind();

            mySelectQuery = "select utl_raw.cast_to_varchar2(UTL_RAW.cast_to_raw(id)) as id, name from customer;";
            command       = new OdbcCommand(mySelectQuery, myConn);

            table   = new DataTable();
            adapter = new OdbcDataAdapter(command);
            adapter.Fill(table);
            CustomerDropDownList.DataSource     = table;
            CustomerDropDownList.DataTextField  = "name";
            CustomerDropDownList.DataValueField = "id";
            CustomerDropDownList.DataBind();

            myConn.Close();
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            quote = client.GetQuote(Convert.ToInt32(Request.QueryString["quote"]));
            QuoteNumberLabel.Text = quote.ID.ToString();


            customers = client.GetCustomers().ToList();
            parts     = client.GetItems().ToList();

            if (!IsPostBack)
            {
                CustomerDropDownList.DataSource     = customers;
                CustomerDropDownList.DataTextField  = "Name";
                CustomerDropDownList.DataValueField = "ID";
                CustomerDropDownList.DataBind();
                CustomerDropDownList.SelectedValue = quote.CustomerID.ToString();

                PartDropDownList1.DataSource     = parts;
                PartDropDownList1.DataTextField  = "Description";
                PartDropDownList1.DataValueField = "ID";
                PartDropDownList1.DataBind();
                PartDropDownList1.SelectedValue = quote.Items[0].ID.ToString();

                QuantityTextBox1.Text = quote.Items[0].Quantity.ToString();

                LabourPriceTextBox.Text  = quote.LabourPrice.ToString();
                LabourTextArea.InnerText = quote.ServiceDescription;

                ETALabel.Text = quote.PartsETA.ToShortDateString();

                for (int i = 0; i < statusNames.Length; i++)
                {
                    ListItem item = new ListItem(Convert.ToString(statusNames.GetValue(i)), Convert.ToString(i));
                    StatusDropDownList.Items.Add(item);
                }
                StatusDropDownList.SelectedValue = Convert.ToInt32(quote.Status).ToString();
            }


            #region Display appropriate LinkButtons
            switch (quote.Status)
            {
            case SalesSvc.StatusCode.New:
                ApproveLinkButton.Visible = true;
                RejectLinkButton.Visible  = true;
                break;

            case SalesSvc.StatusCode.ApprovedCheckStock:
                CheckStockLinkButton.Visible = true;
                RejectLinkButton.Visible     = true;
                break;

            case SalesSvc.StatusCode.ApprovedBookService:
                BookLinkButton.Visible   = true;
                RejectLinkButton.Visible = true;
                break;

            case SalesSvc.StatusCode.ApprovedNotInStock:
                GetETALinkButton.Visible = true;
                RejectLinkButton.Visible = true;
                break;

            case SalesSvc.StatusCode.ETAPendingApproval:
                ApproveLinkButton.Visible = true;
                RejectLinkButton.Visible  = true;
                break;

            case SalesSvc.StatusCode.ApprovedETA:
                BookLinkButton.Visible   = true;
                BookLinkButton.Text      = "Book & send purchase order";
                RejectLinkButton.Visible = true;
                break;

            case SalesSvc.StatusCode.Booked:
                RejectLinkButton.Visible = true;
                break;

            default:
                break;
            }
            #endregion
        }