protected void ddlItemSubCategory_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (this.ddlItemSubCategory.SelectedIndex > 0)
            {
                this.ddlItem.Enabled = true;
                List <ATTInvOrgItemsKNJ> LSTItems = BLLInvOrgItemsKNJ.SearchItemsKNJ(int.Parse(this.ddlItemCategory.SelectedValue), int.Parse(this.ddlItemSubCategory.SelectedValue));
                //LSTItems.Insert(0, new ATTInvOrgItemsKNJ(0,"छान्नुहोस्"));

                Session["Items"]            = LSTItems;
                this.ddlItem.DataSource     = LSTItems;
                this.ddlItem.DataTextField  = "ItemsDescription";
                this.ddlItem.DataValueField = "PK";
                this.ddlItem.DataBind();
                ListItem a = new ListItem();
                a.Selected = true;
                a.Text     = "छान्नुहोस";
                a.Value    = "0";
                ddlItem.Items.Insert(0, a);
            }
            else
            {
                this.ddlItem.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = "Error Status";
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
    protected void ddlItemsKNJ_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddlItemsKNJ.SelectedIndex > 0)
            {
                int itemType = ((List <ATTInvOrgItemsPrice>)Session["Items"])[ddlItemsKNJ.SelectedIndex - 1].ItemsTypeID;
                if (itemType == 2)
                {
                    ATTInvOrgItemsKNJ obj = new ATTInvOrgItemsKNJ();
                    obj.OrgID              = ((ATTUserLogin)Session["Login_User_Detail"]).OrgID;
                    obj.ItemsCategoryID    = int.Parse(ddlCategory.SelectedValue);
                    obj.ItemsSubCategoryID = int.Parse(ddlSubCategory.SelectedValue);
                    obj.ItemsID            = int.Parse(ddlItemsKNJ.SelectedValue);

                    List <ATTInvOrgItemsKNJ> lstKNJItems = BLLInvOrgItemsKNJ.SearchItemsKNJ(obj);
                    this.grdKNJItems.DataSource = lstKNJItems;
                    this.grdKNJItems.DataBind();
                    Session["KNJItems"] = lstKNJItems;

                    txtQuantiy.ReadOnly = true;
                    Panel1.Visible      = true;
                }
                else
                {
                    txtQuantiy.ReadOnly = false;
                }
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = "Error Status";
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
        txtQuantiy.Text = "";
    }
Ejemplo n.º 3
0
 private void LoadItems()
 {
     try
     {
         List <ATTInvOrgItemsKNJ> LSTItems = BLLInvOrgItemsKNJ.SearchItemsKNJ(null, null);
         //LSTItems.Insert(0, new ATTInvOrgItemsKNJ(0,"छान्नुहोस्"));
         Session["Items"]            = LSTItems;
         this.ddlItem.DataSource     = LSTItems;
         this.ddlItem.DataTextField  = "ItemsDescription";
         this.ddlItem.DataValueField = "PK";
         this.ddlItem.DataBind();
         ListItem a = new ListItem();
         a.Selected = true;
         a.Text     = "---छान्नुहोस---";
         a.Value    = "0";
         ddlItem.Items.Insert(0, a);
     }
     catch (Exception ex)
     {
         this.lblStatusMessage.Text = "Error Status";
         this.lblStatusMessage.Text = ex.Message;
         this.programmaticModalPopup.Show();
     }
 }
    protected void grdItemsTrans_SelectedIndexChanged(object sender, EventArgs e)
    {
        List <ATTInvItemsTransfered> lstItemsTrans = ((List <ATTInvItemsTransfered>)Session["GrdData"]);
        int itemType = lstItemsTrans[grdItemsTrans.SelectedIndex].ItemsTypeID;

        this.ddlCategory.SelectedValue = lstItemsTrans[grdItemsTrans.SelectedIndex].ItemsCategoryID.ToString();


        List <ATTInvItemSubCategory> lst = GetItemSubCategory(int.Parse(ddlCategory.SelectedValue.ToString()));

        Session["SubCat"] = lst;

        ddlSubCategory.DataSource     = lst;
        ddlSubCategory.DataTextField  = "ItemsSubCategoryName";
        ddlSubCategory.DataValueField = "ItemsSubCategoryID";
        ddlSubCategory.DataBind();

        this.ddlSubCategory.SelectedValue = lstItemsTrans[grdItemsTrans.SelectedIndex].ItemsSubCategoryID.ToString();


        LoadDDLItems();
        this.ddlItemsKNJ.SelectedValue = grdItemsTrans.SelectedRow.Cells[5].Text;

        if (itemType == 1)
        {
            this.txtQuantiy.Text = lstItemsTrans[grdItemsTrans.SelectedIndex].Quantity.ToString();
            txtQuantiy.ReadOnly  = false;
        }
        else if (itemType == 2)
        {
            Panel1.Visible = true;

            this.txtQuantiy.Text = "";
            txtQuantiy.ReadOnly  = true;


            ATTInvOrgItemsKNJ obj = new ATTInvOrgItemsKNJ();
            obj.OrgID              = ((ATTUserLogin)Session["Login_User_Detail"]).OrgID;
            obj.ItemsCategoryID    = int.Parse(ddlCategory.SelectedValue);
            obj.ItemsSubCategoryID = int.Parse(ddlSubCategory.SelectedValue);
            obj.ItemsID            = int.Parse(grdItemsTrans.SelectedRow.Cells[5].Text);
            //obj.ItemsTypeID = 2;

            List <ATTInvOrgItemsKNJ> lstKNJItems = BLLInvOrgItemsKNJ.SearchItemsKNJ(obj);
            this.grdKNJItems.DataSource = lstKNJItems;
            this.grdKNJItems.DataBind();
            Session["KNJItems"] = lstKNJItems;

            txtQuantiy.ReadOnly = true;



            //getmatching items checked code goes here

            foreach (GridViewRow var in grdKNJItems.Rows)
            {
                int orgid      = int.Parse(var.Cells[1].Text);
                int catid      = int.Parse(var.Cells[2].Text);
                int subcatid   = int.Parse(var.Cells[3].Text);
                int itemid     = int.Parse(var.Cells[4].Text);
                int itemtypeid = int.Parse(var.Cells[5].Text);
                int seqno      = int.Parse(var.Cells[9].Text);


                List <ATTInvItemsTransfered> lstData = (List <ATTInvItemsTransfered>)Session["ItemsTransfered"];
                bool exists = lstData.Exists(delegate(ATTInvItemsTransfered objkvn)
                {
                    return(objkvn.OrgID == orgid &&
                           objkvn.ItemsCategoryID == catid &&
                           objkvn.ItemsSubCategoryID == subcatid &&
                           objkvn.ItemsID == itemid &&
                           objkvn.ItemsTypeID == itemtypeid &&
                           objkvn.SeqNo == seqno
                           );
                }
                                             );


                ((CheckBox)var.FindControl("chkItems")).Checked = exists;
            }
        }
    }