Пример #1
0
        /// <summary>
        /// Method to get all sub modelboms of specific code
        /// </summary>
        /// <param name="code">Unique identifier for a ModelBOM</param>
        /// <returns>Interface to Model Collection Generic of ModelBOMInfo</returns>
        public IList<ModelBOMInfo> GetSubModelBOMByCode(string code)
        {
            IList<ModelBOMInfo> result = dal.GetSubModelBOMByCode(code);
            int rows = (int)result.LongCount();
            while (rows < MAX_SUB_COUNT)
            {
                ModelBOMInfo info = new ModelBOMInfo();
                result.Add(info);
                rows++;
            }

            return result;
        }
Пример #2
0
        /// <summary>
        /// Method to get all alternative items
        /// </summary>
        /// <param name="code">Unique identifier for a ModelBOM</param>
        /// <param name="alternativeItemGroup">alternative item group</param>
        /// <returns>Interface to Model Collection Generic of string</returns>
        public IList<ModelBOMInfo> GetAlternativeItems(string code, string alternativeItemGroup)
        {
            IList<ModelBOMInfo> result = dal.GetAlternativeItems(code, alternativeItemGroup);
            ModelBOMInfo info;

            /*foreach (ModelBOMInfo item in result)
            {
                result.Add(item);
            }*/

            int rows = (int)result.LongCount();
            while (rows < MAX_SUB_COUNT - 1)
            {
                info = new ModelBOMInfo();
                result.Add(info);
                rows++;
            }

            return result;
        }
Пример #3
0
        /// <summary>
        /// Get information on a specific ModelBOM
        /// </summary>
        /// <param name="modelBOMId">Unique identifier for a ModelBOM</param>
        /// <returns>Business Entity representing a ModelBOM</returns>
        public ModelBOMInfo GetModelBOM(long modelBOMId)
        {
            ModelBOMInfo info = new ModelBOMInfo();

            return info;
        }
Пример #4
0
        /// <summary>
        /// Method to get specified ModelBOM's alternative items.
        /// <param name="code">Unique identifier for a ModelBOM</param>
        /// <param name="alternativeItemGroup">Alternative item group for a ModelBOM</param>
        /// </summary>		
        /// <returns>Interface to Model Collection Generic of ModelBOMInfo</returns>
        public IList<ModelBOMInfo> GetAlternativeItems(string code, string alternativeItemGroup)
        {
            IList<ModelBOMInfo> result = new List<ModelBOMInfo>();
            //if (debug)
            //{
            //    //模拟数据,以后变为从ModelBOM表中取得
            //    ModelBOMInfo info = new ModelBOMInfo();
            //    info.Material = "TC0000000002";
            //    result.Add(info);
            //    info = new ModelBOMInfo();
            //    info.Material = "TC0000000003";
            //    result.Add(info);
            //}

            string strSql = "SELECT distinct Component as Material from ModelBOM where Material='" + code + "'";
            strSql += " and Alternative_item_group='" + alternativeItemGroup + "'";

            using (SqlDataReader rdr = SQLHelper.ExecuteReader(SQLHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql, null))
            {
                while (rdr.Read())
                {
                    ModelBOMInfo info = new ModelBOMInfo();
                    info.Material = rdr.GetString(0).Trim();

                    result.Add(info);
                }
            }

            return result;
        }
Пример #5
0
        /// <summary>
        /// Method to get specified ModelBOM's children.
        /// </summary>
        /// <param name="code">Unique identifier for a ModelBOM</param>
        /// <returns>Interface to Model Collection Generic of vs</returns>
        public IList<ModelBOMInfo> GetSubModelBOMByCode(string code)
        {
            IList<ModelBOMInfo> result = new List<ModelBOMInfo>();
            string strSql = "SELECT Component as Material, Material_group, Quantity, Alternative_item_group FROM ModelBOM where Material='" + code + "'";

            using (SqlDataReader rdr = SQLHelper.ExecuteReader(SQLHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql, null))
            {
                while (rdr.Read())
                {
                    ModelBOMInfo info = new ModelBOMInfo();
                    if (!rdr.IsDBNull(0))
                    {
                        info.Material = rdr.GetString(0).Trim();
                    }
                    if (!rdr.IsDBNull(1))
                    {
                        info.Material_group = rdr.GetString(1).Trim();
                    }
                    if (!rdr.IsDBNull(2))
                    {
                        info.Quantity = rdr.GetString(2).Trim();
                    }
                    if (!rdr.IsDBNull(3))
                    {
                        info.Alternative_item_group = rdr.GetString(3).Trim();
                    }

                    result.Add(info);
                }
            }

            return result;
        }
Пример #6
0
        /// <summary>
        /// Method to get specified ModelBOM's children.
        /// </summary>		
        /// <param name="code">Unique identifier for a ModelBOM</param>
        /// <returns>Interface to Model Collection Generic of vs</returns>
        public IList<ModelBOMInfo> GetParentModelBOMByCode(string code)
        {
            IList<ModelBOMInfo> boms = new List<ModelBOMInfo>();
            string strSql = "SELECT distinct(Material), Material_group, Component FROM ModelBOM where Component='" + code + "'";

            using (SqlDataReader rdr = SQLHelper.ExecuteReader(SQLHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql, null))
            {
                while (rdr.Read())
                {
                    ModelBOMInfo info = new ModelBOMInfo();
                    info.Material = rdr.GetString(0).Trim();
                    info.Material_group = rdr.GetString(1).Trim();
                    info.Quantity = rdr.GetString(2).Trim();
                    boms.Add(info);
                }
            }

            return boms;
        }