示例#1
0
    private void createBuyerId()
    {
        bool successful = false;

        // Call service
        BuyerService.serBuyer createbuyerId = new BuyerService.serBuyer();
        DataSet dataset = createbuyerId.Buyer_CreateBuyerId();

        try
        {
            foreach (DataRow dr in dataset.Tables[0].Rows)
            {
                successful = true;
                string s = dr["CreateBuyerId"].ToString();

                lbBuyerId.Text = dr["CreateBuyerId"].ToString();
            }
        }
        catch
        {
        }
        if (successful)
        {
            //lbPBIErrorMessage.Text = "Task Id created";
            // New  list must be created
            //loadTask();
            // Initial values to screen
            //setInitialValues();
        }
        else
        {
            lbBuyerErrors.Text = "Problem with customer number";
        }
    }
    private void fromEntityToScreen()
    {
        int BuyerId = 0;
        if (Session["buyerId"] != null)
            BuyerId = Convert.ToInt32(Session["buyerId"].ToString());

        BuyerService.serBuyer general = new BuyerService.serBuyer();
        DataSet dataset = general.Buyer_GetGeneral(BuyerId);
        
        //dataset = DatasetCustomer.CustomerSelectOne(CustomerNumber);
        // Create a DataSet from Database

        if (dataset.Tables[0].Rows.Count > 0)
        {
            // Move data from data row to screen 
            DataRow dr = dataset.Tables[0].Rows[0];

            tbfirstnameBuyer.Text = dr["firstname"].ToString();
            tblastnameBuyer.Text = dr["lastname"].ToString();
            tbUserId.Text = dr["buyeruserId"].ToString();
            tbPassword.Text = dr["password"].ToString();
            tbCurrentPasword.Text = dr["password"].ToString();
            //tbNewPssword.Text = dr["discountRate"].ToString();
            //ddldob_monthBuyer.Text = dr["termsOfDeliveryCode"].ToString();
            tbEmail.Text = dr["emailAddress"].ToString();
            //tbAddAnEmail.Text = dr["lastNameOfContactPerson"].ToString();

        }
        else
        {
            setInitialValues();
            lbGneralError.Text = "No Customer selected";
        }
    }
    protected void btSearchOrderNum_Click(object sender, EventArgs e)
    {
        int orderNumber;

        // Take customNumber from screen
        try
        {
            orderNumber = Int32.Parse(tbSearchOrderNum.Text);
        }
        catch
        {
            orderNumber = 0;
        }
        // Load the productbacklog according to productbacklogid
        lbPurchaseErr.Text = "";                          // Empty error text
        //System.Data.DataSet dataset = null;         // Null dataSet is default

        BuyerService.serBuyer orderdetails = new BuyerService.serBuyer();
        DataSet dataset = orderdetails.Buyer_GetPurchase(orderNumber);

        // Create a DataSet from Database

        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewPurchases.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewPurchases.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewPurchases.DataBind();
            // Set control visible

            GridViewPurchases.Visible = true;
        }
        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }
    }
    protected void ListBoxMerchant_SelectedIndexChanged(object sender, EventArgs e)
    {
        string bizname;

        // Take customNumber from screen
        try
        {
            bizname = ListBoxMerchant.Text;
        }
        catch
        {
            bizname = "";
        }
        // Load the productbacklog according to productbacklogid
        lbPurchaseErr.Text = "";                          // Empty error text
        //System.Data.DataSet dataset = null;         // Null dataSet is default

        BuyerService.serBuyer merchant = new BuyerService.serBuyer();
        DataSet dataset = merchant.Buyer_GetPurchaseByMerchantbname(bizname);

        // Create a DataSet from Database

        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewPurchases.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewPurchases.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewPurchases.DataBind();
            // Set control visible

            GridViewPurchases.Visible = true;
        }
        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }
    }
    protected void btSearchOrderNum_Click(object sender, EventArgs e)
    {
        int orderNumber;

        // Take customNumber from screen
        try
        {
            orderNumber = Int32.Parse(tbSearchOrderNum.Text);
        }
        catch
        {
            orderNumber = 0;
        }
        // Load the productbacklog according to productbacklogid
        lbPurchaseErr.Text = "";                          // Empty error text
        //System.Data.DataSet dataset = null;         // Null dataSet is default

        BuyerService.serBuyer orderdetails = new BuyerService.serBuyer();
        DataSet dataset = orderdetails.Buyer_GetPurchase(orderNumber);
        // Create a DataSet from Database

        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewPurchases.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewPurchases.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewPurchases.DataBind();
            // Set control visible

            GridViewPurchases.Visible = true;
        }
        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }
    }
    private void fromEntityToScreen()
    {
        int BuyerId = 0;

        if (Session["buyerId"] != null)
        {
            BuyerId = Convert.ToInt32(Session["buyerId"].ToString());
        }

        BuyerService.serBuyer general = new BuyerService.serBuyer();
        DataSet dataset = general.Buyer_GetGeneral(BuyerId);

        //dataset = DatasetCustomer.CustomerSelectOne(CustomerNumber);
        // Create a DataSet from Database

        if (dataset.Tables[0].Rows.Count > 0)
        {
            // Move data from data row to screen
            DataRow dr = dataset.Tables[0].Rows[0];

            tbfirstnameBuyer.Text = dr["firstname"].ToString();
            tblastnameBuyer.Text  = dr["lastname"].ToString();
            tbUserId.Text         = dr["buyeruserId"].ToString();
            tbPassword.Text       = dr["password"].ToString();
            tbCurrentPasword.Text = dr["password"].ToString();
            //tbNewPssword.Text = dr["discountRate"].ToString();
            //ddldob_monthBuyer.Text = dr["termsOfDeliveryCode"].ToString();
            tbEmail.Text = dr["emailAddress"].ToString();
            //tbAddAnEmail.Text = dr["lastNameOfContactPerson"].ToString();
        }
        else
        {
            setInitialValues();
            lbGneralError.Text = "No Customer selected";
        }
    }
