예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Def_故障统计 故障统计 = new Def_故障统计(BasedateID);

            故障统计.B发现时间 = tb发现时间.Text;
            故障统计.B故障级别 = tb故障级别.Text;
            故障统计.B故障现象 = tb故障现象.Text;
            故障统计.B故障摘要 = tb故障摘要.Text;
            故障统计.B故障总结 = tb故障总结.Text;
            故障统计.B建议 = tb建议.Text;
            故障统计.B联系电话1 = tb联系电话1.Text;
            故障统计.B联系电话2 = tb联系电话2.Text;
            故障统计.B描述 = tb描述.Text;
            故障统计.B排除时间 = tb排除时间.Text;
            故障统计.B维护负责方 = tb维护负责方.Text;
            故障统计.B影响范围 = tb影响范围.Text;
            故障统计.B障碍发生地点 = tb障碍发生地点.Text;
            故障统计.B障碍受理负责人 = tb障碍受理负责人.Text;
            故障统计.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="BasedateID"></param>
        /// <returns></returns>
        public static Def_故障统计 Get故障统计ByBasedateID(string BasedateID)
        {
            Def_故障统计 故障统计 = new Def_故障统计(BasedateID);

            string sql =
            "SELECT [ID] " +
            "      ,[basedateID] " +
            "      ,[对方配合工程师] " +
            "      ,[发现时间] " +
            "      ,[故障级别] " +
            "      ,[故障现象] " +
            "      ,[故障摘要] " +
            "      ,[故障总结] " +
            "      ,[建议] " +
            "      ,[联系电话1] " +
            "      ,[联系电话2] " +
            "      ,[描述] " +
            "      ,[排除时间] " +
            "      ,[维护负责方] " +
            "      ,[影响范围] " +
            "      ,[障碍发生地点] " +
            "      ,[障碍受理负责人] " +
            "  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();
                故障统计.B发现时间 = dt.Rows[0]["发现时间"].ToString();
                故障统计.B故障级别 = dt.Rows[0]["故障级别"].ToString();
                故障统计.B故障现象 = dt.Rows[0]["故障现象"].ToString();
                故障统计.B故障摘要 = dt.Rows[0]["故障摘要"].ToString();
                故障统计.B故障总结 = dt.Rows[0]["故障总结"].ToString();
                故障统计.B建议 = dt.Rows[0]["建议"].ToString();
                故障统计.B联系电话1 = dt.Rows[0]["联系电话1"].ToString();
                故障统计.B联系电话2 = dt.Rows[0]["联系电话2"].ToString();
                故障统计.B描述 = dt.Rows[0]["描述"].ToString();
                故障统计.B排除时间 = dt.Rows[0]["排除时间"].ToString();
                故障统计.B维护负责方 = dt.Rows[0]["维护负责方"].ToString();
                故障统计.B影响范围 = dt.Rows[0]["影响范围"].ToString();
                故障统计.B障碍发生地点 = dt.Rows[0]["障碍发生地点"].ToString();
                故障统计.B障碍受理负责人 = dt.Rows[0]["障碍受理负责人"].ToString();

            }
            return 故障统计;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="故障统计"></param>
        public static void Insert故障统计(Def_故障统计 故障统计)
        {
            string sql =
            "INSERT INTO [New故障统计] " +
            "           ([basedateID] " +
            "           ,[对方配合工程师] " +
            "           ,[发现时间] " +
            "           ,[故障级别] " +
            "           ,[故障现象] " +
            "           ,[故障摘要] " +
            "           ,[故障总结] " +
            "           ,[建议] " +
            "           ,[联系电话1] " +
            "           ,[联系电话2] " +
            "           ,[描述] " +
            "           ,[排除时间] " +
            "           ,[维护负责方] " +
            "           ,[影响范围] " +
            "           ,[障碍发生地点] " +
            "           ,[障碍受理负责人])" +
            "     VALUES " +
            " ('" + 故障统计.BasedateID.ToString().Replace("'", "''") + "' " +
            故障统计.B对方配合工程师.ToString().Replace("'", "''") + "' " +
            故障统计.B发现时间.ToString().Replace("'", "''") + "' " +
            故障统计.B故障级别.ToString().Replace("'", "''") + "' " +
            故障统计.B故障现象.ToString().Replace("'", "''") + "' " +
            故障统计.B故障摘要.ToString().Replace("'", "''") + "' " +
            故障统计.B故障总结.ToString().Replace("'", "''") + "' " +
            故障统计.B建议.ToString().Replace("'", "''") + "' " +
            故障统计.B联系电话1.ToString().Replace("'", "''") + "' " +
            故障统计.B联系电话2.ToString().Replace("'", "''") + "' " +
            故障统计.B描述.ToString().Replace("'", "''") + "' " +
            故障统计.B排除时间.ToString().Replace("'", "''") + "' " +
            故障统计.B维护负责方.ToString().Replace("'", "''") + "' " +
            故障统计.B影响范围.ToString().Replace("'", "''") + "' " +
            故障统计.B障碍发生地点.ToString().Replace("'", "''") + "' " +
            故障统计.B障碍受理负责人.ToString().Replace("'", "''") + "') ";

            SQLExecute.ExecuteNonQuery(sql);
        }
