示例#1
0
 public Routeloca(Routeloca obj)
 {
     PropertyInfo[] p = obj.GetType().GetProperties();                               // get entity properties
     for (int i = 0; i < (p.Length); i++)
     {
         if (!p[i].PropertyType.Name.Contains("list") && !p[i].Name.Contains("arg"))
             p[i].SetValue(this, p[i].GetValue(obj, null), null);                    // set entity's property values to obj properties
     }
 }
示例#2
0
        private void FetchRoutelocaList(int id, IDBManager dbmgr)
        {
            string qryString;
            Routeloca item = new Routeloca();
            ArrayList list = new ArrayList();
            PropertyInfo[] p = item.GetType().GetProperties();

            switch (_user.plant)
            {
                case "BLN":
                case "TFAC":
                    qryString = "SELECT * FROM viewROUTELOCA_FR rl WHERE rl.NODE_ID = @node_id ORDER BY rl.RM, rl.FZ";
                    break;
                default:
                    qryString = "SELECT * FROM viewROUTELOCA rl WHERE rl.NODE_ID = @node_id ORDER BY rl.RM, rl.FZ";
                    break;
            }

            dbmgr.CreateParameters(1);
            dbmgr.AddParameters(0, "@node_id", id);
            dbmgr.ExecuteReader(CommandType.Text, qryString);

            while (dbmgr.DataReader.Read())
            {
                item = new Routeloca();
                item = (Routeloca)FetchObject(item, p, dbmgr);
                list.Add(item);
            }

            dbmgr.CloseReader();
            _route.routelocalist = list;
        }