示例#7
0
    protected void btIaccept_Click(object sender, EventArgs e)
    {
        BuyerService.serBuyer buyer = new BuyerService.serBuyer();
        DataSet dataset             = buyer.Buyer_GetAll();
        DataRow dr = dataset.Tables[0].NewRow();

        bool successfull = false;

        if (fromScreenToEntity(dr))
        {
            dataset.Tables[0].Rows.Add(dr);
            successfull = buyer.UpdateBuyer(dataset);
        }
        if (successfull)
        {
            lbBuyerErrors.Text = "Registration was accepted";
            //Session["customerNumber"] = tbCustomerNumber.Text;
            //Response.Redirect("CustomerAddress.aspx");
        }
        else
        {
            lbBuyerErrors.Text = "Transaction rolled back";
        }
    }
    protected void ListBoxCategory_SelectedIndexChanged(object sender, EventArgs e)
    {
        string categoryname;

        // Take customNumber from screen
        try
        {
            categoryname = ListBoxCategory.Text;
        }
        catch
        {
            categoryname = "";
        }
        // Load the productbacklog according to productbacklogid
        lbPurchaseErr.Text = "";                          // Empty error text
        //System.Data.DataSet dataset = null;         // Null dataSet is default

        BuyerService.serBuyer category = new BuyerService.serBuyer();
        DataSet dataset = category.Buyer_GetPurchaseByCatname(categoryname);
                // Create a DataSet from Database

        if (dataset != null)
        {
            // A user can select a person from the grid
            GridViewPurchases.AutoGenerateSelectButton = true;
            // Set the DataSet to cotrols DataSource
            GridViewPurchases.DataSource = dataset;
            // Bind values to controls rows and columns
            GridViewPurchases.DataBind();
            // Set control visible

            GridViewPurchases.Visible = true;
        }
        else
        {
            //lbErrorViewPBI.Text = "Sql sentence was not successful.";
        }
    }
    protected void btIaccept_Click(object sender, EventArgs e)
    {

        BuyerService.serBuyer buyer = new BuyerService.serBuyer();
        DataSet dataset = buyer.Buyer_GetAll();
        DataRow dr = dataset.Tables[0].NewRow();

        bool successfull = false;

        if (fromScreenToEntity(dr))
        {
            dataset.Tables[0].Rows.Add(dr);
            successfull = buyer.UpdateBuyer(dataset);
        }
        if (successfull)
        {
            lbBuyerErrors.Text = "Registration was accepted";
            //Session["customerNumber"] = tbCustomerNumber.Text;
            //Response.Redirect("CustomerAddress.aspx");
           
        }
        else
        {
            lbBuyerErrors.Text = "Transaction rolled back";
        }
    }
    private void createBuyerId()
    {
        bool successful = false;
        // Call service
        BuyerService.serBuyer createbuyerId = new BuyerService.serBuyer();
        DataSet dataset = createbuyerId.Buyer_CreateBuyerId();

        try
        {
            foreach (DataRow dr in dataset.Tables[0].Rows)
            {
                successful = true;
                string s = dr["CreateBuyerId"].ToString();

                lbBuyerId.Text = dr["CreateBuyerId"].ToString();
            }
        }
        catch
        {
        }
        if (successful)
        {
            //lbPBIErrorMessage.Text = "Task Id created";
            // New  list must be created
            //loadTask();
            // Initial values to screen
            //setInitialValues();
        }
        else
        {
            lbBuyerErrors.Text = "Problem with customer number";
        }
    }