public static List <Items> GetItems(string prefixText)
        {
            List <string> ar    = new List <string>();
            IItemMaster   _iMGR = (IItemMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BItemMaster, BusinessProcess.Administration");
            //filling data from database
            int?consumableItemTypeID = null;

            if (System.Web.HttpContext.Current.Session["ConsumableTypeID"] != null)
            {
                consumableItemTypeID = Convert.ToInt32(System.Web.HttpContext.Current.Session["ConsumableTypeID"].ToString());
            }
            // int.TryParse(System.Web.HttpContext.Current.Session["ConsumableTypeID"].ToString(), out consumableItemTypeID);
            DataTable    dataTable = _iMGR.FindItems(prefixText, null, null, DateTime.Now, false);
            List <Items> custItem  = new List <Items>();
            //string[] custItem = new string[dataTable.Rows.Count+1];
            int i = 0;

            foreach (DataRow theRow in dataTable.Rows)//.Select("ItemTypeName <> 'Consumables'"))
            {
                Items item = new Items();
                item.ItemId   = (int)theRow["ItemID"];
                item.ItemName = (string)theRow["ItemName"];
                custItem.Add(item);
            }
            return(custItem);
        }
Ejemplo n.º 2
0
        public static List <string> SearchConsumableItems(string prefixText, int count)
        {
            List <string> ar = new List <string>();

            int consumableItemTypeID = -1;

            int.TryParse(System.Web.HttpContext.Current.Session["ConsumableTypeID"].ToString(), out consumableItemTypeID);
            DateTime issueDate = DateTime.Now;

            DateTime.TryParse(System.Web.HttpContext.Current.Session["SelectedDate"].ToString(), out issueDate);
            int?SCMFlag = null;

            if (System.Web.HttpContext.Current.Session["SCMModule"] != null)
            {
                SCMFlag = 1;
            }
            IItemMaster _iMGR = (IItemMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BItemMaster, BusinessProcess.Administration");
            //DataTable dataTable = _iMGR.FindItems(prefixText, consumableItemTypeID, null, DateTime.Parse(issueDate.ToString("yyyy-MM-dd")), false);
            DataTable dataTable = _iMGR.FindItems(prefixText, consumableItemTypeID, null, DateTime.Parse(issueDate.ToString("dd-MMM-yyyy")), false, SCMFlag); //Bug ID 158...
            string    custItem  = string.Empty;

            foreach (DataRow theRow in dataTable.Rows)
            {
                custItem = AutoCompleteExtender.CreateAutoCompleteItem(theRow["ItemName"].ToString(), String.Format("{0};{1};{2}", theRow["ItemID"], theRow["ItemTypeID"], theRow["SellingPrice"]));

                ar.Add(custItem);
            }

            return(ar);
        }
Ejemplo n.º 3
0
        public static List <string> SearchItems(string prefixText, int count)
        {
            List <string> ar = new List <string>();


            IItemMaster itemManager = (IItemMaster)ObjectFactory.CreateInstance("BusinessProcess.Administration.BItemMaster, BusinessProcess.Administration");

            //filling data from database
            int excludeItemID = -1; //exclude billables

            int.TryParse(System.Web.HttpContext.Current.Session["MainItemType"].ToString(), out excludeItemID);

            int?filterItemID = null;

            if (System.Web.HttpContext.Current.Session["SearchContextKey"].ToString() != "")
            {
                filterItemID = Convert.ToInt32(System.Web.HttpContext.Current.Session["SearchContextKey"].ToString());
            }
            else
            {
                return(ar);
            }
            DataTable dataTable = itemManager.FindItems(prefixText, filterItemID, excludeItemID, null, false);

            string custItem = string.Empty;

            foreach (DataRow theRow in dataTable.Select("ItemTypeName <> 'Billables'")) // double check to remove billables
            {
                custItem = AutoCompleteExtender.CreateAutoCompleteItem(theRow[1].ToString(),
                                                                       String.Format("{0};{1};{2}", theRow["ItemID"], theRow["ItemTypeID"], theRow["ItemTypeName"]));
                //theRow[0], theRow[2], theRow[3]));

                ar.Add(custItem);
            }

            return(ar);
        }