예제 #4
0
        private void fr故障统计_Load(object sender, EventArgs e)
        {
            Def_故障统计 故障统计 = new Def_故障统计(BasedateID);
            故障统计 = 故障统计Comend.Get故障统计ByBasedateID(BasedateID);

            tb发现时间.Text = 故障统计.B发现时间;
            tb故障级别.Text = 故障统计.B故障级别;
            tb故障现象.Text = 故障统计.B故障现象;
            tb故障摘要.Text = 故障统计.B故障摘要;
            tb故障总结.Text = 故障统计.B故障总结;
            tb建议.Text = 故障统计.B建议;
            tb联系电话1.Text = 故障统计.B联系电话1;
            tb联系电话2.Text = 故障统计.B联系电话2;
            tb描述.Text = 故障统计.B描述;
            tb排除时间.Text = 故障统计.B排除时间;
            tb维护负责方.Text = 故障统计.B维护负责方;
            tb影响范围.Text = 故障统计.B影响范围;
            tb障碍发生地点.Text = 故障统计.B障碍发生地点;
            tb障碍受理负责人.Text = 故障统计.B障碍受理负责人;
            tb对方配合工程师.Text = 故障统计.B对方配合工程师;

            IsCanModify(IsModify);
        }
        /// <summary>
        /// 更新(带插入)
        /// </summary>
        /// <param name="故障统计"></param>
        public static void UpDate故障统计(Def_故障统计 故障统计)
        {
            string InsertSQL =
              "UPDATE [New故障统计] " +
            "   SET " +
            "      [对方配合工程师]     =            		    '" + 故障统计.B对方配合工程师.ToString().Replace("'", "''") + "'" +
            ",      [发现时间]     =            		    '" + 故障统计.B发现时间.ToString().Replace("'", "''") + "'" +
            ",      [故障级别]     =            		    '" + 故障统计.B故障级别.ToString().Replace("'", "''") + "'" +
            ",      [故障现象]     =            		    '" + 故障统计.B故障现象.ToString().Replace("'", "''") + "'" +
            ",      [故障摘要]     =            		    '" + 故障统计.B故障摘要.ToString().Replace("'", "''") + "'" +
            ",      [故障总结]     =            		    '" + 故障统计.B故障总结.ToString().Replace("'", "''") + "'" +
            ",      [建议]     =            		    '" + 故障统计.B建议.ToString().Replace("'", "''") + "'" +
            ",      [联系电话1]     =            		    '" + 故障统计.B联系电话1.ToString().Replace("'", "''") + "'" +
            ",      [联系电话2]     =            		    '" + 故障统计.B联系电话2.ToString().Replace("'", "''") + "'" +
            ",      [描述]     =            		    '" + 故障统计.B描述.ToString().Replace("'", "''") + "'" +
            ",      [排除时间]     =            		    '" + 故障统计.B排除时间.ToString().Replace("'", "''") + "'" +
            ",      [维护负责方]     =            		    '" + 故障统计.B维护负责方.ToString().Replace("'", "''") + "'" +
            ",      [影响范围]     =            		    '" + 故障统计.B影响范围.ToString().Replace("'", "''") + "'" +
            ",      [障碍发生地点]     =            		    '" + 故障统计.B障碍发生地点.ToString().Replace("'", "''") + "'" +
            ",      [障碍受理负责人]     =            		    '" + 故障统计.B障碍受理负责人.ToString().Replace("'", "''") + "'" +

            " WHERE [basedateID] ='" + 故障统计.BasedateID.ToString().Replace("'", "''") + "'";

            string UpDateSQL =
            "INSERT INTO [New故障统计] " +
            "           ([basedateID] " +
            "           ,[对方配合工程师] " +
            "           ,[发现时间] " +
            "           ,[故障级别] " +
            "           ,[故障现象] " +
            "           ,[故障摘要] " +
            "           ,[故障总结] " +
            "           ,[建议] " +
            "           ,[联系电话1] " +
            "           ,[联系电话2] " +
            "           ,[描述] " +
            "           ,[排除时间] " +
            "           ,[维护负责方] " +
            "           ,[影响范围] " +
            "           ,[障碍发生地点] " +
            "           ,[障碍受理负责人])" +
            "     VALUES " +
            " ('" + 故障统计.BasedateID.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B对方配合工程师.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B发现时间.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B故障级别.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B故障现象.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B故障摘要.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B故障总结.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B建议.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B联系电话1.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B联系电话2.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B描述.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B排除时间.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B维护负责方.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B影响范围.ToString().Replace("'", "''") + "' " +
            ", '" + 故障统计.B障碍发生地点.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);
        }