コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.Title.ToString() == "DYL Motorcycles - Welcome")
            breadcrumb.Visible = false;

        dtCategories = taCategories.SelectAllCategory();
        Repeater1.DataSource = dtCategories;
        Repeater1.DataBind();
    }
コード例 #2
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lblCategoryId = (Label)e.Row.FindControl("lblCategoryId");
                if (lblCategoryId.Text != "")
                {
                    dtCategory = taCategory.SelectCategorybyCategoryId(Convert.ToInt16(lblCategoryId.Text.ToString()));

                    if (dtCategory.Rows.Count > 0)
                        lblCategoryId.Text = dtCategory[0].CategoryName.ToString();
                    else
                        lblCategoryId.Visible = false;

                    LinkButton lbtnDelete = (LinkButton)e.Row.FindControl("lbtnDelete");
                    lbtnDelete.Attributes.Add("OnClick", "return confirm('Are you sure to delete this record?');");
                }
            }
    }
コード例 #3
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            Label lblCategoryId = (Label)e.Row.FindControl("lblCategoryId");
            dtCategory = taCategory.SelectCategorybyCategoryId(Convert.ToInt32(lblCategoryId.Text));
            if (dtCategory.Rows.Count > 0)
                lblCategoryId.Text = dtCategory[0].CategoryName.ToString();

            LinkButton lbtnManageSetCode = (LinkButton)e.Row.FindControl("lbtnManageSetCode");

            if (lbtnManageSetCode.Text == null || lbtnManageSetCode.Text == "")
                lbtnManageSetCode.Text = "Include in this Set";
            else
                lbtnManageSetCode.Text = "Remove from this Set";

        }
    }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
            return;

        LoadCompanies();

        if (Request.QueryString["ID"] != null)
        {
            if (Request.QueryString["ID"] == "True")
            {
                lblMsg.Visible = true;
                lblMsg.Text = "Successfully Edited";
            }
        }

        if (Request.QueryString["CategoryId"] != null)
        {
            int CategoryId = Convert.ToInt32(Request.QueryString["CategoryId"]);
            dtCategory = taCategory.SelectCategorybyCategoryId(CategoryId);

            if (dtCategory.Rows.Count > 0)
            {
                DataRow row = dtCategory.Rows[0];
                ddlCompany.Items.FindByValue(row["companyid"].ToString()).Selected = true;
                txtCategory.Text = row["CategoryName"].ToString();

            }
            else
            {
                lblMsg.Text = "No Record Found";
                btnEdit.Visible = false;
                return;
            }
        }
        else
        {
            lblMsg.Text = "No Record Found";
            btnEdit.Visible = false;
            return;
        }
    }
コード例 #5
0
    private void BindData()
    {
        DataTable DT;
        ylib = new ylibWebClass(constr.connect());

        FillWebControlClass FCC = new FillWebControlClass();

        int CompanyId; int SubCategoryId; int CategoryId; int ProductGroupCode;

        #region SetListVariables

        CompanyId = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId"]);
        CategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId"]);
        SubCategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId"]);
        ProductGroupCode = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode"]);

        #endregion

        #region FillDropDownLists

        dtCompany = taCompany.GetData();
        FCC.FillDropDownList(ref ddlCompany, dtCompany, "CompanyName", "CompanyId", true, true, CompanyId.ToString());

        dtCategory = taCategory.SelectCategorybyCompanyId(CompanyId);
        FCC.FillDropDownList(ref ddlCategory, dtCategory, "CategoryName", "CategoryId", true, true, CategoryId.ToString());

        dtSubCategory = taSubCategory.GetDataByCategoryId(CategoryId);
        FCC.FillDropDownList(ref ddlSubCategory, dtSubCategory, "SubCategoryName", "SubCategoryId", true, true, SubCategoryId.ToString());

        dtProductGroup = taProductGroup.GetDataBySubCategoryId(SubCategoryId);
        FCC.FillDropDownList(ref ddlProductGroupCode, dtProductGroup, "ProductGroupDescription", "ProductGroupCode", true, true, ProductGroupCode.ToString());

        #endregion

        #region SetSelectionLabel

        if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode != 0)
            lblGroupLevel.Text = "Product Group";
        else if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0)
            lblGroupLevel.Text = "Sub Category";
        else if (CompanyId != 0 && CategoryId != 0)
            lblGroupLevel.Text = "Category";
        else if (CompanyId != 0)
            lblGroupLevel.Text = "Company";

        #endregion

        #region Set Main Repeater Page Parts

        DT = ylib.GiveDataTable_BySQLStatement("select PagePartName from PageParts ");

        if (DT.Rows.Count > 0)
        {
            if (CompanyId != 0)
            {
                Repeater1.DataSource = DT;
                Repeater1.DataBind();
            }

        }
        else
        {
            lblMsg.Text = "No record found";
            return;
        }

        #endregion
    }
