Пример #1
0
        /// <summary>
        /// 신규 여부를 확인 하고 추가한다.
        /// </summary>
        /// <param name="site"></param>
        /// <param name="i_name"></param>
        /// <returns></returns>
        public static bool isNewList(string site, string i_name)
        {
            bool rtn;

            Function.Db.SQLite db = new Function.Db.SQLite(vari.db_path);

            string sql = string.Format(@"SELECT COUNT(*) cnt
FROM ICO
WHERE SITE = '{0}'
AND I_NAME = '{1}'", site, i_name);



            using (DataSet ds = db.dsExcute_Query(sql))
            {
                rtn = Fnc.obj2int(ds.Tables[0].Rows[0]["cnt"]) < 1;
            }

            //신규 처리
            if (rtn)
            {
                sql = string.Format(@"INSERT INTO ICO ( SITE, I_NAME, DATE )
VALUES ('{0}', '{1}', '{2}' )", site, i_name, Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime));

                db.intExcute_Query(sql);
            }

            return(rtn);
        }
Пример #2
0
        public static bool isNewNotice(string site, string key, string title)
        {
            bool rtn;

            Function.Db.SQLite db = new Function.Db.SQLite(vari.db_path);

            string sql = string.Format(@"SELECT COUNT(*) cnt
FROM Notice
WHERE SITE = '{0}'
AND Key = '{1}'", site, key);

            using (DataSet ds = db.dsExcute_Query(sql))
            {
                rtn = Fnc.obj2int(ds.Tables[0].Rows[0]["cnt"]) < 1;
            }

            //신규 처리
            if (rtn)
            {
                sql = string.Format(@"INSERT INTO Notice ( SITE, Key, Title, DATE )
VALUES ('{0}', '{1}', '{2}', '{3}' )", site, key, title, Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime));

                db.intExcute_Query(sql);
            }

            return(rtn);
        }
Пример #3
0
        public static void PLC_ValueMng_Save(string PLCType, string AddType, DataTable dtMng)
        {
            if (AddType == null || AddType.Equals(string.Empty))
            {
                return;
            }

            Function.Db.SQLite db = new Function.Db.SQLite(sqldb_path);

            try
            {
                db.BeginTransaction();

                string sql = string.Format(@"DELETE FROM PLC_Value_Mng
WHERE PLCTYPE = '{0}'
AND ADDTYPE = '{1}'", PLCType, AddType);

                db.intExcute_Query(sql);

                foreach (DataRow dr in dtMng.Rows)
                {
                    sql = string.Format(@"INSERT INTO PLC_Value_Mng(
PLCType, ADDType, Priority, 
Mng_Type, Address, Address_Length, 
Value, ValueType, Condition, 
isUse, Desc)
VALUES 
( '{0}', '{1}', {2},
'{3}', '{4}', '{5}',
'{6}', '{7}', '{8}',
'{9}', '{10}' )", PLCType, AddType, dr["Priority"],
                                        dr["Mng_Type"], dr["Address"], dr["Address_Length"],
                                        dr["Value"], dr["ValueType"], dr["Condition"],
                                        dr["isUse"], dr["Desc"]);

                    db.intExcute_Query(sql);
                }

                db.CommitTransaction();
            }
            catch
            {
                db.RollBackTransaction();
                throw;
            }
        }
Пример #4
0
        /// <summary>
        /// 사이트에서 심볼을 삭제 처리한다.
        /// </summary>
        /// <param name="site"></param>
        /// <param name="i_name"></param>
        public static void NewList_Del(string site, string i_name)
        {
            Function.Db.SQLite db = new Function.Db.SQLite(vari.db_path);

            string sql = string.Format(@"DELETE FROM ICO 
WHERE SITE = '{0}' AND I_NAME = '{1}'", site, i_name);

            db.intExcute_Query(sql);
        }
Пример #5
0
        /// <summary>
        /// 사이트에 신규 심볼을 추가한다.
        /// </summary>
        /// <param name="site"></param>
        /// <param name="i_name"></param>
        public static void NewList_Add(string site, string i_name)
        {
            Function.Db.SQLite db = new Function.Db.SQLite(vari.db_path);

            string sql = string.Format(@"INSERT INTO ICO ( SITE, I_NAME, DATE )
VALUES ('{0}', '{1}', '{2}' )", site, i_name, Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime));

            db.intExcute_Query(sql);
        }
Пример #6
0
        public static void Address_Set(string PLCType, string AddType, DataTable dtAdd)
        {
            if (AddType == null || AddType.Equals(string.Empty))
            {
                return;
            }

            Function.Db.SQLite db = new Function.Db.SQLite(sqldb_path);

            try
            {
                db.BeginTransaction();

                string sql = string.Format(@"DELETE FROM PLC_Addresses
WHERE PLCTYPE = '{0}'
AND ADDTYPE = '{1}'", PLCType, AddType);

                db.intExcute_Query(sql);

                foreach (DataRow dr in dtAdd.Rows)
                {
                    sql = string.Format(@"INSERT INTO PLC_Addresses(
PLCType, ADDType, Address,
Value, HexValue, Priority,
Desc, Desc2, AddGroup)
VALUES 
( '{0}', '{1}', '{2}',
'{3}', '{4}', {5},
'{6}', '{7}', '{8}' )", PLCType, AddType, dr["Address"],
                                        dr["Value"], dr["hexValue"], dr["Priority"],
                                        dr["Desc"], dr["Desc2"], dr["AddGroup"]);

                    db.intExcute_Query(sql);
                }

                db.CommitTransaction();
            }
            catch
            {
                db.RollBackTransaction();
                throw;
            }
        }