public void LoadCategory()
    {
        try
        {
            Session["Cat"] = BLLInvItemsCategory.GetItemCategoryList(null, "Y");

            if (Session["Cat"] != null)
            {
                ddlCategory.DataSource     = Session["Cat"];
                ddlCategory.DataTextField  = "itemsCategoryName";
                ddlCategory.DataValueField = "itemsCategoryID";
                ddlCategory.DataBind();

                ListItem a = new ListItem();
                a.Selected = true;
                a.Text     = "----छान्नुहोस----";
                a.Value    = "0";
                ddlCategory.Items.Insert(0, a);
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = "Error Status";
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
Esempio n. 2
0
    public void LoadCategory()
    {
        try
        {
            Session["RptPoCat"] = BLLInvItemsCategory.GetItemCategoryList(null, "Y");

            if (Session["RptPoCat"] != null)
            {
                ddlCategory_cat.DataSource     = Session["RptPoCat"];
                ddlCategory_cat.DataTextField  = "itemsCategoryName";
                ddlCategory_cat.DataValueField = "itemsCategoryID";
                ddlCategory_cat.DataBind();

                ListItem a = new ListItem();
                a.Selected = true;
                a.Text     = "----छान्नुहोस----";
                a.Value    = "0";
                ddlCategory_cat.Items.Insert(0, a);
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
    private void LoadItemsCategory()
    {
        List <ATTInvItemsCategory> LSTItemsCategory = BLLInvItemsCategory.GetItemCategoryList(null, "Y");

        LSTItemsCategory.Insert(0, new ATTInvItemsCategory(0, "छान्नुहोस्", "", "", ""));
        this.ddlItemCategory.DataTextField  = "ItemsCategoryName";
        this.ddlItemCategory.DataValueField = "ItemsCategoryID";
        this.ddlItemCategory.DataSource     = LSTItemsCategory;
        this.ddlItemCategory.DataBind();
    }
    private void LoadCategory()
    {
        List <ATTInvItemsCategory> lst = BLLInvItemsCategory.GetItemCategoryList(null, null);

        ATTInvItemsCategory obj = new ATTInvItemsCategory();

        obj.ItemsCategoryName = "----छान्नुहोस----";
        obj.ItemsCategoryID   = -1;
        lst.Insert(0, obj);

        ddlCategory.DataSource = lst;
        ddlCategory.DataBind();
    }
Esempio n. 5
0
 private void LoadItemCategory()
 {
     try
     {
         List <ATTInvItemsCategory> lstItemCategory = BLLInvItemsCategory.GetItemCategoryList(null, "Y", "Y", true);
         Session["Item_ItemCategory"]             = lstItemCategory;
         this.DDLItemsCategory_Rqd.DataSource     = lstItemCategory;
         this.DDLItemsCategory_Rqd.DataTextField  = "ItemsCategoryName";
         this.DDLItemsCategory_Rqd.DataValueField = "ItemCategoryID";
         this.DDLItemsCategory_Rqd.DataBind();
     }
     catch (Exception ex)
     {
         this.lblStatus.Text = ex.Message;
     }
 }
 void LoadItemsCategory()
 {
     try
     {
         List <ATTInvItemsCategory> lstItemsCategory = BLLInvItemsCategory.GetItemCategoryList(null, "Y");
         lstItemsCategory.Insert(0, (new ATTInvItemsCategory(0, "छान्नुहोस", "", "", "")));
         Session["ItemsCategory"]                 = lstItemsCategory;
         this.ddlItemsCategory_Rqd.DataSource     = lstItemsCategory;
         this.ddlItemsCategory_Rqd.DataTextField  = "ITEMSCATEGORYNAME";
         this.ddlItemsCategory_Rqd.DataValueField = "ITEMSCATEGORYID";
         this.ddlItemsCategory_Rqd.DataBind();
     }
     catch (Exception ex)
     {
         this.lblStatusMessage.Text = ex.Message;
         this.programmaticModalPopup.Show();
     }
 }
    void LoadItemCategoryList()
    {
        try
        {
            chkICActive.Checked  = true;
            chkISCActive.Checked = true;

            Session["ItemCategory_List"]        = BLLInvItemsCategory.GetItemCategoryList(null, null); //data select from database and assign to Session variable
            this.lstItemCategory.DataSource     = (List <ATTInvItemsCategory>)Session["ItemCategory_List"];
            this.lstItemCategory.DataValueField = "ItemsCategoryID";
            this.lstItemCategory.DataTextField  = "ItemsCategoryName";
            this.lstItemCategory.DataBind();
        }
        catch (Exception ex)
        {
            this.lblStatus.Text = ex.Message;
        }
    }
    private void LoadItemCategory()
    {
        try
        {
            List <ATTInvItemsCategory> lstItemCategory = BLLInvItemsCategory.GetItemCategoryList(null, null);

            ATTInvItemsCategory obj = new ATTInvItemsCategory();

            obj.ItemsCategoryID   = -5;
            obj.ItemsCategoryName = "--- छान्नुहोस् ---";

            lstItemCategory.Insert(0, obj);
            Session["Item_ItemCategory"]        = lstItemCategory;
            this.DDLItemCategory.DataSource     = lstItemCategory;
            this.DDLItemCategory.DataTextField  = "ItemsCategoryName";
            this.DDLItemCategory.DataValueField = "ItemsCategoryID";

            this.DDLItemCategory.DataBind();
        }
        catch (Exception ex)
        {
            this.lblStatus.Text = ex.Message;
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.txtItemCategoryName_Rqd.Text == "")
        {
            this.lblStatusMessage.Text = "Please enter item category name.";
            this.programmaticModalPopup.Show();
            this.lblStatus.Focus();
            return;
        }
        ATTInvItemsCategory itemsCategory = (ATTInvItemsCategory)Session["ItemCategory"];

        List <ATTInvItemsCategory> lstall = (List <ATTInvItemsCategory>)Session["ItemCategory_List"];

        if (lstItemCategory.SelectedIndex == -1)
        {
            bool Exists = lstall.Exists(
                delegate(ATTInvItemsCategory ob)
            {
                return(ob.ItemsCategoryName == txtItemCategoryName_Rqd.Text);
            }

                );

            if (Exists)
            {
                this.lblStatusMessage.Text = "Item category name already exists";
                this.programmaticModalPopup.Show();
                return;
            }
            else
            {
                int count = 0;

                foreach (ATTInvItemSubCategory varNew in itemsCategory.LstItemSubCategory)
                {
                    foreach (ATTInvItemsCategory var in lstall)
                    {
                        int index = var.LstItemSubCategory.FindIndex(
                            delegate(ATTInvItemSubCategory ob)
                        {
                            return(ob.ItemsSubCategoryName == varNew.ItemsSubCategoryName);
                        }
                            );
                        if (index >= 0)
                        {
                            count++;
                        }
                    }
                }

                if (count > 0)
                {
                    this.lblStatusMessage.Text = "Already Exists";
                    this.programmaticModalPopup.Show();
                    return;
                }
                else
                {
                    itemsCategory.Active            = (chkICActive.Checked ? "Y" : "N");
                    itemsCategory.EntryBy           = ((ATTUserLogin)Session["Login_User_Detail"]).UserName;
                    itemsCategory.ItemsCategoryName = txtItemCategoryName_Rqd.Text;
                    if (lstItemCategory.SelectedIndex >= 0)
                    {
                        itemsCategory.Action = "E";
                    }
                    else
                    {
                        itemsCategory.Action = "A";
                    }

                    if (BLLInvItemsCategory.AddUpdateItemCategory(itemsCategory))
                    {
                        this.lblStatusMessage.Text = "Information Saved";
                        this.programmaticModalPopup.Show();
                    }
                    else
                    {
                        this.lblStatusMessage.Text = "Information could not be Saved";
                        this.programmaticModalPopup.Show();
                    }
                }
            }
        }
        else
        {
            bool valid = true;
            int indx = lstall.FindIndex(
                delegate(ATTInvItemsCategory ob)
            {
                return(ob.ItemsCategoryName == txtItemCategoryName_Rqd.Text);
            }

                );

            if (indx > 0)
            {
                if (indx != lstItemCategory.SelectedIndex)
                {
                    valid = false;
                }
            }
            if (!valid)
            {
                this.lblStatusMessage.Text = "Item category name already exists";
                this.programmaticModalPopup.Show();
                return;
            }
            else
            {
                int count = 0;

                foreach (ATTInvItemSubCategory varNew in itemsCategory.LstItemSubCategory)
                {
                    for (int i = 0; i < lstall.Count; i++)
                    {
                        if (i != lstItemCategory.SelectedIndex)
                        {
                            int index = lstall[i].LstItemSubCategory.FindIndex(
                                delegate(ATTInvItemSubCategory ob)
                            {
                                return(ob.ItemsSubCategoryName == varNew.ItemsSubCategoryName);
                            }
                                );
                            if (index >= 0)
                            {
                                count++;
                            }
                        }
                    }
                }

                if (count > 0)
                {
                    this.lblStatusMessage.Text = "Already Exists";
                    this.programmaticModalPopup.Show();
                    return;
                }
                else
                {
                    itemsCategory.Active            = (chkICActive.Checked ? "Y" : "N");
                    itemsCategory.EntryBy           = ((ATTUserLogin)Session["Login_User_Detail"]).UserName;
                    itemsCategory.ItemsCategoryName = txtItemCategoryName_Rqd.Text;
                    if (lstItemCategory.SelectedIndex >= 0)
                    {
                        itemsCategory.Action = "E";
                    }
                    else
                    {
                        itemsCategory.Action = "A";
                    }

                    if (BLLInvItemsCategory.AddUpdateItemCategory(itemsCategory))
                    {
                        this.lblStatusMessage.Text = "Information Saved";
                        this.programmaticModalPopup.Show();
                    }
                    else
                    {
                        this.lblStatusMessage.Text = "Information could not be Saved";
                        this.programmaticModalPopup.Show();
                    }
                }
            }
        }



        ClearitemCategory();
    }