コード例 #6
0
    protected void SelectCategories()
    {
        int CategoryId = Convert.ToInt32(Request.QueryString["CategoryId"]);

        if ((Request.QueryString["CompanyId"] != null) && (Convert.ToInt16(Request.QueryString["CompanyId"]) != 0))
        {
            int CompanyId = Convert.ToInt32(Request.QueryString["CompanyId"]);
            dtCategory = taCategory.SelectCategorybyCompanyId(CompanyId);

            ddlCompany.Items.FindByValue(CompanyId.ToString()).Selected = true;

            ddlCategory.DataSourceID = null;
            ddlCategory.DataSource = dtCategory;
            ddlCategory.DataTextField = dtCategory.Columns[1].ToString();
            ddlCategory.DataValueField = dtCategory.Columns[0].ToString();
            ddlCategory.DataBind();

            if ((Request.QueryString["CategoryId"] != null) && (Convert.ToInt16(Request.QueryString["CategoryId"]) != 0))
            {
                ddlCategory.Items.FindByValue(Request.QueryString["CategoryId"]).Selected = true;

            }
            else
                ddlCategory.Items.Insert(0, new ListItem("Please Select", ""));
        }
        else
            ddlCategory.Items.Insert(0, new ListItem("Please Select", ""));
    }
コード例 #7
0
    private void BindData()
    {
        int SectionCode = 0;
        FillWebControlClass FCC = new FillWebControlClass();

        ylib = new ClassP.ylibWebClass(constr.connect());

        lblGroupLevel.Text = Request.QueryString["lblGroupLevel"];

        int CompanyId ;        int SubCategoryId ;        int CategoryId;        int ProductGroupCode ;

        #region SetListVariables

        SectionCode = StringOperation.QueryStringInt16Value(Request.QueryString["SectionCode"]);
        CompanyId = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId"]);
        CategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId"]);
        SubCategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId"]);
        ProductGroupCode = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode"]);

        #region Write Cookies

        if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode != 0)
        {
            Response.Cookies["ProductGroupCode"].Value=ProductGroupCode.ToString();
            Response.Cookies["ProductGroupCode"].Expires=DateTime.Now.AddDays(1);
        }
        else if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0)
        {
            Response.Cookies["SubCategoryId"].Value=SubCategoryId.ToString();
            Response.Cookies["SubCategoryId"].Expires=DateTime.Now.AddDays(1);
        }
        else if (CompanyId != 0 && CategoryId != 0)
        {
            Response.Cookies["CategoryId"].Value = CategoryId.ToString();
            Response.Cookies["CategoryId"].Expires = DateTime.Now.AddDays(1);
        }
        else if (CompanyId != 0)
        {
            Response.Cookies["CompanyId"].Value = CompanyId.ToString();
            Response.Cookies["CompanyId"].Expires = DateTime.Now.AddDays(1);
        }

        #endregion

        #endregion

        lblSectionName.Text = ylib.giveValue("select SectionName from   MainPageSection where SectionCode=" + SectionCode);

        #region FillDropDownLists

        dtCompany = taCompany.GetData();
        FCC.FillDropDownList(ref ddlCompany, dtCompany, "CompanyName", "CompanyId",true,true,CompanyId.ToString());

        dtCategory = taCategory.SelectCategorybyCompanyId(CompanyId);
        FCC.FillDropDownList(ref ddlCategory, dtCategory, "CategoryName", "CategoryId", true, true, CategoryId.ToString());

        dtSubCategory = taSubCategory.GetDataByCategoryId(CategoryId);
        FCC.FillDropDownList(ref ddlSubCategory, dtSubCategory, "SubCategoryName", "SubCategoryId", true, true, SubCategoryId.ToString());

        dtProductGroup = taProductGroup.GetDataBySubCategoryId(SubCategoryId);
        FCC.FillDropDownList(ref ddlProductGroupCode, dtProductGroup, "ProductGroupDescription", "ProductGroupCode", true, true, ProductGroupCode.ToString());

        #endregion

        if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode!=0)
            dtProduct = taProduct.GetDataByProductGroupCode(ProductGroupCode);
        else
            dtProduct = taProduct.GetDataByProductGroupCode(0);

        if (dtProduct.Rows.Count > 0)
        {
            GridView1.DataSourceID = null;
            GridView1.DataSource = dtProduct;
            GridView1.DataBind();
        }
        else
        {
            GridView1.DataSourceID = null;
            GridView1.DataSource = dtProduct;
            GridView1.DataBind();
            lblMsg.Text = "No record found";
            return;
        }
    }
