Beispiel #1
0
    private void Search()
    {
        MST_CategoryBAL balMST_Category = new MST_CategoryBAL();

        rptCategoryList.DataSource = balMST_Category.SelectAll();;
        rptCategoryList.DataBind();
        int Count = rptCategoryList.Items.Count;

        lblCount.Text = Count.ToString();
    }
        public static void FillDropDownListCategoryID(DropDownList ddl)
        {
            MST_CategoryBAL balMST_Category = new MST_CategoryBAL();

            ddl.DataSource     = balMST_Category.SelectComboBox();
            ddl.DataValueField = "CategoryID";
            ddl.DataTextField  = "CategoryName";
            ddl.DataBind();
            ddl.Items.Insert(0, new ListItem("---Select Category Name---", "-99"));
        }
    private void FillControls(Int32 CategoryID)
    {
        //lblPageHeader.Text = CV.PageHeaderEdit + " Category";

        MST_CategoryBAL balMST_Category = new MST_CategoryBAL();
        MST_CategoryENT entMST_Category = new MST_CategoryENT();

        entMST_Category = balMST_Category.SelectPK(CategoryID);

        if (!entMST_Category.CategoryName.IsNull)
        {
            txtCategoryName.Text = entMST_Category.CategoryName.Value.ToString();
        }
    }
Beispiel #4
0
 protected void rptCategoryList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "DeleteRecord" && e.CommandArgument != null)
     {
         try
         {
             MST_CategoryBAL balMST_Category = new MST_CategoryBAL();
             balMST_Category.Delete(Convert.ToInt32(e.CommandArgument));
         }
         catch (Exception ex)
         {
             pnlAlert.Visible = true;
             lblMsg.Text      = ex.Message;
         }
         finally
         {
             Search();
         }
     }
 }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["CategoryID"] == null)
        {
            MST_CategoryENT entMST_Category = new MST_CategoryENT();

            if (txtCategoryName.Text.ToString().Trim() != "")
            {
                entMST_Category.CategoryName = txtCategoryName.Text.ToString().Trim();
            }

            entMST_Category.CreationDate     = DateTime.Now;
            entMST_Category.ModificationDate = DateTime.Now;
            entMST_Category.UserID           = Convert.ToInt32(Session["UserID"]);

            MST_CategoryBAL balMST_Category = new MST_CategoryBAL();
            if (balMST_Category.Insert(entMST_Category))
            {
                pnlAlert.Visible = true;
                lblMessage.Text  = "Data Inserted Successfully.";
                ClearControls();
            }
        }
        else
        {
            MST_CategoryENT entMST_Category = new MST_CategoryENT();
            if (txtCategoryName.Text.ToString().Trim() != "")
            {
                entMST_Category.CategoryName = txtCategoryName.Text.ToString().Trim();
            }
            entMST_Category.CategoryID       = Convert.ToInt32(Request.QueryString["CategoryID"]);
            entMST_Category.ModificationDate = DateTime.Now;
            entMST_Category.UserID           = Convert.ToInt32(Session["UserID"]);
            MST_CategoryBAL balMST_Category = new MST_CategoryBAL();
            if (balMST_Category.Update(entMST_Category))
            {
                Response.Redirect("~/AdminPanel/Master/MST_Category/MST_CategoryList.aspx");
            }
        }
    }