Ejemplo n.º 1
0
        private void GetDetailsById(int itemId)
        {
            item         = new Item();
            purchaseData = new PurchaseData();
            DataSet DS = new DataSet();

            item.ItemId          = itemId;
            item.ItemName        = string.Empty;
            item.ItemDescription = string.Empty;
            item.Flag            = 2;

            DS = purchaseData.GetItemList(item);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                txtItemName.Text   = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ItemName"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ItemName"].ToString();
                txtDesciption.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ItemDescription"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ItemDescription"].ToString();
                dpCategory.ClearSelection();
                if (dpCategory.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["ItemCategory"]).ToString()) != null)
                {
                    dpCategory.Items.FindByValue(Convert.ToInt32(DS.Tables[0].Rows[0]["ItemCategory"]).ToString()).Selected = true;
                }
                dpIsActive.ClearSelection();
                if (DS.Tables[0].Rows[0]["IsActive"].ToString() == "True")
                {
                    dpIsActive.Items.FindByValue("1").Selected = true;
                }
                else
                {
                    dpIsActive.Items.FindByValue("2").Selected = true;
                }

                dpRack.ClearSelection();
                if (dpRack.Items.FindByValue(Convert.ToInt32(DS.Tables[1].Rows[0]["RackId"]).ToString()) != null)
                {
                    dpRack.Items.FindByValue(Convert.ToInt32(DS.Tables[1].Rows[0]["RackId"]).ToString()).Selected = true;
                }
                string rackid = (DS.Tables[1].Rows[0]["RackId"]).ToString();
                loadListBox(rackid);

                List <string> nams = new List <string>();
                foreach (DataRow row in DS.Tables[1].Rows)
                {
                    //lbSection.Items.FindByValue(Convert.ToInt32(DS.Tables[1].Rows[0]["RackSectionId"]).ToString()).Selected = true;
                    nams.Add(row["RackSectionId"].ToString());
                }


                foreach (ListItem li in lbSection.Items)
                {
                    if (nams.Contains(li.Value))
                    {
                        li.Selected = true;
                    }
                }
            }
            btnSubmit.Visible = false;
            btnUpdate.Visible = true;
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
        }
Ejemplo n.º 2
0
        private void GetList()
        {
            item         = new Item();
            purchaseData = new PurchaseData();
            DataSet DS = new DataSet();

            item.Flag            = 0; //Select *
            item.ItemName        = string.Empty;
            item.ItemDescription = string.Empty;

            DS = purchaseData.GetItemList(item);

            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                rpBrandInfo.DataSource = DS;
                rpBrandInfo.DataBind();
            }
        }