示例#1
0
        private ManuInterface CreateObject(NullHandler oReader)
        {
            ManuInterface oManuInterface = new ManuInterface();

            MapObject(oManuInterface, oReader);
            return(oManuInterface);
        }
示例#2
0
        private ManuInterfaces CreateObjects(IDataReader oReader)
        {
            ManuInterfaces oManuInterfaces = new ManuInterfaces();
            NullHandler    oHandler        = new NullHandler(oReader);

            while (oReader.Read())
            {
                ManuInterface oItem = CreateObject(oHandler);
                oManuInterfaces.Add(oItem);
            }
            return(oManuInterfaces);
        }
示例#3
0
        private void MapObject(ManuInterface oManuInterface, NullHandler oReader)
        {
            BusinessObject.Factory.SetID(oManuInterface, new ID(oReader.GetInt32("Menu_id")));

            oManuInterface.Parent_id  = oReader.GetInt32("Parent_id");
            oManuInterface.Is_parent  = oReader.GetBoolean("Is_parent");
            oManuInterface.Sub_parent = oReader.GetBoolean("Sub_parent");
            oManuInterface.Menu_title = oReader.GetString("Menu_title");
            oManuInterface.IsCheck    = oReader.GetBoolean("IsCheck");
            oManuInterface.NevigetUrl = oReader.GetString("Nav_url");

            BusinessObject.Factory.SetObjectState(oManuInterface, ObjectState.Saved);
        }
示例#4
0
 public ID Save(ManuInterface oManuInterface)
 {
     try
     {
         if (oManuInterface.IsNew)
         {
             BusinessObject.Factory.SetID(oManuInterface, new ID(ExecuteQueryFunctions.GetNewID(_conn, "SELECT MAX(Menu_id) FROM Menu_Table")));
             //ManuInterfaceDA.Insert(conn, oManuInterface);
         }
         //else
         //{
         //    ManuInterfaceDA.Update(conn, oManuInterface);
         //}
         //conn.Close();
         BusinessObject.Factory.SetObjectState(oManuInterface, ObjectState.Saved);
     }
     catch (Exception e)
     {
         throw new ServiceException(e.Message);
     }
     return(oManuInterface.ID);
 }
示例#5
0
        public ManuInterface Get(int id)
        {
            ManuInterface oManuInterface = new ManuInterface();

            try
            {
                string QueryString = "SELECT Menu_Table.*,(SELECT CAST(CASE WHEN Menu_id=1 THEN 1 ELSE 0 END AS bit)) as IsCheck FROM Menu_Table Where Menu_id=" + id + " ORDER BY Menu_id";

                IDataReader reader  = ExecuteQueryFunctions.ExeReader(_conn, QueryString);
                NullHandler oReader = new NullHandler(reader);
                if (reader.Read())
                {
                    oManuInterface = CreateObject(oReader);
                }
                reader.Close();
                _conn.Close();
            }
            catch (Exception e)
            {
                throw new ServiceException(e.Message);
            }

            return(oManuInterface);
        }