Esempio n. 1
0
        public static string UpdateTcpip1(LTcpip pitems)
        {
            int    i        = 0;
            string id       = "-1";
            Query  _QueryRS = LTcpip.CreateQuery();

            try
            {
                if (LTcpip.FetchByParameter(LTcpip.Columns.Id, Comparison.Equals, pitems.Id).Read())
                {
                    pitems.IsNew = false;
                    pitems.Save();
                    id = _QueryRS.GetMax(LTcpip.Columns.Id).ToString();
                }
            }
            catch (Exception ex)
            {
                id = "-1";
            }
            return(id);
        }
Esempio n. 2
0
        /// <summary>
        /// Hàm thực hiện Insert, Delte, Update TCIP
        /// </summary>
        /// <param name="pitems"></param>
        public static string InsertTCPIP(LTcpip pitems)
        {
            int   i        = 0;
            Query _QueryRS = LTcpip.CreateQuery();

            try
            {
                if (!LTcpip.FetchByParameter(LTcpip.Columns.IPAddress, Comparison.Equals, pitems.IPAddress).Read())
                {
                    pitems.IsNew = true;
                    pitems.Save(i);
                    return(_QueryRS.GetMax(LTcpip.Columns.Id).ToString());
                }
                else
                {
                    return("-1");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }