Esempio n. 1
0
        /// <summary>
        /// @author : khoaht
        /// @createDate : 14/5/2008
        /// </summary>
        /// <param name="scheduleId"></param>
        /// <returns></returns>
        public static DataSet Retrieves(int scheduleId)
        {
            ConnectionFactory Connection = InternalGlobal.MakeConnectionFactory();
            PrWorkstation dworkstation = new PrWorkstation(Connection);

            DataSet ret = null;
            try
            {
                Connection.Open();
                ret = dworkstation.RetrievesWithScheduleId(scheduleId);

            }
            catch (Exception exp)
            {

                throw exp;
            }
            finally
            {
                Connection.Close();
            }

            return ret;
        }
Esempio n. 2
0
        public static Workstation GetWorkstasion(int workstationId)
        {
            Workstation wkt = new Workstation();
            ConnectionFactory Connection = InternalGlobal.MakeConnectionFactory();
            PrWorkstation dworkstation = new PrWorkstation(Connection);

            Connection.Open();
            DataRow dr = dworkstation.Retrieves(workstationId);
            Connection.Close();

            wkt.WorkstationId = (int)dr["WORKSTATION_ID"];
            wkt.WorkstationCode = (string)dr["CODE"];
            wkt.Name= (string)dr["NAME"];
            wkt.Password = (string)dr["PASSWORD"];
            wkt.IPAddress = (string)dr["IP"];
            wkt.UnitManager = (string)dr["UNIT_MANAGER"];
            wkt.Address = (string)dr["ADDRESS"];
            wkt.PhoneNumber = (string)dr["TEL"];
            wkt.AdminName = (string)dr["ADMIN_NAME"];
            wkt.AdminPhone = (string)dr["ADMIN_TEL"];
            wkt.AreaId = (int)dr["AREA_ID"];

            return wkt;
        }
Esempio n. 3
0
 public bool UpdateLog(Workstation workstation)
 {
     PrWorkstation dworkstation = new PrWorkstation(Connection);
     bool update = false;
     try
     {
         Open();
         update = dworkstation.UpdateLog(workstation);
         Commit();
     }
     catch (Exception exp)
     {
         Rollback();
         throw exp;
     }
     finally
     {
         Close();
     }
     return update;
 }
Esempio n. 4
0
        /// <summary>
        /// @author : khoaht
        /// @createDate : 14/7/2008
        /// </summary>
        /// <param name="pWorkstation"></param>
        /// <returns></returns>
        public bool Login(Workstation pWorkstation)
        {
            try
            {
                Open();
                // Login
                PrWorkstation prWorkstation = new PrWorkstation(mcnnFactory);
                // Return if cannot login
                DataSet ds = prWorkstation.Login(pWorkstation);
                if (ds.Tables[0].Rows.Count <= 0)
                    return false;
                // Check match password
                if (!Qtc.Libs.Security.MD5.CompareHash(pWorkstation.Password, (string)ds.Tables[0].Rows[0]["PASSWORD"]))
                    return false;

                // Get workstation info
                pWorkstation.IPAddress = (string) ds.Tables[0].Rows[0]["IP"];
                pWorkstation.WorkstationId = (int) ds.Tables[0].Rows[0]["WORKSTATION_ID"];
                pWorkstation.Name = (string) ds.Tables[0].Rows[0]["NAME"];
                // WRITE LOGIN LOG
                WriteLoginLog(pWorkstation.WorkstationCode);
                return true;
            }
            catch (Exception exp)
            {
                throw exp;
            }
            finally
            {
                Close();
            }

            //return false;
        }
Esempio n. 5
0
 public bool Delete(Workstation workstation)
 {
     PrWorkstation dworkstation = new PrWorkstation(Connection);
     bool delete = false;
     try
     {
         Open();
         delete = dworkstation.Delete(workstation);
         Commit();
     }
     catch (Exception exp)
     {
         Rollback();
         throw exp;
     }
     finally
     {
         Close();
     }
     return delete;
 }
Esempio n. 6
0
 public int Add(Workstation workstation)
 {
     PrWorkstation dworkstation = new PrWorkstation(Connection);
     int workstationId = -1;
     try
     {
         Open();
         workstationId = dworkstation.Create(workstation);
         Commit();
     }
     catch (Exception exp)
     {
         Rollback();
         throw exp;
     }
     finally
     {
         Close();
     }
     return workstationId;
 }
Esempio n. 7
0
        /// <summary>
        /// @author : khoaht
        /// @createDate : 14/7/2008
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public static DataSet SearchUserManager(string p)
        {
            ConnectionFactory Connection = InternalGlobal.MakeConnectionFactory();
            PrWorkstation dworkstation = new PrWorkstation(Connection);

            DataSet ret = null;
            try
            {
                Connection.Open();
                ret = dworkstation.SearchUserManager(p);

            }
            catch (Exception exp)
            {

                throw exp;
            }
            finally
            {
                Connection.Close();
            }

            return ret;
        }
Esempio n. 8
0
        /// <summary>
        /// @author : khoaht
        /// @createDate : 14/7/2009
        /// </summary>
        /// <param name="datetime"></param>
        /// <returns></returns>
        public static DataSet RetrievesLog(DateTime datetime)
        {
            ConnectionFactory Connection = InternalGlobal.MakeConnectionFactory();
            PrWorkstation dworkstation = new PrWorkstation(Connection);

            DataSet ds =new DataSet();
            try
            {
                Connection.Open();
                ds = dworkstation.RetrievesLog(datetime);
            }
            catch (Exception exp)
            {

                throw exp;
            }
            finally
            {
                Connection.Close();
            }

            return ds;
        }