コード例 #8
0
    private void BindData()
    {
        FillWebControlClass FCC = new FillWebControlClass();

        int CompanyId ;        int SubCategoryId ;        int CategoryId;        int ProductGroupCode ;

        #region SetListVariables

        CompanyId = StringOperation.QueryStringInt16Value(Request.QueryString["CompanyId"]);
        CategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["CategoryId"]);
        SubCategoryId = StringOperation.QueryStringInt16Value(Request.QueryString["SubCategoryId"]);
        ProductGroupCode = StringOperation.QueryStringInt16Value(Request.QueryString["ProductGroupCode"]);

        #region Write Cookies

        if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode != 0)
        {
            Response.Cookies["ProductGroupCode"].Value = ProductGroupCode.ToString();
            Response.Cookies["ProductGroupCode"].Expires = DateTime.Now.AddDays(1);
        }
        else if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0)
        {
            Response.Cookies["SubCategoryId"].Value = SubCategoryId.ToString();
            Response.Cookies["SubCategoryId"].Expires = DateTime.Now.AddDays(1);
        }
        else if (CompanyId != 0 && CategoryId != 0)
        {
            Response.Cookies["CategoryId"].Value = CategoryId.ToString();
            Response.Cookies["CategoryId"].Expires = DateTime.Now.AddDays(1);
        }
        else if (CompanyId != 0)
        {
            Response.Cookies["CompanyId"].Value = CompanyId.ToString();
            Response.Cookies["CompanyId"].Expires = DateTime.Now.AddDays(1);
        }

        #region GetCookies

        if (Request.Cookies["CompanyId"] != null && CompanyId==0)
            CompanyId = StringOperation.QueryStringInt16Value(Convert.ToString(Request.Cookies["CompanyId"].Value));
        if (Request.Cookies["CompanyId"] != null && Request.Cookies["CategoryId"] != null && CategoryId == 0)
            CategoryId = StringOperation.QueryStringInt16Value(Convert.ToString(Request.Cookies["CategoryId"].Value));
        if (Request.Cookies["CompanyId"] != null && Request.Cookies["CategoryId"] != null && Request.Cookies["SubCategoryId"] != null && SubCategoryId == 0)
            SubCategoryId = StringOperation.QueryStringInt16Value(Convert.ToString(Request.Cookies["SubCategoryId"].Value));
        //if (Request.Cookies["ProductGroupCode"] != null && ProductGroupCode == 0)
        //    ProductGroupCode = StringOperation.QueryStringInt16Value(Convert.ToString(Request.Cookies["ProductGroupCode"].Value));

        #endregion

        #endregion

        #endregion

        #region FillDropDownLists

        dtCompany = taCompany.GetData();
        FCC.FillDropDownList(ref ddlCompany, dtCompany, "CompanyName", "CompanyId",true,true,CompanyId.ToString());

        dtCategory = taCategory.SelectCategorybyCompanyId(CompanyId);
        FCC.FillDropDownList(ref ddlCategory, dtCategory, "CategoryName", "CategoryId", true, true, CategoryId.ToString());

        dtSubCategory = taSubCategory.GetDataByCategoryId(CategoryId);
        FCC.FillDropDownList(ref ddlSubCategory, dtSubCategory, "SubCategoryName", "SubCategoryId", true, true, SubCategoryId.ToString());

        dtProductGroup = taProductGroup.GetDataBySubCategoryId(SubCategoryId);
        FCC.FillDropDownList(ref ddlProductGroupCode, dtProductGroup, "ProductGroupDescription", "ProductGroupCode", true, true, ProductGroupCode.ToString());

        #endregion

        if (CompanyId != 0 && CategoryId != 0 && SubCategoryId != 0 && ProductGroupCode!=0)
            dtProduct = taProduct.GetDataByProductGroupCode(ProductGroupCode);
        else
            dtProduct = taProduct.GetDataByProductGroupCode(0);

        if (dtProduct.Rows.Count > 0)
        {
            GridView1.DataSourceID = null;
            GridView1.DataSource = dtProduct;
            GridView1.DataBind();
        }
        else
        {
            GridView1.DataSourceID = null;
            GridView1.DataSource = dtProduct;
            GridView1.DataBind();
            lblMsg.Text = "No record found";
            return;
        }
    }
コード例 #9
0
 private void BindData()
 {
     if (Request.QueryString["CompanyId"] != null)
     {
         int CompanyId = Convert.ToInt32(Request.QueryString["CompanyId"]);
         dtCategory = taCategory.SelectCategorybyCompanyId(CompanyId);
         ddlCompany.Items.FindByValue(CompanyId.ToString()).Selected = true;
         if (dtCategory.Rows.Count > 0)
         {
             GridView1.DataSourceID = null;
             GridView1.DataSource = dtCategory;
             GridView1.DataBind();
         }
         else
         {
             lblMsg.Text = "No record found";
             return;
         }
     }
 }