Exemplo n.º 1
0
        //压缩时GZipStream构造函数第三个参数一定要设置为true,
        //并且一定要先调用Close再来复制,否则不能正常解压(测试发现调用Close后会追加几字节内容)
        public MemoryStream GZipCompress(String str)
        {
            str = CSTR.trim(str);
            if (str.Length <= 0)
            {
                return(null);
            }

            //字符串转换为字节数组byte[]
            byte[]       buffer    = System.Text.Encoding.UTF8.GetBytes(str);
            MemoryStream streamRet = null;

            try
            {
                using (MemoryStream msTemp = new MemoryStream())
                {
                    using (GZipStream gzip = new GZipStream(msTemp, CompressionMode.Compress, true))
                    {
                        //压缩
                        gzip.Write(buffer, 0, buffer.Length);
                        gzip.Close();
                        //复制到返回的Stream
                        streamRet = new MemoryStream(msTemp.GetBuffer(), 0, (int)msTemp.Length);
                    }
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                streamRet = null;
            }

            return(streamRet);
        }
Exemplo n.º 2
0
        //恢复窗口字体
        public void restoreFont(Form wnd)
        {
            if (null == wnd)
            {
                return;
            }

            String fontName = CSTR.trim(font_family());

            if (fontName.Length <= 0)
            {
                return;
            }

            int fontSize = font_size();

            if (fontSize <= 3 || fontSize > 100)
            {
                return;
            }

            //最大化时不保存大小和位置,而是保留上一次非最大化时的值
            try
            {
                wnd.Font = new System.Drawing.Font(fontName, fontSize);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Exemplo n.º 3
0
        //保存窗口字体到ini文件
        public void saveFont(Form wnd, String fontName, int fontSize)
        {
            if (null == wnd)
            {
                return;
            }
            fontName = CSTR.trim(fontName);
            if (fontName.Length <= 0)
            {
                return;
            }
            if (fontSize <= 3 || fontSize > 100)
            {
                return;
            }

            //最大化时不保存大小和位置,而是保留上一次非最大化时的值
            try
            {
                //wnd.Font = new System.Drawing.Font(fontName, fontSize);
                INI_FILE.INIWriteValue(ini_file, "params", "font_family", fontName);
                INI_FILE.INIWriteValue(ini_file, "params", "font_size", fontSize.ToString());
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Exemplo n.º 4
0
        //获取指定行的字段值: JiaohaoTable_get_Field_String_by_IndexID("63","status")
        public static String JiaohaoTable_Get_Field_Value_by_IndexID(String indexID, String fieldName)
        {
            indexID   = CSTR.trim(indexID);
            fieldName = CSTR.trim(fieldName);
            if (CSTR.isEmpty(indexID))
            {
                return("");
            }
            if (CSTR.isEmpty(fieldName))
            {
                return("");
            }

            //获取JiaohaoTable表
            DataTable cache_tbl = DB_Get_JiaohaoTable_table();

            if (CSTR.IsTableEmpty(cache_tbl))
            {
                return(null);
            }
            //查询符合条件的行集合
            DataRow[] row_result = cache_tbl.Select(String.Format("IndexID='{0}'", indexID));
            if (CSTR.IsArrayEmpty(row_result))
            {
                return("");
            }
            //从第一行中返回指定的列数据
            return(CSTR.ObjectTrim(row_result[0][fieldName]));
        }
Exemplo n.º 5
0
        private String ini_file_getParamValue(String strName)
        {
            strName = CSTR.trim(strName);
            if (strName.Length <= 0)
            {
                return("");
            }

            String strRet = "";

            try
            {
                //确保ini文件存在,没有则创建
                ini_file_exist_suarance();

                //读取ini文件,并更新g_version
                strRet = CSTR.trim(INI_FILE.INIGetStringValue(ini_file, "params", strName, null));
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                strRet = "";
            }

            return(strRet);
        }
Exemplo n.º 6
0
        //设置指定的IndexID记录为活动检查
        public bool Call_SP_Activate_Specified_IndexID(String strIndexID)
        {
            strIndexID = CSTR.trim(strIndexID);
            if (strIndexID.Length <= 0)
            {
                return(false);
            }
            int nIndexID = CSTR.convertToInt(strIndexID);

            if (nIndexID <= 0)
            {
                return(false);
            }

            try
            {
                MySqlConnection connection = getConn();
                if (null == connection)
                {
                    return(false);
                }

                //指定存储过程名称和连接
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                adapter.SelectCommand             = new MySqlCommand();
                adapter.SelectCommand.Connection  = connection;
                adapter.SelectCommand.CommandText = "TJ_Queue_Activate_Specified_IndexID";//存储过程名称
                adapter.SelectCommand.CommandType = CommandType.StoredProcedure;

                //设置参数  //mysql的存储过程参数是以?打头的!!!!
                //in - parameter_Handler_Name
                MySqlParameter parameter_in_index_id = new MySqlParameter("?in_index_id", MySqlDbType.Int32, 11);
                parameter_in_index_id.Direction = ParameterDirection.Input;
                parameter_in_index_id.Value     = nIndexID;
                adapter.SelectCommand.Parameters.Add(parameter_in_index_id);

                //out - out_result_flag
                MySqlParameter parameter_out_result_flag = new MySqlParameter("?out_result_flag", MySqlDbType.Int32, 11);
                parameter_out_result_flag.Direction = ParameterDirection.Output;
                adapter.SelectCommand.Parameters.Add(parameter_out_result_flag);

                //把返回结果填入DataSet
                DataSet ds = new DataSet();
                adapter.Fill(ds);

                //取得Out参数
                int result_flag = CSTR.convertToInt(CSTR.ObjectTrim(parameter_out_result_flag.Value));

                return((result_flag == 1) ? true : false);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                Log.log("[mysql.Call_SP_Activate_Specified_IndexID()] " + exp.Message);

                conn = null;
            }

            return(false);
        }
Exemplo n.º 7
0
        //调用者写入需要播报的语音文本
        public void speak(String str)
        {
            str = CSTR.trim(str);
            if (CSTR.isEmpty(str))
            {
                return;
            }

            text_speak = str;
            need_speak = true;
        }
Exemplo n.º 8
0
        //---------<<< 封装 >>>--------------------------------------------------------------------
        public String toJson(DataTable tbl)
        {
            String strRet = "";

            if (CSTR.IsTableEmpty(tbl))
            {
                return("");
            }

            try
            {
                JavaScriptSerializer json = new JavaScriptSerializer();
                json.MaxJsonLength = Int32.MaxValue;//设置JSON串的最大值

                //封装列名
                List <String> columnList = new List <string>();
                foreach (DataColumn column in tbl.Columns)
                {
                    columnList.Add(CSTR.trim(column.ColumnName));
                }
                int columnCount = columnList.Count;

                //封装字段内容
                List <List <String> > rowList = new List <List <string> >();
                foreach (DataRow row in tbl.Rows)
                {
                    List <String> tempList = new List <string>();
                    for (int i = 0; i < columnCount; i++)
                    {
                        tempList.Add(CSTR.ObjectTrim(row[columnList[i]]));
                    }
                    rowList.Add(tempList);//添加一行记录
                }

                //总装
                Dictionary <String, Object> tblMap = new Dictionary <string, object>();
                tblMap.Add("column", columnList);
                tblMap.Add("data", rowList);
                strRet = json.Serialize(tblMap);  //返回一个json字符串
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                strRet = "";
            }

            return(strRet);
        }
Exemplo n.º 9
0
        private void ini_file_setVersion(String strVersion)
        {
            strVersion = CSTR.trim(strVersion);
            if (strVersion.Length <= 0)
            {
                strVersion = "0";
            }

            try
            {
                INI_FILE.INIWriteValue(ini_file, "params", "version", strVersion);
                INI_FILE.INIWriteValue(ini_file, "params", "update_date", DateTime.Now.ToString());
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Exemplo n.º 10
0
        public static DataRow[] RFID_get_Rfid_row(String rfid)
        {
            DataTable tbl = DB_Get_JiaohaoRfid_table();

            if (CSTR.IsTableEmpty(tbl))
            {
                return(null);
            }

            rfid = CSTR.trim(rfid);
            if (rfid.Length <= 0)
            {
                return(null);
            }

            DataRow[] rowArr = tbl.Select(String.Format("Rfid='{0}'", rfid));

            return(rowArr);
        }
Exemplo n.º 11
0
        public static DataRow[] TJ_Queue_Arrange_Get_Checking_or_Activated_Exam(String DJLSH)
        {
            DJLSH = CSTR.trim(DJLSH);
            if (DJLSH.Length <= 0)
            {
                return(null);
            }

            //包括状态串为 1000 与 1110 的检查
            String sql = String.Format("QueueActive='1' And DJLSH='{0}'", DJLSH);

            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

            if (CSTR.IsTableEmpty(tbl))
            {
                return(null);
            }

            return(tbl.Select(sql));
        }
Exemplo n.º 12
0
        /**
         * 获取指定DJLSH的当前活动检查
         * 使用:
         * FinalCheckWnd.cs在显示检查列表时调用
         *
         * **/
        //获取指定DJLSH的当前活动检查
        public static DataRow[] TJ_Queue_Arrange_Get_Activated_Exam(String DJLSH)
        {
            DJLSH = CSTR.trim(DJLSH);
            if (DJLSH.Length <= 0)
            {
                return(null);
            }

            String sql = String.Format("QueueActive='1' And status='0' And IsChecking='0' And IsOver='0' " +
                                       "And DJLSH='{0}'", DJLSH);

            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

            if (CSTR.IsTableEmpty(tbl))
            {
                return(null);
            }

            return(tbl.Select(sql));
        }
Exemplo n.º 13
0
        /// 获取本房间的相同RFID的信息(不管状态)
        public static DataRow[] Exam_Get_All_Exam_Ingone_Status_SameRoom_SameRFID(String strRFID)
        {
            strRFID = CSTR.trim(strRFID);
            if (strRFID.Length <= 0)
            {
                return(null);
            }

            //取得本进程对应的room_id
            String    strRoomID = CONFIG.system_param["room_id"];
            String    sql       = String.Format("RoomID='{0}' AND Rfid='{1}'", strRoomID, strRFID);
            DataTable tbl       = DatabaseCache.DB_Get_JiaohaoTable_table();

            if (CSTR.IsTableEmpty(tbl))
            {
                return(null);
            }

            return(tbl.Select(sql));
        }
Exemplo n.º 14
0
        public static String Exam_Get_RingNo_By_RfidNo(String strRFID)
        {
            strRFID = CSTR.trim(strRFID);
            if (strRFID.Length <= 0)
            {
                return(null);
            }

            String    sql = String.Format("Rfid='{0}' ", strRFID);
            DataTable tbl = DatabaseCache.DB_Get_JiaohaoTable_table();

            if (CSTR.IsTableEmpty(tbl))
            {
                return(null);
            }

            DataRow[] sel_rows = tbl.Select(sql);
            if (CSTR.IsArrayEmpty(sel_rows))
            {
                return(null);
            }

            return(CSTR.ObjectTrim(sel_rows[0]["RfidName"]));
        }
Exemplo n.º 15
0
        //登记成功,返回NEW_DJLSH,登记失败,返回null;
        public String register()
        {
            String str_ret_DJLSH = null;

            if (CSTR.IsTableEmpty(register_table))
            {
                return(null);
            }
            if (CSTR.isEmpty(rfid_no))
            {
                return(null);
            }
            if (CSTR.isEmpty(ring_no))
            {
                return(null);
            }

            ExamQueue queue = new ExamQueue();

            try
            {
                //生成每个检查的检查房间-------------------------------------------------------------------------
                List <String> reg_list_RoomID = parse_and_allot_RoomID_for_STUDY();
                if (null == reg_list_RoomID)
                {
                    return(null);
                }
                if (reg_list_RoomID.Count <= 0)
                {
                    return(null);
                }
                //生成每个检查的检查房间-------------------------------------------------------------------------

                //通用数据以第一条记录为准------------------------------------------------------------------------
                DataRow rowFirst = register_table.Rows[0];
                //PatientInfo级别的信息(同一使用第一行的数据)
                String PatientNameChinese = CSTR.ObjectTrim(rowFirst["XM"]);
                String PatientGender      = CSTR.ObjectTrim(rowFirst["XB"]);
                if (PatientGender.Equals("0"))
                {
                    PatientGender = "女";
                }
                else
                {
                    PatientGender = "男";                                      //0:女 1:男 %:未知
                }
                String SFZH  = CSTR.ObjectTrim(rowFirst["SFZH"]);             //身份证号
                String Phone = (CSTR.ObjectTrim(rowFirst["p_Phone"]).Length > //两个电话取长度长的那个
                                CSTR.ObjectTrim(rowFirst["d_Phone"]).Length) ?
                               CSTR.ObjectTrim(rowFirst["p_Phone"]) : CSTR.ObjectTrim(rowFirst["d_Phone"]);
                String PatientIntraID  = CSTR.ObjectTrim(rowFirst["TJBH"]);
                String DJLSH           = CSTR.ObjectTrim(rowFirst["DJLSH"]);
                String TJLB            = CSTR.ObjectTrim(rowFirst["TJLB"]);
                String TJLBMC          = CSTR.ObjectTrim(rowFirst["TJLBMC"]);
                String DWBH            = CSTR.ObjectTrim(rowFirst["DWBH"]);
                String DWMC            = CSTR.ObjectTrim(rowFirst["DWMC"]);
                String ExamAccessionID = this.ring_no;//用于显示序号
                //获取激活时间
                DateTime arrivalTime        = DateTime.Now;
                String   strArrivalTime     = arrivalTime.ToString("HH:mm:ss");          //只取得时间部分,用以生成QueueID
                String   strArrivalDateTime = arrivalTime.ToString("yyyyMMdd HH:mm:ss"); //取得日期及时间(格式化时间)
                //生成QueueID
                String QueueID             = String.Format("time_to_sec('{0}')", strArrivalTime);
                String ExamArrivalDateTime = "NOW()";
                //生成检查来源(类别)
                String PreExamFrom = "个检";//体检来源(类别)
                if (STUDY_is_vacation_exam)
                {
                    PreExamFrom = "职检";
                }
                //PatientInfo级别的信息同一使用第一行的数据为准----------------------------------------------------

                //生成每一个Exam的JiaohaoTable和JiaohaoExamInfo的Insert的Sql语句
                List <String> reg_list_sql_JiaohaoTable       = new List <string>();
                List <String> reg_list_sql_JiaohaoExamInfo    = new List <string>();
                String        reg_str_RoomID_registed_cluster = "";//记录已经登记了的RoomID列表
                for (int i = 0; i < register_table.Rows.Count; i++)
                {
                    //取得行数据
                    DataRow row = register_table.Rows[i];

                    //ExamInfo级别的数据,每个Row会有不同---------------------------------
                    String ModalityID         = CSTR.ObjectTrim(row["CheckRoom"]);
                    String OrderProcedureName = CSTR.ObjectTrim(row["ExamTypeMC"]);
                    String ProcedureStepID    = CSTR.ObjectTrim(row["TJXMBH"]);
                    String ProcedureStepName  = CSTR.ObjectTrim(row["TJXMMC"]);
                    String ExamType           = CSTR.ObjectTrim(row["ExamType"]);
                    String ReorderReason      = "";// CSTR.ObjectTrim(row["TSXX"]);//提示信息
                    //ExamInfo级别的数据,每个Row会有不同---------------------------------

                    //获取RoomID
                    String RoomID = reg_list_RoomID[i];
                    if (CSTR.isEmpty(RoomID) || RoomID.Equals(VALID_ROOM_ID))
                    {
                        //如果是无效房间,则生成空的SQL语句
                        reg_list_sql_JiaohaoExamInfo.Add("");
                        reg_list_sql_JiaohaoTable.Add("");

                        //处理下一个
                        continue;
                    }

                    //有了唯一的RoomID后,定义OrderID,用于同一房间检查的详细信息查询
                    String OrderID = CSTR.trim(DJLSH + RoomID);
                    //ExamID也要写入到JiaohaoExamInfo,用于和IndexID的对应,需要保证每个Exam不同
                    String ExamID = String.Format("{0}.{1}.{2}", OrderID, ProcedureStepID, i.ToString());

                    //合并相同房间的RoomID字段和检查方法字段,保存到JiaohaoTable.ArrayRoomID和JiaohaoTable.ArrayProcedureStepName
                    String ArrayRoomID            = "";
                    String ArrayProcedureStepName = "";
                    for (int reg_point = 0; reg_point < reg_list_RoomID.Count; reg_point++)
                    {
                        String reg_room_id = reg_list_RoomID[reg_point];
                        if (RoomID.Equals(reg_room_id))
                        {
                            String roomid_for_arr        = CSTR.ObjectTrim(register_table.Rows[reg_point]["CheckRoom"]);
                            String procedureName_for_arr = CSTR.ObjectTrim(register_table.Rows[reg_point]["TJXMMC"]);
                            //去掉敏感字符';'
                            roomid_for_arr        = roomid_for_arr.Replace(";", "");
                            procedureName_for_arr = procedureName_for_arr.Replace(";", "");
                            //加入到Array字段
                            if (ArrayRoomID.Length > 0)
                            {
                                ArrayRoomID += ";";
                            }
                            ArrayRoomID += roomid_for_arr;
                            if (ArrayProcedureStepName.Length > 0)
                            {
                                ArrayProcedureStepName += ";";
                            }
                            ArrayProcedureStepName += procedureName_for_arr;
                        }
                    }

                    //检查状态的确定
                    String ExamSatus   = "2"; //默认为未检
                    String status      = "0"; //默认为未检
                    String IsOver      = "0"; //默认为未检
                    String IsNeedQueue = "1"; //默认需要排队
                    String IsNeedVoice = "1"; //默认需要TTS语音

                    //对roomID,查询房间的三个状态 active/needQueue/needVoice
                    bool bActive    = DatabaseCache.RoomInfo_is_active(RoomID);
                    bool bNeedQueue = DatabaseCache.RoomInfo_is_need_queue(RoomID);
                    bool bNeedVoice = DatabaseCache.RoomInfo_is_need_voice(RoomID);

                    //只有NeedQueue为false才无需排队,不论房间是否active或disactive
                    if (bNeedQueue == false)
                    {
                        ExamSatus   = "3";
                        status      = "1";
                        IsOver      = "1";
                        IsNeedQueue = "0";
                        IsNeedVoice = "0";
                    }
                    else
                    {
                        ExamSatus   = "2";
                        status      = "0";
                        IsOver      = "0";
                        IsNeedQueue = "1";
                        if (bNeedVoice)
                        {
                            IsNeedVoice = "1";
                        }
                        else
                        {
                            IsNeedVoice = "0";
                        }
                    }

                    //生成插入到JiaohaoTable的语句
                    String sql_JiaohaoTable = String.Format("insert into JiaohaoTable " +

                                                            " (QueueID,PatientNameChinese,PatientGender," +//1
                                                            "SFZH,Phone,PatientIntraID," +

                                                            "DJLSH,Rfid,RfidName," +//2
                                                            "TJLB,TJLBMC,DWBH," +

                                                            "DWMC,ExamID,OrderID," +//3
                                                            "ExamAccessionID,ExamArrivalDateTime,ModalityID," +

                                                            "OrderProcedureName,ProcedureStepID,ProcedureStepName," +//4
                                                            "ExamType,RoomID,ReorderReason," +

                                                            "PreExamFrom,ExamSatus,status," +//5
                                                            "IsOver,IsNeedQueue,IsNeedVoice," +
                                                            "ArrayRoomID,ArrayProcedureStepName) VALUES " +

                                                            " ({0},'{1}','{2}'," +//1
                                                            " '{3}','{4}','{5}'," +

                                                            " '{6}','{7}','{8}'," +//2
                                                            " '{9}','{10}','{11}'," +

                                                            " '{12}','{13}','{14}'," +//3
                                                            " '{15}',{16},'{17}'," +

                                                            " '{18}','{19}','{20}'," +//4
                                                            " '{21}','{22}','{23}'," +

                                                            "'{24}',{25},{26}," +//5
                                                            "{27},{28},{29}," +
                                                            "'{30}','{31}')",

                                                            QueueID, PatientNameChinese, PatientGender,//1
                                                            SFZH, Phone, PatientIntraID,

                                                            DJLSH, this.rfid_no, this.ring_no,//2
                                                            TJLB, TJLBMC, DWBH,

                                                            DWMC, ExamID, OrderID,//3
                                                            ExamAccessionID, ExamArrivalDateTime, ModalityID,

                                                            OrderProcedureName, ProcedureStepID, ProcedureStepName,//4
                                                            ExamType, RoomID, ReorderReason,

                                                            PreExamFrom, ExamSatus, status,//5
                                                            IsOver, IsNeedQueue, IsNeedVoice,
                                                            ArrayRoomID, ArrayProcedureStepName
                                                            );

                    //生成插入到JiaohaoExamInfo的语句
                    String sql_JiaohaoExamInfo = String.Format("insert into JiaohaoExamInfo " +
                                                               " (ExamID,OrderID,RoomID,CheckRoom," +
                                                               "ProcedureStepID,ProcedureStepName,ExamType,RfidName) VALUES " +
                                                               " ('{0}','{1}','{2}','{3}'," +
                                                               "'{4}','{5}','{6}','{7}')",
                                                               ExamID, OrderID, RoomID, ModalityID,
                                                               ProcedureStepID, ProcedureStepName, ExamType, this.ring_no);

                    //对于相同的RoomID,在JiaohaoTable中只能写入一次
                    if (reg_str_RoomID_registed_cluster.IndexOf(RoomID) >= 0)
                    {
                        //如果此Exam的RoomID已经登记了,则不再写入相同的JiaohaoTable记录
                        sql_JiaohaoTable = "";
                    }
                    else
                    {
                        //记录本次的RoomID到已完成房间串
                        reg_str_RoomID_registed_cluster += RoomID;
                    }
                    //保存SQL语句
                    reg_list_sql_JiaohaoTable.Add(sql_JiaohaoTable);
                    reg_list_sql_JiaohaoExamInfo.Add(sql_JiaohaoExamInfo);
                }//end for (int i = 0; i < register_table.Rows.Count; i++)

                //重置返回值
                str_ret_DJLSH = null;

                //逐条写入数据库
                int nCount = queue.getDB().update_use_Transaction(reg_list_sql_JiaohaoTable);
                if (nCount > 0)
                {
                    //不再插入检查到JiaohaoExamInfo
                    //int nCount2 = queue.getDB().update_use_Transaction(reg_list_sql_JiaohaoExamInfo);

                    str_ret_DJLSH = DJLSH;//设置返回值
                }
            }
            catch (Exception exp)
            {
                str_ret_DJLSH = null;
            }

            return(str_ret_DJLSH);
        }
Exemplo n.º 16
0
        //---------<<< 还原 >>>--------------------------------------------------------------------
        public DataTable revertDataTable(String strJson)
        {
            DataTable tblRet = null;

            strJson = CSTR.trim(strJson);
            if (strJson.Length <= 0)
            {
                return(null);
            }

            try
            {
                JavaScriptSerializer json = new JavaScriptSerializer();
                json.MaxJsonLength = Int32.MaxValue;//设置JSON串的最大值

                //解析json字符串
                Dictionary <String, Object> tblMap = json.Deserialize <Dictionary <String, Object> >(strJson);
                if (CSTR.IsDictionaryEmpty(tblMap))
                {
                    return(null);
                }

                //必须使用ArrayList,当用List<String>时返回为null(原因不明)
                ArrayList columnList = tblMap["column"] as ArrayList;
                if (CSTR.IsListEmpty(columnList))
                {
                    return(null);
                }

                ArrayList rowList = tblMap["data"] as ArrayList;
                if (CSTR.IsListEmpty(rowList))
                {
                    return(null);
                }

                //重建DataTable
                tblRet = new DataTable();
                //重建column
                foreach (String column in columnList)
                {
                    tblRet.Columns.Add(column);
                }

                //填充数据
                int nCloumnCount = columnList.Count;
                foreach (ArrayList list in rowList)
                {
                    DataRow newRow = tblRet.NewRow();
                    for (int i = 0; i < nCloumnCount; i++)
                    {
                        newRow[i] = list[i];
                    }
                    tblRet.Rows.Add(newRow);//循环添加行
                }
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                tblRet = null;
            }

            return(tblRet);
        }
Exemplo n.º 17
0
        public String Call_StoreProcedure_demo(String roomID)
        {
            String strRet = "";

            roomID = CSTR.trim(roomID);
            if (roomID.Length <= 0)
            {
                return("");
            }

            try
            {
                MySqlConnection connection = getConn();
                if (null == connection)
                {
                    return("");
                }

                //指定存储过程名称和连接
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                adapter.SelectCommand             = new MySqlCommand();
                adapter.SelectCommand.Connection  = connection;
                adapter.SelectCommand.CommandText = "demo2";//存储过程名称
                adapter.SelectCommand.CommandType = CommandType.StoredProcedure;

                //设置参数  //mysql的存储过程参数是以?打头的!!!!
                //in - roomID
                MySqlParameter parameter_room_id = new MySqlParameter("?room_ID", MySqlDbType.VarChar, 20);
                parameter_room_id.Value = roomID;
                adapter.SelectCommand.Parameters.Add(parameter_room_id);

                //out - count(*)
                MySqlParameter parameter_exam_count = new MySqlParameter("?roomCount", MySqlDbType.VarChar, 20);
                parameter_exam_count.Direction = ParameterDirection.Output;
                adapter.SelectCommand.Parameters.Add(parameter_exam_count);

                //把返回结果填入DataSet
                DataSet ds = new DataSet();
                adapter.Fill(ds);

                //查看是否有返回的表
                int nTableCount = ds.Tables.Count;
                if (nTableCount > 0)
                {
                    //即使存储过程中未返回表,Tables.Count也会为1,但为空表
                    DataTable tbl = ds.Tables[0];
                    if (CSTR.IsTableEmpty(tbl) == false)
                    {
                        foreach (DataRow row in tbl.Rows)
                        {
                            System.Windows.Forms.MessageBox.Show(CSTR.ObjectTrim(row[0]));
                        }
                    }
                }

                //取得Out参数
                strRet = CSTR.ObjectTrim(parameter_exam_count.Value);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
                Log.log("[mysql.call_storeProcedure()] " + exp.Message);

                conn   = null;
                strRet = "";
            }

            return(strRet);
        }
Exemplo n.º 18
0
        //获取本机的主机名
        public String getLocalHostName()
        {
            String hostName = CSTR.trim(Dns.GetHostName());

            return(hostName);
        }
Exemplo n.º 19
0
        private String m_exam_type = "体检中心"; //如果为"本部"则需要超声科叫号

        //构造函数
        public RegisterToUltraSound(String djlsh, String examType)
        {
            m_djlsh     = CSTR.trim(djlsh);
            m_exam_type = CSTR.trim(examType);
        }
Exemplo n.º 20
0
        /**
         * 获取所有的检查项目(ExamInfo关联)
         * 使用:
         * FinalCheckWnd.cs在显示检查列表时调用
         *
         * **/
        public static DataTable ExamInfo_get_All_Items_by_RingNo(String ringNo)
        {
            DataTable tblRet = null;

            ringNo = CSTR.trim(ringNo);
            if (ringNo.Length <= 0)
            {
                return(null);
            }

            //获取JiaohaoTable表
            DataTable cache_tbl = DB_Get_JiaohaoTable_table();

            if (CSTR.IsTableEmpty(cache_tbl))
            {
                return(null);
            }

            //查询符合条件的行集合(排序优先级别"QueueActive DESC,IsOver"
            DataRow[] JiaohaoTable_row_result =
                cache_tbl.Select(String.Format("RfidName='{0}'", ringNo), "IsOver,QueueActive DESC,IsNeedQueue");
            if (CSTR.IsArrayEmpty(JiaohaoTable_row_result))
            {
                return(null);
            }

            //构建返回表
            tblRet = new DataTable();
            tblRet = cache_tbl.Clone();//克隆表结构,但无数据
            foreach (DataRow row_JiaohaoTable in JiaohaoTable_row_result)
            {
                //Split本检查的ArrayProcedureStepName,并逐条添加到返回表
                String ArrayProcedureStepName = CSTR.ObjectTrim(row_JiaohaoTable["ArrayProcedureStepName"]);
                if (CSTR.isEmpty(ArrayProcedureStepName))
                {
                    //如果ArrayProcedureStepName无内容,直接Copy本条记录到返回表
                    DataRow newRow = Row_Copy(row_JiaohaoTable, tblRet);
                    tblRet.Rows.Add(newRow);
                    continue;
                }

                String[] procedureName_arr = ArrayProcedureStepName.Split(';');
                if (null == procedureName_arr || procedureName_arr.Length <= 1)
                {
                    //如果检查Item数量少于2个,直接Copy本条记录到返回表
                    DataRow newRow = Row_Copy(row_JiaohaoTable, tblRet);
                    tblRet.Rows.Add(newRow);
                    continue;
                }

                foreach (String procedureName in procedureName_arr)
                {
                    //把每个ProcedureStepName的数据Copy到新的行newRow
                    DataRow newRow = Row_Copy(row_JiaohaoTable, tblRet);
                    if (null != newRow)
                    {
                        newRow["ProcedureStepName"] = procedureName;
                        tblRet.Rows.Add(newRow);
                    }
                }
            }//end foreach (DataRow row in JiaohaoTable_row_result)

            return(tblRet);
        }