Ejemplo n.º 1
0
        public static IList <EngineeringType> GetByPrjGuid(string prjGuid)
        {
            IList <EngineeringType> list = new List <EngineeringType>();

            using (pm2Entities entities = new pm2Entities())
            {
                Guid guid = new Guid(prjGuid);
                foreach (var type in from et in entities.PT_PrjInfo_EngineeringType
                         join ct in entities.Basic_CodeType on et.EngineeringType equals ct.TypeCode into ct
                         join cl in entities.Basic_CodeList on et.EngineeringSubType equals(int?) cl.ItemCode into cl
                         where (et.PrjGuid == guid) && (et.EngineeringType == cl.TypeCode)
                         select new { ID = et.ID, PrjGuid = et.PrjGuid, EngineeringType = et.EngineeringType, TypeName = ct.TypeName, EngineeringSubType = et.EngineeringSubType, ItemName = cl.ItemName, Grade = et.Grade })
                {
                    EngineeringType item = new EngineeringType {
                        ID                     = type.ID,
                        PrjGuid                = type.PrjGuid.Value.ToString(),
                        EngineeringTypeID      = type.EngineeringType,
                        EngineeringTypeName    = type.TypeName,
                        EngineeringSubTypeID   = type.EngineeringSubType.Value.ToString(),
                        EngineeringSubTypeName = type.ItemName,
                        Grade                  = type.Grade
                    };
                    list.Add(item);
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        public static void Add(EngineeringType engType, pm2Entities pm2)
        {
            PT_PrjInfo_EngineeringType type = new PT_PrjInfo_EngineeringType {
                ID                 = engType.ID,
                PrjGuid            = new Guid(engType.PrjGuid),
                EngineeringType    = engType.EngineeringTypeID,
                EngineeringSubType = new int?(Convert.ToInt32(engType.EngineeringSubTypeID)),
                Grade              = engType.Grade
            };

            pm2.AddToPT_PrjInfo_EngineeringType(type);
        }