/*private void BindItemsubTypeDropdown(string ItemTypeId)
  * {
  *  try
  *  {
  *      IQCareUtils theUtils = new IQCareUtils();
  *      ddlItemType.DataSource = null;
  *      IMasterList objSubitemType = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
  *      DataTable theDT = objSubitemType.GetSubItemType();
  *      BindFunctions theBind = new BindFunctions();
  *      DataView theDV = new DataView(theDT);
  *      theDV.RowFilter = "ItemTypeId =" + ItemTypeId;
  *      theBind.Win_BindCombo(ddlItemType, theDV.ToTable(), "DrugTypeName", "drugTypeID");
  *  }
  *  catch (Exception err)
  *  {
  *      MsgBuilder theBuilder = new MsgBuilder();
  *      theBuilder.DataElements["MessageText"] = err.Message.ToString();
  *      IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
  *  }
  * }
  */
 private void BindItemList(int subitemId)
 {
     try
     {
         chkItemList.DataSource = null;
         IMasterList   objItemlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
         DataSet       theDS       = objItemlist.GetItemList(subitemId);
         BindFunctions theBind     = new BindFunctions();
         theBind.Win_BindCheckListBox(chkItemList, theDS.Tables[0], "ItemName", "ItemID");
         if (chkItemList.Items.Count == 0)
         {
             chkAll.Checked = false;
         }
     }
     catch (Exception err)
     {
         MsgBuilder theBuilder = new MsgBuilder();
         theBuilder.DataElements["MessageText"] = err.Message.ToString();
         IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
     }
 }
Exemplo n.º 2
0
        private void BindItemList(int itemTypeId, int subitemId, int Programid)
        {
            try
            {
                chkItemList.DataSource = null;
                IMasterList objItemlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
                // drglbItemList = objItemlist.GetItemList(itemTypeId, subitemId);
                DataSet theDS = objItemlist.GetItemList(itemTypeId, subitemId, Programid);
                theItemListDT = theDS.Tables[0];
                theItemList   = theDS.Tables[1];

                //DataView theDV = new DataView(theItemList);
                //theDV.RowFilter = "ItemTypeID ="+ itemTypeId.ToString();

                if (theItemList.Rows.Count > 0)
                {
                    chkPrg.Enabled = true;
                }
                else
                {
                    chkPrg.Enabled = false;
                }

                BindFunctions theBind = new BindFunctions();
                theBind.Win_BindCheckListBox(chkItemList, theItemList, "ItemName", "ItemID");
                //for (int i = 0; i < drglbItemList.Rows.Count; i++)
                //{
                //    if (drglbItemList.Rows[i]["MappedItem"].ToString() == "True")
                //    {
                //        this.chkItemList.SetItemChecked(i, true);
                //    }
                //}
                for (int i = 0; i < theItemListDT.Rows.Count; i++)
                {
                    for (int j = 0; j < chkItemList.Items.Count; j++)
                    {
                        if (Convert.ToInt32(theItemListDT.Rows[i]["ItemTypeID"]) == itemTypeId && Convert.ToInt32(theItemListDT.Rows[i]["ItemID"]) == Convert.ToInt32((((System.Data.DataRowView)(chkItemList.Items[j])).Row.ItemArray[0]).ToString()) && theItemListDT.Rows[i]["ItemName"].ToString() == chkItemList.GetItemText(chkItemList.Items[j]))
                        {
                            this.chkItemList.SetItemChecked(j, true);
                        }
                    }
                }
                bool IsAllcheck = true;
                for (int i = 0; i < chkItemList.Items.Count; i++)
                {
                    if (chkItemList.GetItemChecked(i) == false)
                    {
                        IsAllcheck = false;
                        break;
                    }
                }
                chkPrg.Checked = IsAllcheck;

                if (chkItemList.Items.Count == 0)
                {
                    chkPrg.Checked = false;
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareWindowMsgBox.ShowWindowConfirm("#C1", theBuilder, this);
            }
        }