Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
        connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
        if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER)
        {
            Response.Redirect("../unauthorizedaccess.aspx");
        }

        if (!(IsPostBack))
        {
            if (Session["XMLFile"] != null)
            {
                hdnXMLFileName.Value = Session["XMLFile"].ToString().Trim();
            }

            BrandsTransaction b = new BrandsTransaction();
            lstBrandsCarried.DataSource     = b.GetAllBrands(connstring);
            lstBrandsCarried.DataValueField = "BrandId";
            lstBrandsCarried.DataTextField  = "BrandName";
            lstBrandsCarried.DataBind();

            ItemsCarriedTransaction i = new ItemsCarriedTransaction();
            lstItemsCarried.DataSource     = i.GetAllItemsCarried(connstring);
            lstItemsCarried.DataValueField = "ItemNo";
            lstItemsCarried.DataTextField  = "ItemsCarried";
            lstItemsCarried.DataBind();

            ServicesTransaction s = new ServicesTransaction();
            lstServicesOffered.DataSource     = s.GetAllServices(connstring);
            lstServicesOffered.DataValueField = "ServiceId";
            lstServicesOffered.DataTextField  = "ServiceName";
            lstServicesOffered.DataBind();

            LocationsTransaction l = new LocationsTransaction();
            lstLocation.DataSource     = l.GetAllLocations(connstring);
            lstLocation.DataValueField = "LocationId";
            lstLocation.DataTextField  = "LocationName";
            lstLocation.DataBind();

            PCABClassTransaction p = new PCABClassTransaction();
            ddlPCABClass.DataSource     = p.GetAllPCABClass(connstring);
            ddlPCABClass.DataValueField = "PCABClassId";
            ddlPCABClass.DataTextField  = "PCABClassName";
            ddlPCABClass.DataBind();
            ListItem li = new ListItem();
            li.Value = "";
            li.Text  = "-- PCAB Class --";
            ddlPCABClass.Items.Insert(0, li);

            ISOStandard iso = new ISOStandard();
            chkISOStandard_white.DataSource     = iso.GetISOStandard(connstring);
            chkISOStandard_white.DataTextField  = "ISOStandardName";
            chkISOStandard_white.DataValueField = "ISOStandardId";
            chkISOStandard_white.DataBind();
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
        connstring = Client.ConnectionString(HttpContext.Current.Session["clientid"].ToString());
        if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.BUYER)
        {
            Response.Redirect("../unauthorizedaccess.aspx");
        }

        if (!(Page.IsPostBack))
        {
            PageTitle.InnerText = String.Format(Constant.TITLEFORMAT, "Registered Products");
            lblMessage.Text     = "";
            BrandsTransaction   brand = new BrandsTransaction();
            ServicesTransaction serv  = new ServicesTransaction();
            SubCategory         sub   = new SubCategory();

            ddlBrand.DataSource     = brand.GetAllBrands(connstring);
            ddlBrand.DataTextField  = "BrandName";
            ddlBrand.DataValueField = "BrandId";
            ddlBrand.DataBind();
            ListItem lst = new ListItem();
            lst.Text  = "Select Brands";
            lst.Value = "";
            ddlBrand.Items.Insert(0, lst);

            ddlServices.DataSource     = serv.GetAllServices(connstring);
            ddlServices.DataTextField  = "ServiceName";
            ddlServices.DataValueField = "ServiceId";
            ddlServices.DataBind();
            ListItem lst1 = new ListItem();
            lst1.Text  = "Select Services";
            lst1.Value = "";
            ddlServices.Items.Insert(0, lst1);

            ddlSubCategory.DataSource     = sub.GetAllSubCategories(connstring);
            ddlSubCategory.DataTextField  = "SubCategoryName";
            ddlSubCategory.DataValueField = "SubCategoryId";
            ddlSubCategory.DataBind();
            ListItem lst2 = new ListItem();
            lst2.Text  = "Select Sub-category";
            lst2.Value = "";
            ddlSubCategory.Items.Insert(0, lst2);
            dvFooter.Visible = false;
        }
    }
