Esempio n. 1
0
        public void ReadData2Access()
        {
            ReadOracleData ROD = new ReadOracleData();
            OracleConnection conn = ROD.NewConn();
            DataSet Table_DataSet;
            Table_DataSet = ROD.ReadDataToDataSet(conn, "select item,inhalt,gruppe from datos_ini", "");
            string item, inhalt, gruppe;
            io.AccessDbclass("delete from datos_ini", db_dir);
            foreach (DataRow ini_Row in Table_DataSet.Tables[0].Rows)
            {
                item = ini_Row["item"].ToString();
                inhalt = ini_Row["inhalt"].ToString();
                gruppe = ini_Row["gruppe"].ToString();

                insert_sql = "insert into datos_ini(item,inhalt,gruppe) values ('" + item + "',\""+inhalt+"\",'"+gruppe+"')";
                io.AccessDbclass(insert_sql, db_dir);
            }
            Table_DataSet.Dispose();
            conn.Close();
        }
Esempio n. 2
0
        public void Check_para(bool is_first, int exec)
        {
            if (io.execute_or_not("check_option", db_dir, Convert.ToInt32(io.readconfig("DATABASE", "CHECK_OPTION")), is_first, exec))
            {
                ReadOracleData ROD = new ReadOracleData();
                OracleConnection conn = ROD.NewConn();
                DataSet Table_DataSet;
                Table_DataSet = ROD.ReadDataToDataSet(conn, "select item,inhalt,gruppe from datos_ini", "");
                DataTable dt = io.DbToDatatable("select item,inhalt,gruppe from datos_ini", db_dir);
                DataSet ds = new DataSet();
                ds.Tables.Add(dt);
                string item_o, inhalt_o, gruppe_o, item_a, inhalt_a, gruppe_a, out_put;
                out_put = "参数变化检测结果为:\r\n";
                string result = "正常";
                char show_flag = 'N';
                int counter = 0;
                    foreach (DataRow ini_Row_o in Table_DataSet.Tables[0].Rows)
                    {
                        item_o = ini_Row_o["item"].ToString();
                        inhalt_o = ini_Row_o["inhalt"].ToString();
                        gruppe_o = ini_Row_o["gruppe"].ToString();
                        counter = 0;
                        foreach  (DataRow ini_Row_a in ds.Tables[0].Rows)
                        {
                            item_a = ini_Row_a["item"].ToString();
                            inhalt_a = ini_Row_a["inhalt"].ToString();
                            gruppe_a = ini_Row_a["gruppe"].ToString();
                            if (item_a == item_o && gruppe_a == gruppe_o)
                            {
                                if (inhalt_a == inhalt_o)
                                    break;
                                else
                                {
                                    show_flag = 'E';
                                    result = "错误";
                                    out_put += "参数" + item_o + "在上一次检测结果为" + inhalt_a + ",但现行值为:" + inhalt_o + "。请检查。\r\n";
                                    break;
                                }
                            }
                            counter++;
                        }
                        if (counter >= ds.Tables[0].Rows.Count)
                        {
                            show_flag = 'E';
                            result = "错误";
                            out_put += "上次检测时,并未检测到参数" + item_o + "是否新增?请检查。\r\n";
                        }
                    }

                    foreach (DataRow ini_Row_a in ds.Tables[0].Rows)
                    {

                        item_a = ini_Row_a["item"].ToString();
                        inhalt_a = ini_Row_a["inhalt"].ToString();
                        gruppe_a = ini_Row_a["gruppe"].ToString();
                        counter = 0;
                        foreach (DataRow ini_Row_o in Table_DataSet.Tables[0].Rows)
                        {
                            item_o = ini_Row_o["item"].ToString();
                             inhalt_o = ini_Row_o["inhalt"].ToString();
                             gruppe_o = ini_Row_o["gruppe"].ToString();
                            if (item_a == item_o && gruppe_a == gruppe_o)
                                    break;
                            counter++;
                        }
                        if (counter >= Table_DataSet.Tables[0].Rows.Count)
                            {
                                show_flag = 'E';
                                result = "错误";
                                out_put += "上次检测时,检测到参数" + item_a + "现行参数是否删除了?请检查。\r\n";
                            }
                    }
                    conn.Close();
                    in_or_up = insert_or_update("check_option");
                    if (in_or_up)
                    {
                        insert_sql = "insert into Status_Now(para_name,para_value,para_group,flag,description,create_date,para_title,details) values ('check_option','" + result + "','IT3K','" + show_flag + "','','" + DateTime.Now.ToString() + "','IT3K','" + out_put + "')";
                        io.AccessDbclass(insert_sql, db_dir);
                    }
                    else
                    {
                        insert_sql = "insert into Status_Histroy select * from (select para_name,para_value,para_group,flag,description,create_date,para_title,details from Status_Now where para_name = 'check_option')";
                        io.AccessDbclass(insert_sql, db_dir);
                        insert_sql = "update Status_Now set para_value='" + result + "',flag = '" + show_flag + "',create_date = '" + DateTime.Now.ToString() + "',details = '" + out_put + "' where para_name = 'check_option'";
                        io.AccessDbclass(insert_sql, db_dir);
                    }
                ReadData2Access();
            }
        }