Ejemplo n.º 1
0
        private void fr基站隐患_Load(object sender, EventArgs e)
        {
            Def_基站隐患 基站隐患 = new Def_基站隐患(BasedateID);
            基站隐患 = 基站隐患Comend.Get基站隐患ByBasedateID(BasedateID);
            tb基站存在隐患.Text = 基站隐患.B基站存在隐患;

            IsCanModify(IsModify);
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Def_基站隐患 基站隐患 = new Def_基站隐患(BasedateID);
            基站隐患.B基站存在隐患 = tb基站存在隐患.Text;

            基站隐患Comend.UpDate基站隐患(基站隐患);

            SQLExecute.Operate = "用户" + DBUser.CURR_USERID + "更新了基站隐患 ,基站编号:" + 基站隐患.BasedateID;
            SQLExecute.SaveOperate();
            MessageBox.Show("更新成功 !", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="基站隐患"></param>
        public static void Insert基站隐患(Def_基站隐患 基站隐患)
        {
            string sql =
            "INSERT INTO [New基站隐患] " +
            "           ([basedateID] " +
            "           ,[基站存在隐患])" +
            "     VALUES " +
            " ('" + 基站隐患.BasedateID.ToString().Replace("'", "''") + "' " +
            基站隐患.B基站存在隐患.ToString().Replace("'", "''") + "') ";

            SQLExecute.ExecuteNonQuery(sql);
        }
        /// <summary>
        /// 更新(带插入)
        /// </summary>
        /// <param name="基站隐患"></param>
        public static void UpDate基站隐患(Def_基站隐患 基站隐患)
        {
            string InsertSQL =
              "UPDATE [New基站隐患] " +
            "   SET " +
            "      [基站存在隐患]     = '" + 基站隐患.B基站存在隐患.ToString().Replace("'", "''") + "'" +
            " WHERE [basedateID] = '" + 基站隐患.BasedateID.ToString().Replace("'", "''") + "'";

            string UpDateSQL =
            "INSERT INTO [New基站隐患] " +
            "           ([basedateID] " +
            "           ,[基站存在隐患])" +
            "     VALUES " +
            " ('" + 基站隐患.BasedateID.ToString().Replace("'", "''") + "' " +
            " ,'" + 基站隐患.B基站存在隐患.ToString().Replace("'", "''") + "') ";

            string strSQL = null;
            strSQL += InsertSQL;//= string.Format("Update S_RoleDetail set [Power]='{0}'  where [RoleID]='{1}' and ProgramID  ='{2}'", dt.Rows[i][1].ToString().Replace("'", "''"), dt.Rows[0][2].ToString().Replace("'", "''"), dt.Rows[i][0].ToString().Replace("'", "''"));
            strSQL = strSQL + " if @@RowCount=0 ";
            strSQL = strSQL + UpDateSQL;//string.Format("Insert into S_RoleDetail ([RoleID],[ProgramID],[Power]) values ('{0}','{1}','{2}')", dt.Rows[0][2].ToString().Replace("'", "''"), dt.Rows[i][0].ToString().Replace("'", "''"), dt.Rows[i][1].ToString().Replace("'", "''"));

            SQLExecute.ExecuteNonQuery(strSQL);
        }
        /// <summary>
        ///查询
        /// </summary>
        /// <param name="BasedateID"></param>
        /// <returns></returns>
        public static Def_基站隐患 Get基站隐患ByBasedateID(string BasedateID)
        {
            Def_基站隐患 基站隐患 = new Def_基站隐患(BasedateID);

            string sql =
            "SELECT [ID] " +
            "      ,[basedateID] " +
            "      ,[基站存在隐患]"+
            "  FROM  [New基站隐患]  where basedateID = '" + BasedateID.ToString().Replace("'", "''") + "'";

            DataTable dt = new DataTable("基站隐患");
            SQLExecute.Convertdrtodt(SQLExecute.ExecuteReader(sql), dt);
            if (dt.Rows.Count == 0)
            {
                基站隐患 = new Def_基站隐患(BasedateID);
            }
            else
            {
                基站隐患.B基站存在隐患 = dt.Rows[0]["基站存在隐患"].ToString();

            }
            return 基站隐患;
        }