Пример #1
0
        public int DeleteCrossing(string id)
        {
            int ret = -1;

            string strSql = "delete from tb_crossing where ID = " + id;

            MySqlDbHelper dbHelper = new MySqlDbHelper();

            dbHelper.Connect();
            ret = dbHelper.ExecuteNonQuery(strSql);
            dbHelper.Close();
            return(ret);
        }
Пример #2
0
        public int UpdateCrossing(string crossId, string crossName, string id)
        {
            int ret = -1;

            string strSql = "update tb_crossing set CROSSING_ID='" + crossId + "',CROSSING_NAME = '" + crossName + "' where id = " + id;

            MySqlDbHelper dbHelper = new MySqlDbHelper();

            dbHelper.Connect();
            ret = dbHelper.ExecuteNonQuery(strSql);
            dbHelper.Close();
            return(ret);
        }
Пример #3
0
        public int AddCrossing(string crossId, string crossName)
        {
            int ret = -1;

            string strSql = "insert into  tb_crossing(CROSSING_ID, CROSSING_NAME,CREATE_TIME) values('" +
                            crossId + "','" + crossName + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')";

            MySqlDbHelper dbHelper = new MySqlDbHelper();

            dbHelper.Connect();
            ret = dbHelper.ExecuteNonQuery(strSql);
            dbHelper.Close();
            return(ret);
        }
Пример #4
0
        public int UpdateCrossingInfo(string crossing_id, string json, string base64Image)
        {
            MySqlDbHelper dbHelper = new MySqlDbHelper();

            dbHelper.Connect();
            string sqlStr = "update tb_crossing set CROSSING_CONFIG='" + json + "' where CROSSING_ID='" + crossing_id + "'";

            if (!string.IsNullOrEmpty(base64Image))
            {
                sqlStr = "update tb_crossing set CROSSING_CONFIG='" + json + "' ,IMAGE_DATA='" + base64Image + "'  where CROSSING_ID='" + crossing_id + "'";
            }
            int retVal = dbHelper.ExecuteNonQuery(sqlStr);

            dbHelper.Close();
            return(retVal);
        }
Пример #5
0
        public List <CrossingInfo> GetCrossingInfos()
        {
            List <CrossingInfo> mList  = new List <CrossingInfo>();
            StringBuilder       strSql = new StringBuilder();

            strSql.Append("SELECT * from  tb_crossing");
            CrossingInfo model = new CrossingInfo();

            DataSet ds = null;


            MySqlDbHelper dbHelper = new MySqlDbHelper();

            dbHelper.Connect();
            ds = dbHelper.GetDataSet(strSql.ToString());
            dbHelper.Close();



            //DataSet ds = objODPHelper.Query(strSql.ToString(), null);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        model = DataRowToModel(ds.Tables[0].Rows[i]);
                        mList.Add(model);
                    }
                }
                else
                {
                    return(null);
                }
            }
            return(mList);
        }