protected void btnSearch_Click(object sender, EventArgs e)
    {
        if (DDLItemCategory.SelectedIndex < 1 && ddlSubCategory.SelectedIndex < 1)
        {
            lblStatusMessage.Text = "Select atleast one Search Criteria";
            programmaticModalPopup.Show();
            return;
        }


        ATTInvItems obj = new ATTInvItems();

        if (DDLItemCategory.SelectedIndex > 0)
        {
            obj.ItemsCategoryID = int.Parse(DDLItemCategory.SelectedValue);
        }
        if (ddlSubCategory.SelectedIndex > 0)
        {
            obj.ItemsSubCategoryID = int.Parse(ddlSubCategory.SelectedValue);
        }

        obj.Active = "Y";

        List <ATTInvItems> LST = BLLInvItems.GetInvItems(obj);

        Session["InvItems"] = LST;

        grdInvOrgItems.DataSource = LST;
        grdInvOrgItems.DataBind();
    }
Ejemplo n.º 2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            List <ATTInvItems> lst = (List <ATTInvItems>)Session["Items"];
            string             active;
            active = chkActive.Checked ? "Y" : "N";
            List <ATTInvItems> lstitems = new List <ATTInvItems>();
            ATTInvItems        objitem  = new ATTInvItems(
                int.Parse((DDLItemCategory_Rqd.SelectedValue).ToString()),
                int.Parse((DDLItemsSubCategory_Rqd.SelectedValue).ToString()),
                0,
                txtItemCD.Text,
                txtItemName_Rqd.Text,
                txtItemShortName.Text,
                int.Parse((DDLItemType_Rqd.SelectedValue).ToString()),
                int.Parse((DDLItemUnit_Rqd.SelectedValue).ToString()),
                active,
                this.User.UserName);                        //"sj");
            ObjectValidation OV = BLLInvItems.Validate(objitem);
            if (OV.IsValid == false)
            {
                this.lblStatus.Text = OV.ErrorMessage;
                return;
            }

            if (lstInvItem.SelectedIndex < 0)
            {
                objitem.Action = "A";
            }
            else
            {
                objitem.Action  = "E";
                objitem.ItemsID = int.Parse((lstInvItem.SelectedValue).ToString());
            }
            lstitems.Add(objitem);
            BLLInvItems.SaveItems(lstitems);
            if (lstInvItem.SelectedIndex < 0 && objitem.Active == "Y")
            {
                lst.Add(objitem);
            }
            else
            {
                lst[this.lstInvItem.SelectedIndex] = objitem;
            }
            this.lblStatusMessage.Text = "Items successfully saved.";
            this.programmaticModalPopup.Show();
            lstInvItem.DataSource     = lst;
            lstInvItem.DataTextField  = "ItemsName";
            lstInvItem.DataValueField = "ItemsID";
            lstInvItem.DataBind();
            ClearControls(1);
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
    protected void ddlSubCategory_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddlSubCategory_rqd.SelectedIndex > 0)
            {
                ATTInvItems obj = new ATTInvItems();
                obj.ItemsCategoryID    = int.Parse(ddlCategory_rqd.SelectedValue);
                obj.ItemsSubCategoryID = int.Parse(ddlSubCategory_rqd.SelectedValue);
                obj.Active             = "Y";


                Session["DakhilaItems"] = BLLInvItems.GetInvItems(obj);

                //Session["DakhilaItems"] = BLLInvOrgItemsPrice.GetOrgInvItemsPrice(9, int.Parse(ddlCategory.SelectedValue), int.Parse(ddlSubCategory.SelectedValue));

                ddlItems_rqd.DataSource     = (List <ATTInvItems>)Session["DakhilaItems"];
                ddlItems_rqd.DataTextField  = "ItemsName";
                ddlItems_rqd.DataValueField = "ItemsID";
                ddlItems_rqd.DataBind();

                ListItem a = new ListItem();
                a.Selected = true;
                a.Text     = "----छान्नुहोस----";
                a.Value    = "0";
                ddlItems_rqd.Items.Insert(0, a);


                ddlItems_rqd.Enabled = true;
            }
            else
            {
                ddlItems_rqd.SelectedIndex = -1;
                ddlItems_rqd.Enabled       = false;
            }

            //txtQty_cat.Text = "";
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
Ejemplo n.º 4
0
 protected void DDLItemsSubCategory_Rqd_SelectedIndexChanged(object sender, EventArgs e)
 {
     ClearControls(3);
     try
     {
         List <ATTInvItemsCategory> lstItemsCategory = (List <ATTInvItemsCategory>)Session["Item_ItemCategory"];
         ATTInvItems obj = new ATTInvItems();
         obj.ItemsCategoryID    = lstItemsCategory[DDLItemCategory_Rqd.SelectedIndex].ItemsCategoryID;
         obj.ItemsSubCategoryID = int.Parse((DDLItemsSubCategory_Rqd.SelectedValue).ToString());
         List <ATTInvItems> lstItems = BLLInvItems.GetInvItems(obj);
         Session["Items"]          = lstItems;
         lstInvItem.DataSource     = lstItems;
         lstInvItem.DataTextField  = "ItemsName";
         lstInvItem.DataValueField = "ItemsID";
         lstInvItem.DataBind();
     }
     catch (Exception ex)
     {
         lblStatus.Text = ex.Message;
     }
 }