Ejemplo n.º 1
0
        public static void Update(Hashtable has)
        {
            string set = "";

            string where = "";
            foreach (DictionaryEntry de in has)
            {
                if (de.Key.ToString() != "id")
                {
                    set += "" + de.Key + "= @" + de.Key + ",";
                }
                else
                {
                    where += "" + de.Key + "= @" + de.Key + "";
                }
            }
            string sql = string.Format("update " + tbname + "  set {0}  where {1}", set.Substring(0, set.Length - 1), where);

            DBUtil.Execute(sql, has);


            //更新datamain
            string sql_mian = "UPDATE T_DataMain  SET [FNumber]='" + has["FNumber"].ToString() + "' WHERE  [FPumpID]='" + has["FPumpID"].ToString() + "' ";

            DBUtil.Execute(sql_mian);
        }
Ejemplo n.º 2
0
        public static void Delete(string id)
        {
            Hashtable has = new Hashtable();

            has["id"] = id;
            DBUtil.Execute("delete from " + tbname + " where id = @id", has);
        }
Ejemplo n.º 3
0
        public static void Delete(string id)
        {
            Hashtable has = new Hashtable();

            has["id"] = id;
            DBUtil.Execute("delete from " + tbname + " where id = @id", has);

            //删除datamain
            string sql_mian = "DELETE FROM T_DataMain  WHERE  [FPumpID]='" + has["FPumpID"].ToString() + "' ";

            DBUtil.Execute(sql_mian);
        }
Ejemplo n.º 4
0
        public static string InsertYALI_MAIN(Hashtable has)
        {
            string id = (has["id"] == null || has["id"].ToString() == "") ? Guid.NewGuid().ToString() : has["id"].ToString();

            has["id"] = id;
            string columns = "";
            string values  = "";

            foreach (DictionaryEntry de in has)
            {
                columns += "" + de.Key + ",";
                values  += "@" + de.Key + ",";
            }
            string sql = string.Format("insert into DATA_YALI_MAIN ( {0} ) values( {1} )", columns.Substring(0, columns.Length - 1), values.Substring(0, values.Length - 1));

            DBUtil.Execute(sql, has);
            return(id);
        }
Ejemplo n.º 5
0
        public static void Update(Hashtable has)
        {
            string set = "";

            string where = "";
            foreach (DictionaryEntry de in has)
            {
                if (de.Key.ToString() != "id")
                {
                    set += "" + de.Key + "= @" + de.Key + ",";
                }
                else
                {
                    where += "" + de.Key + "= @" + de.Key + "";
                }
            }
            string sql = string.Format("update " + tbname + "  set {0}  where {1}", set.Substring(0, set.Length - 1), where);

            DBUtil.Execute(sql, has);
        }
Ejemplo n.º 6
0
        public static string Insert(Hashtable has)
        {
            string id = (has["id"] == null || has["id"].ToString() == "") ? Guid.NewGuid().ToString() : has["id"].ToString();

            //has["id"] = id;
            has.Remove("id");

            string columns = "";
            string values  = "";

            foreach (DictionaryEntry de in has)
            {
                columns += "" + de.Key + ",";
                values  += "@" + de.Key + ",";
            }
            string sql = string.Format("insert into " + tbname + " ( {0} ) values( {1} ) ;SELECT @@Identity", columns.Substring(0, columns.Length - 1), values.Substring(0, values.Length - 1));

            DbConnection con = DBUtil.getConn();
            SqlCommand   cmd = new SqlCommand(sql, (SqlConnection)con);

            if (has != null)
            {
                DBUtil.SetArgs(sql, has, cmd);
            }
            id = cmd.ExecuteScalar().ToString();

            //插入datamain


            if (has["FNumber"] != null || has["FNumber"].ToString() != "")
            {
                string sql_mian = "INSERT INTO T_DataMain ([FPumpID],[FNumber]) VALUES ('" + id + "','" + has["FNumber"].ToString() + "')";
                DBUtil.Execute(sql_mian);
            }

            return(id);
        }
Ejemplo n.º 7
0
        public static void DeleteMarker(int FType, string idList)
        {
            string delSql = @"update a set a.FIsDelete=1 from Map_Marker a,Map_MarkerProperty b where a.ID=b.FMarkerID and a.FIsDelete=0 and FType=" + FType + " and b.FMID in (" + idList + ")";

            DBUtil.Execute(delSql);
        }
Ejemplo n.º 8
0
        public static void DeleteAreaOverlay(string FMapOverlayID, string FMapTempID)
        {
            string sql = string.Format("delete Map_Area_Overlay where FMapOverlayID='{0}' AND FMapTempID='{1}'", FMapOverlayID, FMapTempID);

            DBUtil.Execute(sql);
        }