Esempio n. 3
0
    private void PutDataToComboBoxes()
    {
        BrandsTransaction       brands = new BrandsTransaction();
        ItemsCarriedTransaction items  = new ItemsCarriedTransaction();
        LocationsTransaction    loc    = new LocationsTransaction();
        ServicesTransaction     serv   = new ServicesTransaction();
        CategoryTransaction     cat    = new CategoryTransaction();
        SubCategory             sub    = new SubCategory();
        PCABClassTransaction    pcab   = new PCABClassTransaction();
        ISOStandard             iso    = new ISOStandard();

        ddlBrands.DataSource     = brands.GetAllBrands(connstring);
        ddlBrands.DataTextField  = "BrandName";
        ddlBrands.DataValueField = "BrandId";
        ddlBrands.DataBind();
        ListItem lst = new ListItem();

        lst.Text  = "Select Brands";
        lst.Value = "";
        ddlBrands.Items.Insert(0, lst);

        ddlItemsCarried.DataSource     = items.GetAllItemsCarried(connstring);
        ddlItemsCarried.DataTextField  = "ItemsCarried";
        ddlItemsCarried.DataValueField = "ItemNo";
        ddlItemsCarried.DataBind();
        ListItem lst1 = new ListItem();

        lst1.Text  = "Select Items";
        lst1.Value = "";
        ddlItemsCarried.Items.Insert(0, lst1);

        ddlLocations.DataSource     = loc.GetAllLocations(connstring);
        ddlLocations.DataTextField  = "LocationName";
        ddlLocations.DataValueField = "LocationId";
        ddlLocations.DataBind();
        ListItem lst2 = new ListItem();

        lst2.Text  = "Select Locations";
        lst2.Value = "";
        ddlLocations.Items.Insert(0, lst2);

        ddlServices.DataSource     = serv.GetAllServices(connstring);
        ddlServices.DataTextField  = "ServiceName";
        ddlServices.DataValueField = "ServiceId";
        ddlServices.DataBind();
        ListItem lst3 = new ListItem();

        lst3.Text  = "Select Services";
        lst3.Value = "";
        ddlServices.Items.Insert(0, lst3);

        ddlCategory.DataSource     = cat.GetCategories(connstring);
        ddlCategory.DataTextField  = "CategoryName";
        ddlCategory.DataValueField = "CategoryId";
        ddlCategory.DataBind();
        ListItem lst4 = new ListItem();

        lst4.Text  = "Select Category";
        lst4.Value = "";
        ddlCategory.Items.Insert(0, lst4);

        ddlSubCategory.DataSource     = sub.GetSubCategoryByCategoryId(connstring, ddlCategory.SelectedItem.Value);
        ddlSubCategory.DataTextField  = "SubCategoryName";
        ddlSubCategory.DataValueField = "SubCategoryId";
        ddlSubCategory.DataBind();
        ListItem lst5 = new ListItem();

        lst5.Text  = "Select Sub-category";
        lst5.Value = "";
        ddlSubCategory.Items.Insert(0, lst5);

        ddlPCAAB.DataSource     = pcab.GetAllPCABClass(connstring);
        ddlPCAAB.DataTextField  = "PCABClassName";
        ddlPCAAB.DataValueField = "PCABClassId";
        ddlPCAAB.DataBind();
        ListItem lst6 = new ListItem();

        lst6.Text  = "PCAB Class";
        lst6.Value = "";
        ddlPCAAB.Items.Insert(0, lst6);

        chkISOStandard.DataSource = iso.GetISOStandard(connstring);
        //chkISOStandard.DataSource = iso.GetISOStandard(connstring);
        chkISOStandard.DataTextField  = "ISOStandardName";
        chkISOStandard.DataValueField = "ISOStandardId";
        chkISOStandard.DataBind();
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FormsAuthenticationHelper.AuthenticateUserWithReturnUrl();
        connstring = HttpContext.Current.Session["ConnectionString"].ToString();
        if (Int32.Parse(Session[Constant.SESSION_USERTYPE].ToString().Trim()) != (int)Constant.USERTYPE.ADMINISTRATOR)
        {
            Response.Redirect("../unauthorizedaccess.aspx");
        }

        if (!(Page.IsPostBack))
        {
            if (Session["SKU"] != null)
            {
                ViewState["SKU"] = Session["SKU"].ToString().Trim();
            }

            BrandsTransaction            brand = new BrandsTransaction();
            ServicesTransaction          serv  = new ServicesTransaction();
            SubCategory                  sub   = new SubCategory();
            CategoryTransaction          c     = new CategoryTransaction();
            ServicesTransaction          s     = new ServicesTransaction();
            UnitOfMeasurementTransaction u     = new UnitOfMeasurementTransaction();

            ddlUnitOfMeasure.DataSource     = u.GetAllUnitsOfMeasurement(connstring);
            ddlUnitOfMeasure.DataTextField  = "UnitOfMeasureName";
            ddlUnitOfMeasure.DataValueField = "UnitOfMeasureID";
            ddlUnitOfMeasure.DataBind();
            ddlUnitOfMeasure.Items.Insert(0, "");


            ddlCategory.DataSource     = c.GetAllCategories(connstring);
            ddlCategory.DataTextField  = "CategoryName";
            ddlCategory.DataValueField = "CategoryId";
            ddlCategory.DataBind();
            ddlCategory.Items.Insert(0, "");

            ddlSubCategory.DataSource     = sub.GetAllSubCategories(connstring);
            ddlSubCategory.DataTextField  = "SubCategoryName";
            ddlSubCategory.DataValueField = "SubCategoryId";
            ddlSubCategory.DataBind();
            ddlSubCategory.Items.Insert(0, "");

            ddlBrand.DataSource     = brand.GetAllBrands(connstring);
            ddlBrand.DataTextField  = "BrandName";
            ddlBrand.DataValueField = "BrandId";
            ddlBrand.DataBind();
            ddlBrand.Items.Insert(0, "");

            ddlServiceType.DataSource     = s.GetAllServices(connstring);
            ddlServiceType.DataTextField  = "ServiceName";
            ddlServiceType.DataValueField = "ServiceId";
            ddlServiceType.DataBind();
            ddlServiceType.Items.Insert(0, "");

            if (ViewState["SKU"] != null)
            {
                ProductsTransaction p  = new ProductsTransaction();
                Product             po = new Product();
                po                             = p.QueryProductBySKU(ViewState["SKU"].ToString().Trim(), connstring);
                txtSKU.Enabled                 = false;
                txtSKU.Text                    = po.SKU.Trim();
                txtItemName.Text               = po.ItemName.Trim();
                txtProductDescription.Text     = po.ProductDescription.Trim();
                ddlUnitOfMeasure.SelectedIndex = ddlUnitOfMeasure.Items.IndexOf(ddlUnitOfMeasure.Items.FindByValue(po.UnitOfMeasure.Trim()));
                ddlCategory.SelectedIndex      = ddlCategory.Items.IndexOf(ddlCategory.Items.FindByValue(po.Category.Trim()));
                ddlSubCategory.SelectedIndex   = ddlSubCategory.Items.IndexOf(ddlSubCategory.Items.FindByValue(po.SubCategory.Trim()));
                ddlBrand.SelectedIndex         = ddlBrand.Items.IndexOf(ddlBrand.Items.FindByValue(po.Brand.Trim()));
                ddlServiceType.SelectedIndex   = ddlServiceType.Items.IndexOf(ddlServiceType.Items.FindByValue(po.ServiceType.Trim()));
                btnDelete.Visible              = true;
            }
        }
    }