Esempio n. 1
0
        public override DsPanelInfo LoadDsPanelInfo()
        {
            DsPanelInfo m_dsPanelInfo = new DsPanelInfo();
            RisDAL      oKodakDAL     = new RisDAL();

            try
            {
                //string szQuery1 = "SELECT ModuleID, 'Modules.' + ModuleID as Title, Parameter, ImageIndex FROM tModule Where (Parameter & 1) = 0 order by OrderNo";
                string szQuery1 = "SELECT ModuleID,  Title, Parameter, ImageIndex FROM tModule Where (bitand (Parameter , 1) = 0) order by OrderNo";
                oKodakDAL.ExecuteQuery(szQuery1, m_dsPanelInfo, "Module");
                //string szQuery2 = "SELECT PanelID, 'Panels.' + PanelID as Title, AssemblyQualifiedName, Parameter, ModuleID, Flag, ImageIndex, [Key] FROM tPanel Where (Parameter & 1) = 0 order by OrderNo";
                string szQuery2 = "SELECT PanelID,  Title, AssemblyQualifiedName, Parameter, ModuleID, Flag, ImageIndex, Key FROM tPanel Where (bitand (Parameter , 1) = 0) order by OrderNo";
                oKodakDAL.ExecuteQuery(szQuery2, m_dsPanelInfo, "Panel");
            }
            catch (Exception Ex)
            {
                logger.Error((long)ModuleEnum.Framework_Client, ModuleInstanceName.Framework, 1, Ex.Message,
                             string.Empty, (new System.Diagnostics.StackFrame(true)).GetFileName(),
                             (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
                m_dsPanelInfo = null;
            }
            finally
            {
                if (oKodakDAL != null)
                {
                    oKodakDAL.Dispose();
                }
            }
            return(m_dsPanelInfo);
        }
Esempio n. 2
0
        public override DataTable GetBackupFileList(string stTables, bool bFailRetry, string stRetryFlag)
        {
            RisDAL dataAccess = new RisDAL();

            try
            {
                if (bFailRetry == false)
                //get files that have not been downloaded
                {
                    //for requisition
                    string sql = string.Format("select 'trequisition' as tablename, RequisitionGUID as FileGUID, backupmark,backupcomment,filename, relativepath from trequisition where ((backupmark != '1' and backupmark != 'F' )  or backupmark is null )")
                                 //for report files
                                 + string.Format("union ")
                                 + string.Format("select 'treportfile' as tablename, FileGUID,backupmark,backupcomment,filename, relativepath from treportfile where( (backupmark != '1' and backupmark != 'F'  ) or backupmark is null) ")
                                 //for report printlog files
                                 + string.Format("union ")
                                 + string.Format("select 'treportprintlog' as tablename,FileGUID, backupmark,backupcomment,SnapShotSrvPath as filename, null as relativepath from treportprintlog where( (backupmark != '1' and backupmark != 'F' ) or backupmark is null) ");
                    logger.Info((long)ModuleEnum.CommonModule, ModuleInstanceName.CommonModule, 53, sql, Application.StartupPath.ToString(),
                                (new System.Diagnostics.StackFrame(true)).GetFileName(),
                                (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
                    return(dataAccess.ExecuteQuery(sql));
                }
                else
                //get files that fail to download sometime before
                {
                    //for requisition
                    string sql = string.Format("select 'trequisition' as tablename, RequisitionGUID as FileGUID, backupmark,backupcomment,filename, relativepath from trequisition where (backupmark != '1' and len(backupmark)>0)")
                                 //for report files
                                 + string.Format("union ")
                                 + string.Format("select 'treportfile' as tablename, FileGUID,backupmark,backupcomment,filename, relativepath from treportfile where (backupmark != '1' and len(backupmark)>0)")
                                 //for report printlog files
                                 + string.Format("union ")
                                 + string.Format("select 'treportprintlog' as tablename,FileGUID, backupmark,backupcomment,SnapShotSrvPath as filename, null as relativepath from treportprintlog where (backupmark != '1' and len(backupmark)>0)");
                    logger.Info((long)ModuleEnum.CommonModule, ModuleInstanceName.CommonModule, 53, sql, Application.StartupPath.ToString(),
                                (new System.Diagnostics.StackFrame(true)).GetFileName(),
                                (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
                    return(dataAccess.ExecuteQuery(sql));
                }
            }
            catch (Exception ex)
            {
                logger.Error((long)ModuleEnum.CommonModule, ModuleInstanceName.CommonModule, 53, ex.Message, Application.StartupPath.ToString(),
                             (new System.Diagnostics.StackFrame(true)).GetFileName(),
                             (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
            }
            finally
            {
                if (dataAccess != null)
                {
                    dataAccess.Dispose();
                }
            }

            return(null);
        }
Esempio n. 3
0
        private int getUnApprovedReportCount(string userGuid)
        {
            int unapprovedReportCount = 0;

            try
            {
                using (RisDAL dal = new RisDAL())
                {
                    DataTable dtUnApprovedReportNoLock = new DataTable();
                    DataTable dtLockedRp           = new DataTable();
                    DataTable dtLockedReportGuids  = new DataTable();
                    string    lockedSyncRpGuids    = "";
                    string    lockedRpGuids        = "";
                    string    sqlLockedRp          = string.Format("select rpguids from tsync where owner ='{0}' and moduleid='0400'", userGuid);
                    string    sqlLockedReportGuids = "select distinct reportguid from tRegProcedure where status = 110 and ProcedureGuid in ('{0}')";

                    dal.ExecuteQuery(sqlLockedRp, dtLockedRp);
                    foreach (DataRow dr in dtLockedRp.Rows)
                    {
                        lockedSyncRpGuids = Convert.ToString(dr["RPGuids"]);
                        if (lockedSyncRpGuids.Length > 0)
                        {
                            lockedRpGuids += lockedSyncRpGuids.Split("&".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)[0] + ",";
                        }
                    }

                    if (lockedRpGuids.Length > 0)
                    {
                        lockedRpGuids = lockedRpGuids.TrimEnd(",".ToCharArray());
                        lockedRpGuids = lockedRpGuids.Replace(",", "','");
                    }

                    if (lockedRpGuids.Length > 0)
                    {
                        dal.ExecuteQuery(string.Format(sqlLockedReportGuids, lockedRpGuids), dtLockedReportGuids);
                    }

                    unapprovedReportCount = dtLockedReportGuids.Rows.Count;
                }
                return(unapprovedReportCount);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
                return(unapprovedReportCount);
            }
        }
Esempio n. 4
0
        public object Execute(object param)
        {
            string sql = "";

            try
            {
                using (RisDAL dal = new RisDAL())
                {
                    sql = "select tRole2User.rolename, tUser.userGuid, LoginName, localName, englishname,"
                          + " isnull(tRoleProfile.value, 0) as [level], tUser.IKEYSN, u1.Value as WriteReportModalityType, u2.Value as ApproveReportModalityType"
                          + " from tUser left join tRole2User"
                          + "		 left join tRoleProfile on tRoleProfile.rolename=tRole2User.rolename and tRoleProfile.name='RoleLevel'"
                          + "   on tUser.UserGuid = tRole2User.UserGuid"
                          + "		 left join tUserProfile u1 on u1.UserGuid=tUser.UserGuid and u1.name='WriteReportModalityType'"
                          + "		 left join tUserProfile u2 on u2.UserGuid=tUser.UserGuid and u2.name='ApproveReportModalityType'"
                          + " order by tRole2User.rolename, loginName";

                    DataSet ds = new DataSet();

                    dal.ExecuteQuery(sql, ds, "UserList");

                    return(ds);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetUserListDAO_MSSQL, MSG=" + ex.Message + ", SQL=" + sql, "", 0);
            }

            return(null);
        }
Esempio n. 5
0
        public override bool GetAllProcedureCode(DataSet ds)
        {
            bool      bReturn = true;
            RisDAL    oKodak  = new RisDAL();
            DataTable dt      = new DataTable();

            try
            {
                string strSQL = "SELECT	ProcedureCode,Description,EnglishDescription,ModalityType,BodyPart,CheckingItem,Charge,Preparation,Frequency,BodyCategory,Duration,FilmSpec,FilmCount,ContrastName,ContrastDose,ImageCount,ExposalCount,BookingNotice,ShortcutCode FROM tProcedureCode ";
                dt           = oKodak.ExecuteQuery(strSQL);
                dt.TableName = "ProcedureCode";

                ds.Tables.Add(dt);
                ds.DataSetName = "ProcedureCodeDataSet";
            }
            catch (Exception ex)
            {
                bReturn = false;

                logger.Error((long)ModuleEnum.Register_DA, ModuleInstanceName.Registration, 53, ex.Message, Application.StartupPath.ToString(), (new System.Diagnostics.StackFrame(true)).GetFileName(),
                             (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
                if (oKodak != null)
                {
                    oKodak.Dispose();
                }
            }
            return(bReturn);
        }
Esempio n. 6
0
        public object Execute(object param)
        {
            try
            {
                using (RisDAL dal = new RisDAL())
                {
                    string sql = "select rolename, tUser.userGuid, LoginName, localName, englishname "
                                 + " from tUser, tRole2User where tUser.UserGuid = tRole2User.UserGuid"
                                 + " order by rolename, loginName";

                    DataSet ds = new DataSet();

                    dal.ExecuteQuery(sql, ds, "UserList");

                    return(ds);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetUserListDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 7
0
        public override Server.ClientFramework.Common.Data.Profile.DsConfigDic LoadConfigDic(int Type)
        {
            StringBuilder strBuilder = new StringBuilder();

            strBuilder.Append(
                @"SELECT ConfigName,Value,tConfigDic.ModuleID,
                    tModule.Title as ModuleName,Exportable,
                    nvl(PropertyDesc, '') as PropertyDesc,
                    nvl(PropertyOptions, '') as PropertyOptions,
                    Inheritance,PropertyType,IsHidden,OrderingPos,
                    nvl(Domain, '') as Domain 
                FROM tConfigDic, tModule 
                Where Type= " + Type.ToString() + @" And tModule.ModuleID = tConfigDic.ModuleID");
            RisDAL oKodakDAL = new RisDAL();

            Server.ClientFramework.Common.Data.Profile.DsConfigDic rt =
                new Server.ClientFramework.Common.Data.Profile.DsConfigDic();
            try
            {
                oKodakDAL.ExecuteQuery(strBuilder.ToString(), rt.ConfigDic);
                foreach (DataRow myRow in rt.Tables["ConfigDic"].Rows)
                {
                    if (myRow["Domain"].Equals(DBNull.Value))
                    {
                        myRow["Domain"] = "";
                    }
                    if (myRow["PropertyDesc"].Equals(DBNull.Value))
                    {
                        myRow["PropertyDesc"] = "";
                    }
                    if (myRow["PropertyOptions"].Equals(DBNull.Value))
                    {
                        myRow["PropertyOptions"] = "";
                    }
                    if (myRow["Value"].Equals(DBNull.Value))
                    {
                        myRow["Value"] = "";
                    }
                }
            }
            catch (Exception Ex)
            {
                logger.Error((long)ModuleEnum.Framework_Client, ModuleInstanceName.Framework, 1, Ex.Message,
                             string.Empty, (new System.Diagnostics.StackFrame(true)).GetFileName(),
                             (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
            }
            finally
            {
                if (oKodakDAL != null)
                {
                    oKodakDAL.Dispose();
                }
            }
            return(rt);
        }
Esempio n. 8
0
        public string GetAllReportColumn()
        {
            try
            {
                string sql = "select table_name as tblname, column_name as colname,"
                             + " data_type as coltype, data_length as collength"
                             + " from user_tab_cols"
                             + " where table_name in ('TREGPATIENT','TREGORDER', 'TREGPROCEDURE', 'TPROCEDURECODE', 'TREPORT')"
                             + " and column_name not like 'SYS_NC%$' ";

                DataSet ds = new DataSet();

                using (RisDAL dal = new RisDAL())
                {
                    dal.ExecuteQuery(sql, ds, "ReportColumn");

                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        string rptCol = "";
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            string alias = ds.Tables[0].Rows[i]["TBLNAME"].ToString() + ReportCommon.ReportCommon.FIELD_SEPERATOR + ds.Tables[0].Rows[i]["COLNAME"].ToString();
                            if (alias.Length > 30)
                            {
                                alias = alias.Substring(0, 30);
                            }

                            rptCol += ds.Tables[0].Rows[i]["TBLNAME"].ToString() + "." + ds.Tables[0].Rows[i]["COLNAME"].ToString() + " as "
                                      + alias + ", ";
                        }

                        rptCol = rptCol.Trim(", ".ToCharArray());

                        if (dal != null)
                        {
                            dal.Dispose();
                        }

                        return(rptCol);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetReportInfoDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return("*");
        }
Esempio n. 9
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in GetReportHistoryDAO!"));
                }

                string patientID = "", reportGuid = "", strType = "";

                foreach (string key in paramMap.Keys)
                {
                    if (key.ToUpper() == "REPORTGUID" || key.ToUpper() == "REPORTID")
                    {
                        reportGuid = paramMap[key] as string;

                        if (reportGuid == null)
                        {
                            reportGuid = "";
                        }
                    }
                }
                using (RisDAL dal = new RisDAL())
                {
                    string    sql = "select PrintCopies from tReport where ReportGuid ='" + reportGuid + "'";
                    DataTable dt  = dal.ExecuteQuery(sql);

                    if (dt != null && dt.Rows.Count == 1)
                    {
                        int count = Convert.ToInt32(dt.Rows[0][0]);
                        return(count = (count >= 0 ? count : 0));
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetReportPrintCopiesCountDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(0);
        }
Esempio n. 10
0
        public override bool GetStaff(string strDegreeName, DataSet ds)
        {
            bool      bReturn = true;
            RisDAL    oKodak  = new RisDAL();
            DataTable dt      = new DataTable();

            try
            {
                strDegreeName.Trim();

                string strSQL;
                if (strDegreeName.Length == 0)
                {
                    //throw new Exception("DegreeName must not be null");
                    strSQL = string.Format("Select DISTINCT  tUser.LocalName,tUser.loginname,tUser.UserGuid from tUser where tUser.DeleteMark=0 ", strDegreeName);
                }
                else
                {
                    strSQL = string.Format("Select DISTINCT  tUser.LocalName,tUser.loginname,tUser.UserGuid from tUser,tRole2User where (tUser.DeleteMark=0) and  (tUser.UserGuid=tRole2User.UserGuid) and INSTR((Select Value From tSystemProfile where Name='{0}'),tRole2User.RoleName)>0 ", strDegreeName);
                }


                oKodak.ExecuteQuery(strSQL, dt);
                dt.TableName = "Staff";
                ds.Tables.Add(dt);
            }
            catch (Exception ex)
            {
                bReturn = false;

                logger.Error(100, "CommonFunction", 53, ex.Message, Application.StartupPath.ToString(), new System.Diagnostics.StackFrame(true).GetFileName().ToString(),
                             Convert.ToInt32(new System.Diagnostics.StackFrame(true).GetFileLineNumber().ToString()));
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
                if (oKodak != null)
                {
                    oKodak.Dispose();
                }
            }
            return(bReturn);
        }
Esempio n. 11
0
        public DataSet GetGridCol(string gridName, string userGuid)
        {
            try
            {
                gridName = gridName == null ? "" : gridName.Trim();
                userGuid = userGuid == null ? "" : userGuid.Trim();

                if (gridName.Length > 0)
                {
                    string sql = " select * from tGridColumnOption"
                                 + " left join tGridColumn on tGridColumn.Guid = tGridColumnOption.Guid"
                                 + "	and tGridColumn.UserGuid is null"
                                 + " where tGridColumnOption.listname = '" + gridName + "'"
                                 + " order by tGridColumnOption.OrderID";



                    DataSet ds = new DataSet();

                    using (RisDAL dal = new RisDAL())
                    {
                        dal.ExecuteQuery(sql, ds, "GridColumn");

                        return(ds);
                    }
                }
                else
                {
                    throw (new Exception("Missing Parameter!"));
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetGridColumnDAO_ORACLE, MSG=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 12
0
        /// <summary>
        /// GetSystemProfile_String
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static string GetSystemProfile_String(string name)
        {
            if (name == null || (name = name.Trim()).Length < 1)
            {
                return("");
            }


            DataTable dt = new DataTable();

            try
            {
                string strSQL = "Select value From tSystemProfile Where Name = '" + name + "'";


                using (RisDAL oKodak = new RisDAL())
                {
                    dt = oKodak.ExecuteQuery(strSQL);
                }
                if (dt != null && dt.Rows.Count > 0 && dt.Columns.Count > 0)
                {
                    return(dt.Rows[0][0] as string);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false);

                RISLog_Error(0, "GetSystemProfile_String, MSG=" + ex.Message,
                             (new System.Diagnostics.StackFrame(true)).GetFileName(),
                             (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }

            return("");
        }
Esempio n. 13
0
        public override DsProfile LoadRoleProfile(string ModuleID, string RoleID)
        {
            RisDAL    oKodakDAL = new RisDAL();
            DsProfile m_ds      = new DsProfile();

            try
            {
                string szQuery1 = "select Name, nvl(Value, '') as Value, ModuleID, Exportable, nvl(PropertyDesc, '') as PropertyDesc, nvl(PropertyOptions, '') as PropertyOptions, Inheritance, PropertyType, IsHidden, OrderingPos FROM tRoleProfile " +
                                  " where  (ModuleID = '" + ModuleID + "') and (RoleName = '" + RoleID + "')";
                oKodakDAL.ExecuteQuery(szQuery1, m_ds, "Profile");
                foreach (DataRow myRow in m_ds.Tables["Profile"].Rows)
                {
                    if (myRow["Value"].Equals(DBNull.Value))
                    {
                        myRow["Value"] = "";
                    }
                    if (myRow["PropertyDesc"].Equals(DBNull.Value))
                    {
                        myRow["PropertyDesc"] = "";
                    }
                    if (myRow["PropertyOptions"].Equals(DBNull.Value))
                    {
                        myRow["PropertyOptions"] = "";
                    }
                }
            }
            catch (Exception Ex)
            {
                logger.Error((long)ModuleEnum.Framework_Client, ModuleInstanceName.Framework, 1, Ex.Message,
                             string.Empty, (new System.Diagnostics.StackFrame(true)).GetFileName(),
                             (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
                m_ds = null;
            }
            finally
            {
                if (oKodakDAL != null)
                {
                    oKodakDAL.Dispose();
                }
            }
            return(m_ds);
        }
Esempio n. 14
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in GetLeaveSoundDAO!"));
                }



                string strReportGuid = paramMap["ReportGuid"] as string;



                DataSet ds = new DataSet();


                using (RisDAL oKodak = new RisDAL())
                {
                    string    strSQL       = string.Format("select A.SoundGuid,A.ReportGuid,A.Path,A.Status,A.LeaveTime,A.Owner,B.LocalName from tLeaveSound A,tUser B where A.Owner=B.UserGuid and ReportGuid='{0}' order  by LeaveTime desc", strReportGuid);
                    DataTable dtLeaveSound = oKodak.ExecuteQuery(strSQL);
                    ds.Tables.Add(dtLeaveSound);
                    return(ds);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetLeaveSoundDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
                return(null);
            }

            return(null);
        }
Esempio n. 15
0
        /// <summary>
        /// GetLocalName
        /// </summary>
        /// <param name="userGuid"></param>
        /// <returns></returns>
        public static string GetLocalName(string userGuid)
        {
            try
            {
                if (userGuid != null && (userGuid = userGuid.Trim()).Length > 0)
                {
                    using (RisDAL dal = new RisDAL())
                    {
                        DataTable dt  = new DataTable();
                        string    sql = "";

                        //multi userguid
                        if (userGuid.Length > Guid.NewGuid().ToString().Length)
                        {
                            string tmp = "'" + userGuid.Replace(",", "','") + "'";
                            sql = "select UserGuid,LocalName from tUser where UserGuid in(" + tmp + ")";
                            dal.ExecuteQuery(sql, dt);
                            if (null != dt && dt.Rows.Count > 0)
                            {
                                tmp = "";
                                foreach (string str in userGuid.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
                                {
                                    DataRow[] drs = dt.Select("UserGuid='" + str + "'");
                                    if (drs.Length > 0)
                                    {
                                        tmp += drs[0]["LocalName"].ToString() + ",";
                                    }
                                    else
                                    {
                                        tmp += str + ",";
                                    }
                                }
                                tmp = tmp.TrimEnd(",".ToCharArray());
                                return(tmp);
                            }
                            return("");
                        }
                        else
                        {
                            sql = "select rolename, tUser.userGuid, LoginName, localName, englishname "
                                  + " from tUser, tRole2User"
                                  + " where tUser.UserGuid = tRole2User.UserGuid"
                                  + " and tUser.UserGuid = '" + userGuid + "'";

                            dal.ExecuteQuery(sql, dt);

                            if (dt != null && dt.Rows.Count > 0)
                            {
                                string retName = dt.Rows[0]["LocalName"].ToString();


                                return(retName);
                            }
                        }
                        if (dal != null)
                        {
                            dal.Dispose();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetLocalName=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return("");
        }
Esempio n. 16
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> inMap = param as Dictionary <string, object>;
                string  sql = null;
                DataSet ds  = new DataSet();
                using (RisDAL dal = new RisDAL())
                {
                    if (inMap == null || inMap.Count < 1)
                    {
                        throw (new Exception("No parameter!"));
                    }

                    foreach (string key in inMap.Keys)
                    {
                        string value = "";
                        value = inMap[key].ToString().ToUpper();

                        if (value == "MODALITYTYPE-MODALITY")
                        {
                            sql = "select distinct modality as text,modalityType, modality as value  from tModality";
                            DataTable dt = new DataTable("ModalityType_Modality");
                            dal.ExecuteQuery(sql, dt);
                            ds.Tables.Add(dt);
                        }
                        else if (value == "MODALITYTYPE-DESCRIPTION")
                        {
                            sql = "select distinct Description as text, modalityType,Description as value  from tProcedureCode";
                            DataTable dt = new DataTable("ModalityType_DESCRIPTION");
                            dal.ExecuteQuery(sql, dt);
                            ds.Tables.Add(dt);
                        }
                        else if (value == "MODALITYTYPE-BODYPART")
                        {
                            sql = "select distinct bodypart as text, modalityType,bodypart as value from tProcedureCode";
                            DataTable dt = new DataTable("ModalityType_BodyPart");
                            dal.ExecuteQuery(sql, dt);
                            ds.Tables.Add(dt);
                        }
                        else if (value == "MODALITYTYPE-CHECKINGITEM")
                        {
                            //EK_HI00064564 Foman 2007.12.26   "select distinct modalityType,CheckingItem as text,  CheckingItem as value  from tProcedureCode""
                            sql = "select distinct CheckingItem as text, modalityType, CheckingItem as value  from tProcedureCode";
                            DataTable dt = new DataTable("ModalityType_CheckingItem");
                            dal.ExecuteQuery(sql, dt);
                            ds.Tables.Add(dt);
                        }
                    }
                }

                return(ds);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetConditionRelatedControlDataDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }
            return(null);
        }
Esempio n. 17
0
        /// <summary>
        /// Get Width of table column
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="fieldName"></param>
        /// <returns></returns>
        public static int GetColumnWidth(string tableName, string fieldName)
        {
            if (tableName == null || (tableName = tableName.Trim()).Length < 1 ||
                fieldName == null || (fieldName = fieldName.Trim()).Length < 1)
            {
                return(0);
            }

            if (_mapFieldWidth == null)
            {
                _mapFieldWidth = new Dictionary <string, int>();
            }

            if (_mapFieldWidth == null)
            {
                System.Diagnostics.Debug.Assert(false);
                return(0);
            }

            string key = tableName.ToUpper().Trim() + "," + fieldName.ToUpper().Trim();

            if (_mapFieldWidth.ContainsKey(key))
            {
                return(_mapFieldWidth[key]);
            }


            DataTable dt = new DataTable();

            try
            {
                using (RisDAL oKodak = new RisDAL())
                {
                    string sql = "select syscolumns.length as collength from sysobjects, syscolumns"
                                 + " where syscolumns.id=sysobjects.id and sysobjects.xtype='U'"
                                 + " and sysobjects.name='" + tableName + "' and syscolumns.name='" + fieldName + "'";

                    if (oKodak.DriverClassName.ToUpper() == "ORACLE")
                    {
                        sql = "select data_length as collength from user_tab_cols"
                              + " where table_name = '" + tableName.ToUpper() + "' and column_name = '" + fieldName.ToUpper() + "'";
                    }

                    dt = oKodak.ExecuteQuery(sql);

                    if (dt != null && dt.Rows.Count > 0 && dt.Columns.Count > 0)
                    {
                        _mapFieldWidth.Add(key, System.Convert.ToInt32(dt.Rows[0][0]));

                        return(_mapFieldWidth[key]);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false);

                RISLog_Error(0, "GetColumnWidth, MSG=" + ex.Message,
                             (new System.Diagnostics.StackFrame(true)).GetFileName(),
                             (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }

            return(0);
        }
Esempio n. 18
0
        public object Execute(object param)
        {
            try
            {
                #region Parse the parameters

                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    //throw (new Exception("No parameter in GetReportsListDAO!"));

                    ServerPubFun.RISLog_Info(0, "No parameter in GetReportsListDAO!", "", 0);
                }

                using (RisDAL dal = new RisDAL())
                {
                    string condition = "", userGuid = "", panelName = GRIDNAME_DEFAULT;
                    int    nPagesize = 0, nCurpage = 0;

                    foreach (string key in paramMap.Keys)
                    {
                        if (key.ToUpper() == "CONDITION")
                        {
                            condition = paramMap[key] as string;

                            if (condition == null)
                            {
                                condition = "";
                            }
                        }
                        else if (key.ToUpper() == "PAGESIZE")
                        {
                            nPagesize = System.Convert.ToInt32(paramMap[key] as string);
                        }
                        else if (key.ToUpper() == "CURPAGE")
                        {
                            nCurpage = System.Convert.ToInt32(paramMap[key] as string);
                        }
                        else if (key.ToUpper() == "USERID")
                        {
                            userGuid = paramMap[key] as string;
                        }
                        else if (key.ToUpper() == "PANELNAME")
                        {
                            panelName = paramMap[key] as string;
                        }
                    }

                    condition = condition == null ? "" : condition;
                    userGuid  = userGuid == null ? "" : userGuid;
                    panelName = panelName == null ? "" : panelName;
                    nPagesize = nPagesize < 1 ? ReportCommon.ReportCommon.DEFAULT_PAGESIZE : nPagesize;
                    nCurpage  = nCurpage < 1 ? 0 : nCurpage;

                    #endregion

                    #region Compose SQL sentense

                    string sqlcol = GetSqlCol(panelName, userGuid).Trim();
                    sqlcol = sqlcol.Length > 0 ? sqlcol : "No Grid Column Setting!";

                    string sql = "";

                    if (nPagesize * (nCurpage + 1) >= 5000 || nPagesize * (nCurpage + 1) < 0)
                    {
                        sql += "select " + sqlcol + ",tRegProcedure.Status as RPStatus,tRegProcedure.Optional3 as IsLocked  \r\n"
                               + " from tRegPatient, tRegOrder, tRegProcedure \r\n"
                               + " left join tReport on tRegProcedure.reportGuid = tReport.reportGuid \r\n"
                               + " , tProcedureCode"
                               + " where tRegPatient.PatientGuid = tRegOrder.PatientGuid \r\n"
                               + " and tRegOrder.OrderGuid = tRegProcedure.OrderGuid \r\n"
                               + " and tRegProcedure.ProcedureCode = tProcedureCode.ProcedureCode \r\n"
                               + " and tRegProcedure.status >= " + System.Convert.ToInt32(ReportCommon.RP_Status.Examination);
                    }
                    else
                    {
                        sql += "select " + sqlcol + ",tRegProcedure.Status as RPStatus,tRegProcedure.Optional3 as IsLocked  \r\n"
                               + " from tRegPatient, tRegOrder, tRegProcedure \r\n"
                               + " left join tReport on tRegProcedure.reportGuid = tReport.reportGuid \r\n"
                               + " , tProcedureCode"
                               + " where tRegPatient.PatientGuid = tRegOrder.PatientGuid \r\n"
                               + " and tRegOrder.OrderGuid = tRegProcedure.OrderGuid \r\n"
                               + " and tRegProcedure.ProcedureCode = tProcedureCode.ProcedureCode \r\n"
                               + " and rownum < " + (nPagesize * (nCurpage + 1)).ToString()
                               + " and tRegProcedure.status >= " + System.Convert.ToInt32(ReportCommon.RP_Status.Examination);
                    }

                    if (condition.Length > 0)
                    {
                        while ((condition = condition.Trim()).Length > 0 && condition.ToUpper().EndsWith("AND"))
                        {
                            condition = condition.Substring(0, condition.Length - 3);
                        }

                        sql += " and " + getOracleDateString(condition);
                    }

                    #endregion

                    #region Execute Query

                    DataSet ds = new DataSet();

                    //if (nCurpage < 10)
                    //{
                    //    sql = " select * from (" + sql + ") _ReportA where _rowindex between " + (nCurpage * nPagesize + 1).ToString() + " and " + ((nCurpage + 1) * nPagesize).ToString();

                    //    ReportCommon.ReportCommon.WriteDebugLog("CurPage=" + nCurpage.ToString() + "\r\n" + sql);

                    //    dal.ExecuteQuery(sql, ds, "ReportsList");
                    //}
                    //else
                    {
                        DataSet tmp = new DataSet();



                        dal.ExecuteQuery(sql, tmp, "ReportsList");

                        if (tmp != null && tmp.Tables.Count > 0)
                        {
                            //DataTable dt = tmp.Tables[0].Clone();
                            DataTable dt = new DataTable();

                            foreach (DataColumn dc in tmp.Tables[0].Columns)
                            {
                                dt.Columns.Add(dc.ColumnName, dc.DataType, dc.Expression);
                            }

                            if (tmp.Tables[0].Rows.Count > 0)
                            {
                                if (tmp.Tables[0].Rows.Count <= (Int64)nCurpage * nPagesize)
                                {
                                    int ipage = (tmp.Tables[0].Rows.Count - 1) / nPagesize;
                                    for (int i = ipage * nPagesize; i < tmp.Tables[0].Rows.Count; i++)
                                    {
                                        DataRow dr = dt.NewRow();

                                        foreach (DataColumn col in dt.Columns)
                                        {
                                            dr[col.ColumnName] = tmp.Tables[0].Rows[i][col.ColumnName];
                                        }

                                        dt.Rows.Add(dr);
                                    }

                                    nCurpage = ipage;
                                }
                                else
                                {
                                    for (int i = nCurpage * nPagesize; i < (nCurpage + 1) * nPagesize && i < tmp.Tables[0].Rows.Count; i++)
                                    {
                                        DataRow dr = dt.NewRow();

                                        foreach (DataColumn col in dt.Columns)
                                        {
                                            dr[col.ColumnName] = tmp.Tables[0].Rows[i][col.ColumnName];
                                        }

                                        dt.Rows.Add(dr);
                                    }
                                }
                            }
                            else
                            {
                                nCurpage = 0;
                            }

                            ds.Tables.Add(dt);
                        }
                    }

                    #endregion



                    Dictionary <string, object> outMap = new Dictionary <string, object>();

                    outMap.Add("DataSet", ds);
                    outMap.Add("CurPage", nCurpage);

                    return(outMap);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetReportsListDAO_ORACLE=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 19
0
        /// <summary>
        /// Get Report Info by rp guid
        /// </summary>
        /// <param name="rpGuid"></param>
        /// <returns></returns>
        public static tagReportInfo GetReportInfo2(string rpGuid)
        {
            int    idx = rpGuid.IndexOf(',');
            string rp  = rpGuid;

            if (idx > 0 && idx < rpGuid.Length)
            {
                rp = rpGuid.Substring(0, idx);
            }
            rp = rp.Trim("' ".ToCharArray());


            string sql = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED \r\n" +
                         " select "
                         + "  tRegPatient.patientID, tRegPatient.localName, tRegPatient.EnglishName, tRegPatient.address, tRegPatient.telephone,"
                         + "  tRegPatient.isVip, tRegPatient.Comments tRegPatient__Comments, tRegPatient.remotePID tRegPatient__remotePID,"
                         + "  tRegPatient.Gender as tRegPatient__Gender, tRegPatient.Birthday as tRegPatient__Birthday,"
                         + "  tRegOrder.inhospitalNo, tRegOrder.clinicNo, tRegOrder.PatientType, tRegOrder.Observation, "
                         + "  tRegOrder.inHospitalRegion, tRegOrder.BedNo, tRegOrder.comments tRegOrder__orderComment,"
                         + "  tRegOrder.OrderGuid as tRegOrder__OrderGuid, tRegOrder.AccNo, tRegOrder.applyDept as tRegOrder__applyDept,"
                         + "  tRegOrder.applyDoctor as tRegOrder__applyDoctor, tRegOrder.VisitComment tRegOrder__VisitComment,"
                         + "  tRegOrder.remoteAccNo,"
                         + "  tRegProcedure.ProcedureGuid as tRegProcedure__ProcedureGuid, tRegProcedure.status as tRegProcedure__status, "
                         + "  tRegProcedure.charge, tRegProcedure.ModalityType, tRegProcedure.Modality, "
                         + "  tRegProcedure.Registrar, tRegProcedure.RegisterDt, tRegProcedure.Technician, "
                         + "  tRegProcedure.OperationStep, tRegProcedure.ExamineDt, tRegProcedure.comments tRegProcedure__comments, "
                         + "  tRegProcedure.isCharge, tRegProcedure.ProcedureCode tRegProcedure__ProcedureCode, "
                         + "  tRegProcedure.RPDesc tProcedureCode__Description, tRegProcedure.bodypart tProcedureCode__bodypart, "
                         + "  tReport.reportGuid, "
                         + "  tReport.ReportName, tReport.techInfo, tReport.wysText, tReport.wygText, "
                         + "  tReport.WYS, tReport.WYG, "
                         + "  tReport.creater as tReport__creater, tReport.createDt as tReport__createDt,"
                         + "  tReport.submitter as tReport__submitter, tReport.submitDt as tReport__submitDt,"
                         + "  tReport.firstApprover as tReport__firstApprover, tReport.firstApproveDt as tReport__firstApproveDt,"
                         + "  tReport.rejectDt as tReport__rejectDt"
                         + "  from tRegPatient with (nolock), "
                         + "  tRegOrder with (nolock), tRegProcedure with (nolock) "
                         + "  left join tReport with (nolock) on tRegProcedure.reportGuid = tReport.reportGuid "
                         + "  where tRegPatient.PatientGuid = tRegOrder.PatientGuid "
                         + "  and tRegOrder.OrderGuid = tRegProcedure.OrderGuid "
                         + " and tRegProcedure.procedureGuid = '" + rp + "'";

            DataTable dt = new DataTable("ReportInfo");



            tagReportInfo ri = new tagReportInfo();

            if (0 == iWrittenCount++ % 100)
            {
                ServerPubFun.RISLog_Info(0, "GetReportInfo2, SQL=" + sql,
                                         (new System.Diagnostics.StackFrame()).GetFileName(),
                                         (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }
            else
            {
                ServerPubFun.RISLog_Info(0, "GetReportInfo2, rpGuid=" + rpGuid,
                                         (new System.Diagnostics.StackFrame()).GetFileName(),
                                         (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }
            using (RisDAL dal = new RisDAL())
            {
                dal.ExecuteQuery(sql, dt);

                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];

                    ri.status           = ReportCommon.Converter.toInt(dr["tRegProcedure__status"]);
                    ri.dept             = dr["tRegOrder__applyDept"] as string;
                    ri.orderGuid        = dr["tRegOrder__OrderGuid"] as string;
                    ri.reportGuid       = dr["reportGuid"] as string;
                    ri.reportName       = dr["reportName"] as string;
                    ri.AccNO            = dr["AccNO"] as string;
                    ri.patientID        = dr["PatientID"] as string;
                    ri.patientName      = dr["EnglishName"] as string;
                    ri.patientLocalName = dr["LocalName"] as string;
                    // ri.patientAlias = dr["Alias"] as string;
                    ri.patientAddress = dr["Address"] as string;
                    ri.patientPhone   = dr["TelePhone"] as string;
                    // ri.patientMarriage = dr["Marriage"] as string;
                    ri.gender           = dr["tRegPatient__Gender"] as string;
                    ri.patientType      = dr["PatientType"] as string;
                    ri.remotePID        = dr["tRegPatient__remotePID"] as string;
                    ri.modality         = dr["Modality"] as string;
                    ri.modalityType     = dr["modalityType"] as string;
                    ri.operationStep    = dr["operationStep"] as string;
                    ri.reportCreater    = dr["tReport__creater"] as string;
                    ri.reportSubmitter  = dr["tReport__submitter"] as string;
                    ri.reportApprover   = dr["tReport__firstApprover"] as string;
                    ri.reportCreateDt   = ReportCommon.ReportCommon.GetDateTime(dr["tReport__createDt"]);
                    ri.reportSubmitDt   = ReportCommon.ReportCommon.GetDateTime(dr["tReport__submitDt"]);
                    ri.reportApproveDt  = ReportCommon.ReportCommon.GetDateTime(dr["tReport__firstApproveDt"]);
                    ri.reportRejectDt   = ReportCommon.ReportCommon.GetDateTime(dr["tReport__rejectDt"]);
                    ri.birthday         = ReportCommon.ReportCommon.GetDateTime(dr["tRegPatient__birthday"]);
                    ri.registerDt       = ReportCommon.ReportCommon.GetDateTime(dr["registerDt"]);
                    ri.examineDt        = ReportCommon.ReportCommon.GetDateTime(dr["examineDt"]);
                    ri.inHospitalRegion = dr["inHospitalRegion"] as string;
                    ri.visitNo          = dr["clinicNo"] as string;
                    ri.bedNo            = dr["bedNo"] as string;
                    ri.isVIP            = ReportCommon.Converter.toInt(dr["isVip"]).ToString();
                    ri.inHospitalNo     = dr["inhospitalNo"] as string;
                    ri.patientComment   = dr["tRegPatient__Comments"] as string;
                    ri.remoteAccNo      = dr["remoteAccNo"] as string;

                    ri.applyDoctor       = dr["tRegOrder__applyDoctor"] as string;
                    ri.visitComments     = dr["tRegOrder__visitComment"] as string;
                    ri.observation       = dr["Observation"] as string;
                    ri.orderComments     = dr["tRegOrder__orderComment"] as string;
                    ri.technician        = dr["technician"] as string;
                    ri.procedureComments = dr["remoteAccNo"] as string;
                    ri.isCharge          = ReportCommon.Converter.toInt(dr["isCharge"]).ToString();

                    string tmp     = "";
                    double dChange = 0;
                    foreach (DataRow tmpDr in dt.Rows)
                    {
                        tmp = tmpDr["tProcedureCode__bodypart"] as string;
                        if (tmp != null)
                        {
                            ri.bodypart += tmp + ", ";
                        }

                        tmp = tmpDr["tRegProcedure__ProcedureCode"] as string;
                        if (tmp != null)
                        {
                            ri.procedureCode += tmp + ", ";
                        }

                        tmp = tmpDr["tProcedureCode__Description"] as string;
                        if (tmp != null)
                        {
                            ri.procedureDesc += tmp + ", ";
                        }

                        double dTmp = System.Convert.ToDouble(tmpDr["charge"]);
                        dChange += dTmp;
                    }
                    ri.bodypart      = ri.bodypart.Trim(", ".ToCharArray());
                    ri.procedureCode = ri.procedureCode.Trim(", ".ToCharArray());
                    ri.procedureDesc = ri.procedureDesc.Trim(", ".ToCharArray());
                    ri.charge        = dChange.ToString();

                    ri.reportCreater_LocalName   = ServerPubFun.GetLocalName(ri.reportCreater);
                    ri.reportSubmitter_LocalName = ServerPubFun.GetLocalName(ri.reportSubmitter);
                    ri.reportApprover_LocalName  = ServerPubFun.GetLocalName(ri.reportApprover);
                    ri.technician__LocalName     = ServerPubFun.GetLocalName(ri.technician);

                    ri.duration = System.Convert.ToString(ri.examineDt - ri.registerDt);

                    Byte[] buff = dr["wys"] as Byte[];
                    if (buff == null)
                    {
                        ri.wys = "";
                    }
                    else
                    {
                        ri.wys = ReportCommon.Converter.GetStringFromBytes(buff);
                    }

                    buff = dr["wyg"] as Byte[];
                    if (buff == null)
                    {
                        ri.wyg = "";
                    }
                    else
                    {
                        ri.wyg = ReportCommon.Converter.GetStringFromBytes(buff);
                    }

                    //buff = dr["wysText"] as Byte[];
                    //if (buff == null)
                    ri.wysText = dr["wysText"] as string;
                    //else
                    //  ri.wysText = ReportCommon.Converter.GetStringFromBytes(buff);

                    // buff = dr["wygText"] as Byte[];
                    //if (buff == null)
                    ri.wygText = dr["wygText"] as string;
                    //else
                    //  ri.wygText = ReportCommon.Converter.GetStringFromBytes(buff);

                    ri.techinfo = System.Convert.ToString(dr["techinfo"]);
                }
            }

            return(ri);
        }
Esempio n. 20
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in GetLockDAO!"));
                }

                string userGuid              = "";
                string reportGuid            = "";
                string SignActions           = "";
                string certsn                = "";
                bool   IsGetDigitalSignImage = false;

                foreach (string key in paramMap.Keys)
                {
                    if (key.ToUpper() == "USERGUID")
                    {
                        userGuid = paramMap[key] as string;

                        if (userGuid == null)
                        {
                            userGuid = "";
                        }
                    }
                    if (key.ToUpper() == "REPORTGUID")
                    {
                        reportGuid = paramMap[key] as string;

                        if (reportGuid == null)
                        {
                            reportGuid = "";
                        }
                    }

                    if (key.ToUpper() == "ISGETDIGITALSIGNIMAGE")
                    {
                        IsGetDigitalSignImage = Convert.ToBoolean(paramMap[key]);
                    }

                    if (key.ToUpper() == "SIGNACTIONS")
                    {
                        SignActions = Convert.ToString(paramMap[key]);
                    }
                }



                DataSet ds = new DataSet();

                //dal.BeginTransaction();

                try
                {
                    using (RisDAL dal = new RisDAL())
                    {
                        if (reportGuid.Trim().Length > 0)
                        {
                            string    strSQL = string.Format("SELECT Creater,Submitter,FirstApprover,SecondApprover FROM tReport WHERE REPORTGUID = '{0}'", reportGuid);
                            DataTable dt     = dal.ExecuteQuery(strSQL);


                            if (dt == null || dt.Rows.Count == 0)
                            {
                                return(null);
                            }

                            string strCreater = "", strFirstApprover = "", strSubmitter = "", strSecondApprover = "";
                            if (dt.Rows[0]["Creater"] != null)
                            {
                                strCreater = Convert.ToString(dt.Rows[0]["Creater"]);
                            }

                            if (dt.Rows[0]["FirstApprover"] != null)
                            {
                                strFirstApprover = Convert.ToString(dt.Rows[0]["FirstApprover"]);
                            }

                            if (dt.Rows[0]["Submitter"] != null)
                            {
                                strSubmitter = Convert.ToString(dt.Rows[0]["Submitter"]);
                            }

                            if (dt.Rows[0]["SecondApprover"] != null)
                            {
                                strSecondApprover = Convert.ToString(dt.Rows[0]["SecondApprover"]);
                            }

                            if (!IsGetDigitalSignImage)
                            {
                                if (strCreater.Length > 0)
                                {
                                    strSQL = string.Format("SELECT SignImage FROM tUser WHERE userguid = '{0}'", strCreater);
                                    DataTable dtCreater = dal.ExecuteQuery(strSQL);
                                    dtCreater.TableName = "CreaterSignImage";
                                    ds.Tables.Add(dtCreater);
                                }

                                if (strFirstApprover.Length > 0)
                                {
                                    strSQL = string.Format("SELECT SignImage FROM tUser WHERE userguid = '{0}'", strFirstApprover);
                                    DataTable dtFirstApprover = dal.ExecuteQuery(strSQL);
                                    dtFirstApprover.TableName = "FirstApproverSignImage";
                                    ds.Tables.Add(dtFirstApprover);
                                }

                                if (strSubmitter.Length > 0)
                                {
                                    strSQL = string.Format("SELECT SignImage FROM tUser WHERE userguid = '{0}'", strSubmitter);
                                    DataTable dtSubmitter = dal.ExecuteQuery(strSQL);
                                    dtSubmitter.TableName = "SubmitterSignImage";
                                    ds.Tables.Add(dtSubmitter);
                                }

                                if (strSecondApprover.Length > 0)
                                {
                                    strSQL = string.Format("SELECT SignImage FROM tUser WHERE userguid = '{0}'", strSecondApprover);
                                    DataTable dtSecondApprover = dal.ExecuteQuery(strSQL);
                                    dtSecondApprover.TableName = "SecondApproverSignImage";
                                    ds.Tables.Add(dtSecondApprover);
                                }
                            }
                            else
                            {
                                #region CA sign pic
                                string[] signActionsArr = SignActions.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                                if (signActionsArr.Length > 0)
                                {
                                    bool isSubmitAction, isApproveAction, isSecondApproveAction;
                                    isSubmitAction = isApproveAction = isSecondApproveAction = false;
                                    foreach (string act in signActionsArr)
                                    {
                                        if (act.Equals("submitreport", StringComparison.OrdinalIgnoreCase))
                                        {
                                            isSubmitAction = true;
                                        }
                                        else if (act.Equals("approvereport", StringComparison.OrdinalIgnoreCase))
                                        {
                                            isApproveAction = true;
                                        }
                                        else if (act.Equals("secondapprovereport", StringComparison.OrdinalIgnoreCase))
                                        {
                                            isSecondApproveAction = true;
                                        }
                                    }
                                    if (isSubmitAction)
                                    {
                                        strSQL = string.Format("SELECT signpic FROM tUserCerts WHERE certsn = (select top 1 certsn  from tsignedhistory where reportguid ='{0}' and action='submitreport' order by createdt desc)", reportGuid);
                                        dal.ExecuteQuery(strSQL, ds, "SubmitterSignImage");
                                    }

                                    if (isApproveAction)
                                    {
                                        strSQL = string.Format("SELECT signpic FROM tUserCerts WHERE certsn = (select top 1 certsn  from tsignedhistory where reportguid ='{0}' and action='ApproveReport' order by createdt desc)", reportGuid);
                                        dal.ExecuteQuery(strSQL, ds, "FirstApproverSignImage");
                                    }

                                    if (isSecondApproveAction)
                                    {
                                        strSQL = string.Format("SELECT signpic FROM tUserCerts WHERE certsn = (select top 1 certsn  from tsignedhistory where reportguid ='{0}' and action='SecondApproveReport' order by createdt desc)", reportGuid);
                                        dal.ExecuteQuery(strSQL, ds, "SecondApproverSignImage");
                                    }
                                }
                                #endregion
                            }
                        }
                        else
                        {
                            string strSQL = string.Format("SELECT SignImage FROM tUser WHERE userguid = '{0}'", userGuid);

                            dal.ExecuteQuery(strSQL, ds, "SignImage");
                        }
                    }
                }
                catch (Exception ex)
                {
                    //dal.RollbackTransaction();

                    System.Diagnostics.Debug.Assert(false, ex.Message);

                    throw (ex);
                }

                //dal.CommitTransaction();



                return(ds);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetLockDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 21
0
        public DataSet GetGridCol(string gridName, string userGuid)
        {
            try
            {
                gridName = gridName == null ? "" : gridName.Trim();
                userGuid = userGuid == null ? "" : userGuid.Trim();

                if (gridName.Length > 0)
                {
                    /*
                     * string sql = "if exists(select 1 from tGridColumn, tGridColumnOption"
                     + " where tGridColumn.Guid = tGridColumnOption.Guid"
                     + " and tGridColumnOption.listname = '" + gridName + "' and tGridColumn.UserGuid = '" + userGuid + "') \r\n"
                     + "  select * from tGridColumn, tGridColumnOption"
                     + "  where tGridColumn.Guid = tGridColumnOption.Guid"
                     + "  and tGridColumnOption.listname = '" + gridName + "'"
                     + "  and tGridColumn.UserGuid = '" + userGuid + "' order by tGridColumn.OrderID \r\n"
                     + " else if exists(select 1 from tGridColumn, tGridColumnOption"
                     + " where tGridColumn.Guid = tGridColumnOption.Guid"
                     + " and tGridColumnOption.listname = '" + gridName + "' and tGridColumn.UserGuid = '') \r\n"
                     + "  select * from tGridColumn, tGridColumnOption"
                     + "  where tGridColumn.Guid = tGridColumnOption.Guid"
                     + "  and tGridColumnOption.listname = '" + gridName + "'"
                     + "  and tGridColumn.UserGuid = '' order by tGridColumn.OrderID \r\n"
                     + " else \r\n"
                     + "  select * from tGridColumnOption"
                     + "  left join tGridColumn on tGridColumn.Guid = tGridColumnOption.Guid"
                     + "	 and tGridColumn.UserGuid = ''"
                     + "  where tGridColumnOption.listname = '" + gridName + "' order by tGridColumnOption.OrderID";
                     */
                    string sql = string.Format("select tGridColumn.Guid,tGridColumn.ColumnWidth,tGridColumn.IsHidden,tGridColumnOption.ColumnID," +
                                               " tGridColumnOption.TableName,tGridColumnOption.ColumnName,tGridColumnOption.Expression," +
                                               " tGridColumnOption.ModuleID, tGridColumnOption.isImageColumn, tGridColumnOption.ImagePath" +
                                               " from tGridColumn left join tGridColumnOption on " +
                                               " tGridColumn.Guid=tGridColumnOption.Guid where " +
                                               " tGridColumn.UserGuid='' AND tGridColumnOption.ListName='{0}' " +
                                               " order by tGridColumn.OrderID ", gridName);



                    DataSet ds = new DataSet();

                    using (RisDAL dal = new RisDAL())
                    {
                        dal.ExecuteQuery(sql, ds, "GridColumn");

                        return(ds);
                    }
                }
                else
                {
                    throw (new Exception("Missing Parameter!"));
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetGridColumnDAO_MSSQL, MSG=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 22
0
        public object Execute(object param, ref string strObjectGuids)
        {
            try
            {
                #region Parse the parameters

                Dictionary <string, object> inMap = param as Dictionary <string, object>;

                if (inMap == null || inMap.Count < 1)
                {
                    throw (new Exception("No parameter in ReportOpenPolicyDAO!"));
                }

                string RPGuids      = "";
                bool   bAssociated  = false;
                bool   bOfflineData = false;

                foreach (string key in inMap.Keys)
                {
                    switch (key.ToUpper())
                    {
                    case "RPGUIDS":
                    {
                        RPGuids = inMap[key] as string;
                    }
                    break;

                    case "ASSOCIATED":
                    {
                        bAssociated = (System.Convert.ToString(inMap[key]) == "1");
                    }
                    break;

                    case "OFFLINEDATA":
                    {
                        bOfflineData = (System.Convert.ToString(inMap[key]) == "1");
                    }
                    break;
                    }
                }

                #endregion

                string strSQL = "";

                bool bExistImage = true;
                using (RisDAL dal = new RisDAL())
                {
                    if (bAssociated)
                    {
                        string strTemp = "";
                        strSQL = string.Format(
                            "   SELECT OrderGuid,status,reportGuid FROM tregprocedure where procedureguid='{0}' ", RPGuids.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)[0]);

                        if (bOfflineData)
                        {
                            strSQL += string.Format(" UNION "
                                                    + " SELECT OrderGuid,status,reportGuid FROM RISArchive..tregprocedure where procedureguid='{0}' ", RPGuids.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)[0]);
                        }

                        DataTable dt1 = dal.ExecuteQuery(strSQL);
                        if (dt1 == null || dt1.Rows.Count < 1)
                        {
                            // RP not exists
                            return(2);
                        }

                        if (Convert.ToInt32(dt1.Rows[0]["status"]) != 50)
                        {
                            strObjectGuids = Convert.ToString(dt1.Rows[0]["ReportGuid"]);

                            if (string.IsNullOrEmpty(strObjectGuids))
                            {
                                return(2);
                            }
                            else
                            {
                                return(1);
                            }
                        }


                        strSQL = string.Format(
                            "   SELECT ProcedureGuid,IsExistImage  FROM   tregprocedure where status=50 and OrderGuid='{0}' "
                            , Convert.ToString(dt1.Rows[0]["OrderGuid"]));

                        if (bOfflineData)
                        {
                            strSQL += string.Format(" UNION "
                                                    + " SELECT ProcedureGuid,IsExistImage  FROM   RISArchive..tregprocedure where status=50 and OrderGuid='{0}' "
                                                    , Convert.ToString(dt1.Rows[0]["OrderGuid"]));
                        }

                        dt1 = dal.ExecuteQuery(strSQL);


                        foreach (DataRow dr in dt1.Rows)
                        {
                            string strRPGuid = Convert.ToString(dr["ProcedureGuid"]);
                            strTemp += strRPGuid;
                            strTemp += ",";
                            if (dr["IsExistImage"] is DBNull || dr["IsExistImage"] == null || Convert.ToInt32(dr["IsExistImage"]) == 0)
                            {
                                bExistImage = false;
                            }
                        }
                        strObjectGuids = strTemp.TrimEnd(',');
                        return(bExistImage ? 0 : 4);
                    }

                    //
                    if (RPGuids.Split(',').Length > 1)
                    {
                        RPGuids = RPGuids.Trim(", ".ToCharArray());
                        RPGuids = RPGuids.Replace(",", "','");
                        RPGuids = "'" + RPGuids + "'";
                        strSQL  = string.Format(
                            "  SELECT A.OrderGuid,A.Status,A.IsExistImage,A.ReportGuid from tRegProcedure A  where A.ProcedureGuid in({0})"
                            , RPGuids);

                        if (bOfflineData)
                        {
                            strSQL += string.Format(" UNION "
                                                    + " SELECT A.OrderGuid,A.Status,A.IsExistImage,A.ReportGuid from RISArchive..tRegProcedure A  where A.ProcedureGuid in({0})"
                                                    , RPGuids);
                        }
                    }
                    else
                    {
                        strSQL = string.Format(
                            "  SELECT A.OrderGuid,A.Status,A.IsExistImage,A.ReportGuid from tRegProcedure A where A.ProcedureGuid ='{0}'"
                            , RPGuids);

                        if (bOfflineData)
                        {
                            strSQL += string.Format(" UNION "
                                                    + " SELECT A.OrderGuid,A.Status,A.IsExistImage,A.ReportGuid from RISArchive..tRegProcedure A where A.ProcedureGuid ='{0}'"
                                                    , RPGuids);
                        }
                    }

                    DataTable dt2 = dal.ExecuteQuery(strSQL);

                    if (dt2 == null || dt2.Rows.Count == 0)
                    {
                        // RP NOT exists
                        return(2);
                    }


                    bool bSameOrder = true;

                    string    strExpression = "status>50";
                    DataRow[] drFound       = dt2.Select(strExpression);
                    if (drFound.Length != 0)
                    {
                        foreach (DataRow dr in drFound)
                        {
                            if (dr["ReportGuid"] != null && !(dr["ReportGuid"] is DBNull))
                            {
                                strObjectGuids += Convert.ToString(dr["ReportGuid"]);
                            }
                            strObjectGuids += ",";
                        }
                        strObjectGuids.TrimEnd(',');
                        return(1);
                    }
                    else
                    {
                        strObjectGuids = RPGuids;
                    }

                    strExpression = "IsExistImage=0";
                    drFound       = dt2.Select(strExpression);
                    if (drFound.Length > 0)
                    {
                        bExistImage = false;
                    }

                    if (dt2.Rows.Count > 1)
                    {
                        List <string> listOrderGuid = new List <string>();
                        foreach (DataRow dr in dt2.Rows)
                        {
                            string strOrderGuid = Convert.ToString(dr["OrderGuid"]);
                            if (listOrderGuid.Count == 0)
                            {
                                listOrderGuid.Add(strOrderGuid);
                                continue;
                            }
                            if (!listOrderGuid.Contains(strOrderGuid))
                            {
                                bSameOrder = false;
                                break;
                            }
                        }
                    }


                    if (!bSameOrder)
                    {
                        return(3);
                    }

                    if (!bExistImage)
                    {
                        return(4);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "ReportOpenPolicyDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(0);
        }
Esempio n. 23
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in GetLockDAO!"));
                }

                string action   = "";
                string lockType = "";
                string lockGuid = "";
                string owner    = "";
                string ownerIP  = "";

                foreach (string key in paramMap.Keys)
                {
                    if (key.ToUpper() == "LOCKTYPE")
                    {
                        lockType = paramMap[key] as string;

                        if (lockType == null)
                        {
                            lockType = "";
                        }
                    }
                    else if (key.ToUpper() == "LOCKGUID")
                    {
                        lockGuid = paramMap[key] as string;

                        if (lockGuid == null)
                        {
                            lockGuid = "";
                        }
                    }
                    else if (key.ToUpper() == "ACTION")
                    {
                        action = paramMap[key] as string;

                        if (action == null)
                        {
                            action = "";
                        }
                    }
                    else if (key.ToUpper() == "OWNER")
                    {
                        owner = paramMap[key] as string;

                        if (owner == null)
                        {
                            owner = "";
                        }
                    }
                    else if (key.ToUpper() == "OWNERIP")
                    {
                        ownerIP = paramMap[key] as string;

                        if (ownerIP == null)
                        {
                            ownerIP = "";
                        }
                    }
                }



                DataSet ds = new DataSet();

                //dal.BeginTransaction();

                try
                {
                    using (RisDAL dal = new RisDAL())
                    {
                        if (action.ToUpper() == "ADD")
                        {
                            string sql0 = "merge into tSync D"
                                          + " using (select " + lockType + " syncType, '" + lockGuid + "' guid, '"
                                          + owner + "' owner, '" + ownerIP + "' ownerIP from dual) S"
                                          + " on (s.synctype = d.syncType and s.guid = d.guid)"
                                          + " when not matched then insert (d.syncType, d.guid, d.owner, d.ownerIP)"
                                          + " values(s.synctype, s.guid, s.owner, s.ownerip)";
                            string sql1 = " select * from tSync, tUser where tSync.Owner = tUser.UserGuid"
                                          + " and tSync.SyncType=" + lockType + " and tSync.Guid='" + lockGuid + "' for update";
                            string sql2 = " commit";



                            dal.ExecuteNonQuery(sql0);
                            dal.ExecuteQuery(sql1, ds, "tSync");
                            dal.ExecuteNonQuery(sql2);
                        }
                        else if (action.ToUpper() == "DELETE" || action.ToUpper() == "DEL")
                        {
                            string sql0 = "delete from tSync"
                                          + " where syncType=" + lockType + " and guid='" + lockGuid + "'";
                            string sql1 = " select * from tSync, tUser where tSync.Owner = tUser.UserGuid"
                                          + " and tSync.SyncType=" + lockType + " and tSync.Guid='" + lockGuid + "' ";
                            string sql2 = " commit";

                            dal.ExecuteNonQuery(sql0);
                            dal.ExecuteQuery(sql1, ds, "tSync");
                            dal.ExecuteNonQuery(sql2);
                        }
                        else
                        {
                            string sql = "select * from tSync, tUser where tSync.Owner=tUser.UserGuid and tSync.SyncType="
                                         + lockType + " and tSync.Guid='" + lockGuid + "'";

                            dal.ExecuteQuery(sql, ds, "tSync");
                        }
                    }
                }
                catch (Exception ex)
                {
                    //dal.RollbackTransaction();

                    throw (ex);
                }

                //dal.CommitTransaction();



                return(ds);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetLockDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 24
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> inMap = param as Dictionary <string, object>;

                if (inMap == null || inMap.Count < 1)
                {
                    throw (new Exception("No parameter!"));
                }

                string parentGuid = "", userGuid = "", type = "";

                foreach (string key in inMap.Keys)
                {
                    if (key.ToUpper() == "PARENTGUID")
                    {
                        parentGuid = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "USERGUID" || key.ToUpper() == "USERID")
                    {
                        userGuid = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "TYPE")
                    {
                        type = inMap[key] as string;
                    }
                }

                parentGuid = parentGuid == null ? "" : parentGuid.Trim();
                userGuid   = userGuid == null ? "" : userGuid.Trim();
                type       = type == null ? "" : type.Trim();

                string sql = "", sql0 = "", sql1 = "";

                if (type.CompareTo("1") == 0)
                {
                    /*sql = " select * from tReportTemplateDirec left join tReportTemplate on tReportTemplate.templateGuid = tReportTemplateDirec.templateGuid \r\n"
                     + " where (tReportTemplateDirec.type = 0 or (tReportTemplateDirec.type = 1 and tReportTemplateDirec.UserGuid='" + userGuid + "')) \r\n";
                     +
                     + if (parentGuid.Length > 0)
                     + {
                     +  sql = " and tReportTemplateDirec.parentid = '" + parentGuid + "' \r\n";
                     + }
                     +
                     + sql += " order by tReportTemplateDirec.type, tReportTemplateDirec.itemorder \r\n";
                     */
                    sql = string.Format("select * from tReportTemplateDirec where ParentID = 'UserTemplate' and (type=0 or UserGuid = '{0}') order by ItemOrder", userGuid);
                }
                else if (type.CompareTo("2") == 0)
                {
                    sql0 = " select * from tPhraseTemplate where (type = 0 or type = 2 or (type = 1 and UserGuid='" + userGuid + "')) order by type, modalityType \r\n";
                }
                else if (type.CompareTo("3") == 0)
                {
                    sql1 = " select SELECT TemplateGuid,Type,TemplateName,IsDefaultByType,Version,ModalityType,IsDefaultByModality  from tPrintTemplate \r\n";
                }
                else
                {
                    sql = " select * from tReportTemplateDirec left join tReportTemplate on tReportTemplate.templateGuid = tReportTemplateDirec.templateGuid \r\n"
                          + " where (tReportTemplateDirec.type = 0 or tReportTemplateDirec.type = 2 or (tReportTemplateDirec.type = 1 and tReportTemplateDirec.UserGuid='" + userGuid + "')) and tReportTemplateDirec.DirectoryType='report' \r\n";

                    if (parentGuid.Length > 0)
                    {
                        sql = " and tReportTemplateDirec.parentid = '" + parentGuid + "' \r\n";
                    }

                    sql += " order by tReportTemplateDirec.type, tReportTemplateDirec.itemorder \r\n";

                    ////sql0 = " select * from tPhraseTemplate where (type = 0 or (type = 1 and UserGuid='" + userGuid + "')) order by type, modalityType \r\n";
                    sql0 = " select tReportTemplateDirec.*, tPhraseTemplate.TemplateGuid,tPhraseTemplate.TemplateName,tPhraseTemplate.TemplateInfo,tPhraseTemplate.ShortcutCode from tReportTemplateDirec left join tPhraseTemplate on tPhraseTemplate.templateGuid = tReportTemplateDirec.templateGuid \r\n"
                           + " where (tReportTemplateDirec.type = 0 or tReportTemplateDirec.type = 2 or (tReportTemplateDirec.type = 1 and tReportTemplateDirec.UserGuid='" + userGuid + "')) and tReportTemplateDirec.DirectoryType='phrase' order by tReportTemplateDirec.type, tReportTemplateDirec.itemorder \r\n";

                    sql1 = " SELECT TemplateGuid,Type,TemplateName,IsDefaultByType,Version,ModalityType,IsDefaultByModality from tPrintTemplate \r\n";
                }



                DataSet ds = new DataSet();

                using (RisDAL dal = new RisDAL())
                {
                    if (sql != null && sql.Length > 0)
                    {
                        DataTable dt = new DataTable("ReportTemplate");
                        dal.ExecuteQuery(sql, dt);
                        ds.Tables.Add(dt);
                    }

                    if (sql0 != null && sql0.Length > 0)
                    {
                        DataTable dt0 = new DataTable("Phrase");
                        dal.ExecuteQuery(sql0, dt0);
                        ds.Tables.Add(dt0);
                    }

                    if (sql1 != null && sql1.Length > 0)
                    {
                        DataTable dt1 = new DataTable("PrintTemplate");
                        dal.ExecuteQuery(sql1, dt1);
                        ds.Tables.Add(dt1);
                    }

                    return(ds);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetReportTemplateDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 25
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in GetReportNameDAO!"));
                }

                string reportGuid = "";
                string rpGuids    = "";
                string accNO      = "";

                foreach (string key in paramMap.Keys)
                {
                    if (key.ToUpper() == "REPORTGUID")
                    {
                        reportGuid = paramMap[key] as string;

                        if (reportGuid == null)
                        {
                            reportGuid = "";
                        }
                    }
                    else if (key.ToUpper() == "PROCEDUREGUID")
                    {
                        rpGuids = paramMap[key] as string;

                        if (rpGuids == null)
                        {
                            rpGuids = "";
                        }
                    }
                    else if (key.ToUpper() == "ACCNO")
                    {
                        accNO = paramMap[key] as string;

                        if (accNO == null)
                        {
                            accNO = "";
                        }
                    }
                }

                string sql = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED \r\n" +
                             "select " + GetAllReportColumn() + " \r\n"
                             + " from tRegPatient with (nolock), tRegOrder with (nolock), tProcedureCode with (nolock), tRegProcedure with (nolock) \r\n"
                             + " left join tReport with (nolock) on tRegProcedure.reportGuid = tReport.reportGuid \r\n"
                             + " where tRegPatient.PatientGuid = tRegOrder.PatientGuid \r\n"
                             + " and tRegOrder.OrderGuid = tRegProcedure.OrderGuid \r\n"
                             + " and tRegProcedure.ProcedureCode = tProcedureCode.ProcedureCode \r\n";

                string sqlFile = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED \r\n" +
                                 " select distinct tReportFile.* from tReportFile, tReport "
                                 + " where tReportFile.reportGuid = tReport.reportGuid";


                #region Added by Kevin For SR

                string sqlreportcontent = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED \r\n" +
                                          " select * from tReportContent"
                                          + " where tReportContent.ReportId ='" + reportGuid + "' ";

                #endregion


                if (!string.IsNullOrWhiteSpace(reportGuid))
                {
                    sql += " and tReport.reportGuid = '" + reportGuid + "'";

                    sqlFile += " and tReport.reportGuid = '" + reportGuid + "'";
                }
                else if (!string.IsNullOrWhiteSpace(rpGuids))
                {
                    rpGuids = rpGuids.Trim(", ".ToCharArray());

                    string[] arr = rpGuids.Split(',');
                    if (arr.Length > 1)
                    {
                        if (!rpGuids.Contains("','"))
                        {
                            rpGuids = rpGuids.Replace(",", "','");
                            rpGuids = "'" + rpGuids + "'";
                        }
                        sql += " and tRegProcedure.ProcedureGuid in (" + rpGuids + ")";
                    }
                    else
                    {
                        rpGuids = "'" + rpGuids + "'";
                        sql    += " and tRegProcedure.ProcedureGuid =" + rpGuids;
                    }

                    sqlFile += " and 1=2 ";
                }
                else if (!string.IsNullOrWhiteSpace(accNO))
                {
                    sql += " AND tRegOrder.ACCNO = '" + accNO.Trim() + "'";

                    sqlFile += " AND 1=2 ";
                }

                if (0 == iWrittenCount++ % 100)
                {
                    ServerPubFun.RISLog_Info(0, "GetReportInfoDAO=" + sql + ", reportFile=" + sqlFile, "", 0);
                }
                else
                {
                    ServerPubFun.RISLog_Info(0, "GetReportInfoDAO, rpGuid=" + rpGuids + ", reportGuid=" + reportGuid + ", iWrittenCount=" + iWrittenCount.ToString(), "", 0);
                }

                DataSet ds = new DataSet();

                using (RisDAL dal = new RisDAL())
                {
                    //
                    // report info
                    DataTable dt0 = new DataTable("ReportInfo");

                    dal.ExecuteQuery(sql, dt0);

                    ds.Tables.Add(dt0);

                    //
                    // report file
                    DataTable dt1 = new DataTable("ReportFile");

                    dal.ExecuteQuery(sqlFile, dt1);

                    ds.Tables.Add(dt1);

                    string    sqlPrintTemplate = "select * from tPrintTemplate where Type=3 and TemplateName='QualityControlReportTemplate'";
                    DataTable dt2 = new DataTable("PrintTemplate");
                    dal.ExecuteQuery(sqlPrintTemplate, dt2);
                    ds.Tables.Add(dt2);
                    #region Added by Kevin For SR

                    // reportcontent
                    DataTable dt3 = new DataTable("ReportContent");

                    dal.ExecuteQuery(sqlreportcontent, dt3);

                    ds.Tables.Add(dt3);

                    #endregion
                }


                return(ds);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetReportInfoDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 26
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in GetReportNameDAO!"));
                }

                string reportGuid = "";
                string rpGuids    = "";

                foreach (string key in paramMap.Keys)
                {
                    if (key.ToUpper() == "REPORTGUID")
                    {
                        reportGuid = paramMap[key] as string;

                        if (reportGuid == null)
                        {
                            reportGuid = "";
                        }
                    }
                    else if (key.ToUpper() == "PROCEDUREGUID")
                    {
                        rpGuids = paramMap[key] as string;

                        if (rpGuids == null)
                        {
                            rpGuids = "";
                        }
                    }
                }

                string sql = "select " + GetAllReportColumn()
                             + " from tRegPatient, tRegOrder, tProcedureCode, tRegProcedure "
                             + " left join tReport on tRegProcedure.reportGuid = tReport.reportGuid "
                             + " where tRegPatient.PatientGuid = tRegOrder.PatientGuid "
                             + " and tRegOrder.OrderGuid = tRegProcedure.OrderGuid "
                             + " and tRegProcedure.ProcedureCode = tProcedureCode.ProcedureCode ";

                string sqlFile = " select distinct tReportFile.* from tReportFile, tReport "
                                 + " where tReportFile.reportGuid = tReport.reportGuid ";



                if (reportGuid.Length > 0)
                {
                    sql += " and tReport.reportGuid = '" + reportGuid + "'";

                    sqlFile += " and tReport.reportGuid = '" + reportGuid + "'";
                }

                if (rpGuids.Length > 0 && reportGuid.Length == 0)
                {
                    rpGuids = rpGuids.Trim(", ".ToCharArray());
                    rpGuids = rpGuids.Replace(",", "','");
                    rpGuids = "'" + rpGuids + "'";

                    sql += " and tRegProcedure.ProcedureGuid in (" + rpGuids + ")";

                    sqlFile += " 1!=1";
                }

                DataSet ds = new DataSet();

                using (RisDAL dal = new RisDAL())
                {
                    //
                    // report info
                    DataTable dt0 = new DataTable("ReportInfo");



                    //ServerPubFun.DeclareOracleNoCase();

                    dal.ExecuteQuery(sql, dt0);

                    ds.Tables.Add(dt0);

                    //
                    // report file
                    DataTable dt1 = new DataTable("ReportFile");



                    dal.ExecuteQuery(sqlFile, dt1);

                    ds.Tables.Add(dt1);

                    if (dal != null)
                    {
                        dal.Dispose();
                    }
                }
                return(ds);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetReportInfoDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 27
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in GetDrawerSignDAO!"));
                }



                DataSet ds = new DataSet();

                try
                {
                    using (RisDAL dal = new RisDAL())
                    {
                        string   strReportGuids = paramMap["ReportGuid"] as string;
                        string[] arrItem        = strReportGuids.Split('|');

                        DataTable dtDrawSign = null;
                        strReportGuids = "";
                        foreach (string str in arrItem)
                        {
                            string strSQL = string.Format("select ReportGuid,IsDraw,DrawerSign,TakeFilmDept,"
                                                          + " TakeFilmRegion,TakeFilmComment "
                                                          //+ " ReportTextApprovedSign, ReportTextSubmittedSign,"
                                                          //+ " CombinedForCertification, SignCombinedForCertification "
                                                          + " from tReport where ReportGuid ='{0}'", str);
                            DataTable dt = dal.ExecuteQuery(strSQL);
                            if (dt != null && dt.Rows.Count > 0)
                            {
                                if (dtDrawSign == null)
                                {
                                    dtDrawSign = dt.Clone();
                                }
                                dtDrawSign.Rows.Add(dt.Rows[0].ItemArray);
                            }
                        }
                        ds.Tables.Add(dtDrawSign);
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.Assert(false, ex.Message);

                    ServerPubFun.RISLog_Error(0, "GetDrawerSignDAO=" + ex.Message,
                                              (new System.Diagnostics.StackFrame()).GetFileName(),
                                              (new System.Diagnostics.StackFrame()).GetFileLineNumber());

                    throw (ex);
                }


                return(ds);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetDrawerSignDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 28
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in GetReportHistoryDAO!"));
                }

                string patientID = "", reportGuid = "", strType = "";

                foreach (string key in paramMap.Keys)
                {
                    if (key.ToUpper() == "PATIENTGUID" || key.ToUpper() == "PATIENTID")
                    {
                        patientID = paramMap[key] as string;

                        if (patientID == null)
                        {
                            patientID = "";
                        }
                    }
                    else if (key.ToUpper() == "REPORTGUID" || key.ToUpper() == "REPORTID")
                    {
                        reportGuid = paramMap[key] as string;

                        if (reportGuid == null)
                        {
                            reportGuid = "";
                        }
                    }
                    else if (key.ToUpper() == "TYPE")
                    {
                        strType = paramMap[key] as string;

                        if (strType == null)
                        {
                            strType = "";
                        }
                    }
                }

                string sql = "select distinct tRegPatient.PatientID, tRegPatient.LocalName, tRegOrder.AccNO,"
                             + " tRegOrder.createDt, tReport.reportName, tReportPrintLog.*,tPrintTemplate.TemplateName"
                             + " from tRegPatient, tRegOrder, tRegProcedure, "
                             + " tReport, tReportPrintLog"
                             + " left join tPrintTemplate"
                             + " on tReportPrintLog.PrintTemplateGuid = tPrintTemplate.TemplateGuid"
                             + " where tRegPatient.PatientGuid = tRegOrder.PatientGuid"
                             + " and tRegOrder.OrderGuid = tRegProcedure.OrderGuid"
                             + " and tRegProcedure.reportGuid = tReport.reportGuid"
                             + " and tReport.reportGuid = tReportPrintLog.reportGuid";

                if (patientID != null && patientID.Length > 0)
                {
                    sql += " and tRegPatient.PatientID='" + patientID + "'";
                }

                if (reportGuid != null && reportGuid.Length > 0)
                {
                    sql += " and tReport.reportGuid='" + reportGuid + "'";
                }

                if (strType != null && strType.Length > 0)
                {
                    sql += " and tReportPrintLog.Type='" + strType + "'";
                }


                sql += " order by tRegOrder.createDt desc, tReportPrintLog.PrintDt desc";



                DataSet ds = new DataSet();
                using (RisDAL dal = new RisDAL())
                {
                    dal.ExecuteQuery(sql, ds, "ReportPrintLog");

                    Dictionary <string, object> outMap = new Dictionary <string, object>();

                    outMap.Add("DataSet", ds);
                    return(outMap);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetReportPrintLogDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 29
0
        public object Execute(object param)
        {
            try
            {
                #region get parameters

                Dictionary <string, object> paramMap = param as Dictionary <string, object>;

                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in GetLockDAO!"));
                }

                string action     = "";
                string lockType   = "";
                string lockGuid   = "";
                string owner      = "";
                string ownerIP    = "";
                string rpguids    = "";
                string patientid  = "";
                string localname  = "";
                string accno      = "";
                string reportGuid = "";

                foreach (string key in paramMap.Keys)
                {
                    if (key.ToUpper() == "LOCKTYPE")
                    {
                        lockType = paramMap[key] as string;

                        if (lockType == null)
                        {
                            lockType = "";
                        }
                    }
                    else if (key.ToUpper() == "LOCKGUID")
                    {
                        lockGuid = paramMap[key] as string;

                        if (lockGuid == null)
                        {
                            lockGuid = "";
                        }
                    }
                    else if (key.ToUpper() == "ACTION")
                    {
                        action = paramMap[key] as string;

                        if (action == null)
                        {
                            action = "";
                        }
                    }
                    else if (key.ToUpper() == "OWNER")
                    {
                        owner = paramMap[key] as string;

                        if (owner == null)
                        {
                            owner = "";
                        }
                    }
                    else if (key.ToUpper() == "OWNERIP")
                    {
                        ownerIP = paramMap[key] as string;

                        if (ownerIP == null)
                        {
                            ownerIP = "";
                        }
                    }
                    else if (key.ToUpper() == "RPGUIDS")
                    {
                        rpguids = paramMap[key] as string;

                        if (rpguids == null)
                        {
                            rpguids = "";
                        }
                    }
                    else if (key.ToUpper() == "PATIENTID")
                    {
                        patientid = paramMap[key] as string;

                        if (patientid == null)
                        {
                            patientid = "";
                        }
                    }
                    else if (key.ToUpper() == "LOCALNAME")
                    {
                        localname = paramMap[key] as string;

                        if (localname == null)
                        {
                            localname = "";
                        }
                    }
                    else if (key.ToUpper() == "ACCNO")
                    {
                        accno = paramMap[key] as string;

                        if (accno == null)
                        {
                            accno = "";
                        }
                    }
                    else if (key.ToUpper() == "REPORTGUID")
                    {
                        reportGuid = paramMap[key] as string;

                        if (reportGuid == null)
                        {
                            reportGuid = "";
                        }
                    }
                }

                #endregion



                DataSet ds = new DataSet();

                //dal.BeginTransaction();

                try
                {
                    using (RisDAL dal = new RisDAL())
                    {
                        DataTable dtLock = null;
                        string    strSQL = "";
                        if (!string.IsNullOrEmpty(lockGuid))
                        {
                            strSQL = string.Format("select Owner,OwnerIP,RPGuids,ModuleID from tSync where guid='{0}'", lockGuid);
                            dtLock = dal.ExecuteQuery(strSQL);
                        }

                        if (action.ToUpper() == "ADD")
                        #region ADD
                        {
                            #region only ReportGuid is arrived so should get some info of patient,order and rp
                            if (!string.IsNullOrEmpty(reportGuid))
                            {
                                string strFromRp      = string.Format("select procedureguid, orderguid from tregprocedure with(nolock) where reportguid ='{0}'", reportGuid);
                                string strFromOrder   = "select accno,patientguid from tregorder with(nolock) where orderguid ='{0}'";
                                string strFromPatient = "select patientid, localname from tregpatient with(nolock) where patientguid='{0}'";
                                //get rp info
                                DataTable dtRp = dal.ExecuteQuery(strFromRp);
                                rpguids = "";
                                foreach (DataRow dr in dtRp.Rows)
                                {
                                    rpguids += Convert.ToString(dr["ProcedureGuid"]) + "&" + owner + "&" + ownerIP + "|";
                                }
                                rpguids  = rpguids.TrimEnd(new char[] { '|' });
                                lockGuid = Convert.ToString(dtRp.Rows[0]["OrderGuid"]);
                                //get accno
                                DataTable dtOrder = dal.ExecuteQuery(string.Format(strFromOrder, lockGuid));
                                accno = Convert.ToString(dtOrder.Rows[0]["AccNo"]);
                                //get patient info
                                DataTable dtPatient = dal.ExecuteQuery(string.Format(strFromPatient, dtOrder.Rows[0]["PatientGuid"]));
                                patientid = Convert.ToString(dtPatient.Rows[0]["PatientID"]);
                                localname = Convert.ToString(dtPatient.Rows[0]["LocalName"]);
                                //lockGuid has value now~
                                strSQL = string.Format("select Owner,OwnerIP,RPGuids,ModuleID from tSync where guid='{0}'", lockGuid);
                                dtLock = dal.ExecuteQuery(strSQL);
                            }
                            #endregion

                            //#region RWF

                            //if (_rwfMode == -1)
                            //    _rwfMode = ServerPubFun.GetSystemProfile_Int("RWFmode");

                            //if (_rwfMode == 1)
                            //{
                            //    int rpStatus = CS.GCRIS.RWF.SCU.RwfScu.getRpStatus(lockGuid);

                            //    if (CS.GCRIS.RWF.SCU.RwfScu.needClaim(lockGuid))
                            //    {
                            //        if (!CS.GCRIS.RWF.SCU.RwfScu.claim(lockGuid, owner))
                            //        {
                            //            // failed to check.
                            //            strSQL = "select top 1 '2' syncType, '" + lockGuid + "' guid, 'CSBROKER' owner,"
                            //                + " 'CSBROKER' ownerIP, '0400' moduleID, p.patientID, p.localName, o.AccNo, '' RPGuids"
                            //                + " from tRegPatient p, tRegOrder o "
                            //                + " where p.patientguid=o.patientguid AND o.orderguid='" + lockGuid + "' ";

                            //            dal.ExecuteQuery(strSQL, ds, "tSync");

                            //            return ds;
                            //        }
                            //    }
                            //    else if (100 == rpStatus)
                            //    {
                            //        CS.GCRIS.RWF.SCU.RwfScu.nSetCompleted(lockGuid, owner);
                            //    }
                            //}

                            //#endregion

                            #region add lock in ris

                            if (dtLock == null || dtLock.Rows.Count == 0)
                            {
                                string domain = CommonGlobalSettings.Utilities.GetCurDomain();

                                //Not be locked
                                strSQL = string.Format("insert tSync(syncType, guid, owner, ownerIP, moduleID, patientID, patientName, AccNo,RPGuids,domain) " +
                                                       "values({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')",
                                                       lockType, lockGuid, owner, ownerIP, "0400", patientid, localname, accno, rpguids, domain);
                            }
                            else
                            {
                                if (dtLock.Rows[0]["RPGuids"] == null || dtLock.Rows[0]["RPGuids"].ToString().Trim().Length == 0)
                                {
                                    //Lock by other panel
                                    strSQL = string.Format("select syncType, guid, owner, ownerIP, moduleID, patientID, patientName, AccNo,RPGuids from tSync where guid='{0}'", lockGuid);
                                }
                                else
                                {
                                    string   strOrgRpGuids = Convert.ToString(dtLock.Rows[0]["RPGuids"]);
                                    string   strOrgOwner   = Convert.ToString(dtLock.Rows[0]["owner"]);
                                    string   strOrgOwnerIP = Convert.ToString(dtLock.Rows[0]["ownerIP"]);
                                    string   strModuleID   = Convert.ToString(dtLock.Rows[0]["moduleID"]);
                                    char[]   sep1          = { '|' };
                                    char[]   sep2          = { '&' };
                                    string[] arrItems1     = rpguids.Split(sep1);
                                    bool     bLocked       = false;
                                    string   strLockInfo   = "";
                                    foreach (string strSegment in arrItems1)
                                    {
                                        string[] arritems2 = strSegment.Split(sep2);
                                        if (arritems2[0] == null)
                                        {
                                            continue;
                                        }

                                        string[] strOrgItems = strOrgRpGuids.Split(sep1);
                                        foreach (string str in strOrgItems)
                                        {
                                            if (str.Contains(arritems2[0]))
                                            {
                                                bLocked      = true;
                                                strLockInfo += str;
                                                strLockInfo += "|";
                                            }
                                        }
                                    }

                                    if (bLocked)
                                    {
                                        strLockInfo = strLockInfo.TrimEnd('|');
                                        //Lock by other by report panel
                                        string[] arrItem3 = strLockInfo.Split(sep1);
                                        if (arrItem3.Length > 0)
                                        {
                                            DataTable dt = new DataTable("tSync");
                                            dt.Columns.Add("Description", typeof(string));
                                            dt.Columns.Add("Owner", typeof(string));
                                            dt.Columns.Add("OwnerIP", typeof(string));
                                            dt.Columns.Add("ModuleID", typeof(string));
                                            foreach (string strSegment in arrItem3)
                                            {
                                                string[] arrItem4        = strSegment.Split(sep2);
                                                string   strRPGuid       = arrItem4[0];
                                                string   strLockUserGuid = arrItem4[1];
                                                string   strLockIP       = arrItem4[2];
                                                string   str             = string.Format("select RPDesc AS Description from tRegProcedure where ProcedureGuid='{0}'", strRPGuid);
                                                object   obj             = dal.ExecuteScalar(str);
                                                if (obj == null)
                                                {
                                                    obj = "";
                                                }
                                                DataRow dr = dt.NewRow();
                                                dr["Description"] = obj.ToString();
                                                dr["Owner"]       = strLockUserGuid;
                                                dr["OwnerIP"]     = strLockIP;
                                                dr["ModuleID"]    = strModuleID;
                                                dt.Rows.Add(dr);
                                            }
                                            ds.Tables.Add(dt);
                                            strSQL = "";
                                        }
                                        else
                                        {
                                            strSQL = string.Format("select syncType, guid, owner, ownerIP, moduleID, patientID, patientName, AccNo,RPGuids from tSync where guid='{0}'", lockGuid);
                                        }
                                    }
                                    else
                                    {
                                        if (strOrgOwner.Contains(owner))
                                        {
                                            strSQL = string.Format("Update tSync set RPGuids='{0}' where guid='{1}'", strOrgRpGuids + "|" + rpguids, lockGuid);
                                        }
                                        else
                                        {
                                            strSQL = string.Format("Update tSync set RPGuids='{0}',owner='{1}',ownerip='{2}' where guid='{3}'", strOrgRpGuids + "|" + rpguids, strOrgOwner + "|" + owner, strOrgOwnerIP + "|" + ownerIP, lockGuid);
                                        }
                                    }
                                }
                            }

                            ServerPubFun.RISLog_Info(0, "GetLockDAO_MSSQL, ADD, owner=" + owner + ", ownerIP=" + ownerIP,
                                                     (new System.Diagnostics.StackFrame()).GetFileName(),
                                                     (new System.Diagnostics.StackFrame()).GetFileLineNumber());

                            if (strSQL.Trim().Length > 0)
                            {
                                dal.ExecuteQuery(strSQL, ds, "tSync");
                            }

                            #endregion
                        }
                        #endregion
                        else if (action.ToUpper() == "DELETE" || action.ToUpper() == "DEL")
                        #region Delete
                        {
                            #region RWF

                            if (_rwfMode == -1)
                            {
                                _rwfMode = ServerPubFun.GetSystemProfile_Int("RWFmode");
                            }

                            /*
                             * if (_rwfMode == 1)
                             * {
                             *  int rpStatus = CS.GCRIS.RWF.SCU.RwfScu.getRpStatus(lockGuid);
                             *  if (RWF_COMPLETED_VS_RIS_STATUS == rpStatus)
                             *  {
                             *      CS.GCRIS.RWF.SCU.RwfScu.spsComplete(lockGuid, owner);
                             *  }
                             *  else if (100 == rpStatus)
                             *  {
                             *      CS.GCRIS.RWF.SCU.RwfScu.nCreate(lockGuid, owner);
                             *  }
                             *  else if (50 == rpStatus)
                             *  {
                             *      CS.GCRIS.RWF.SCU.RwfScu.spsDefer(lockGuid, owner);
                             *  }
                             *  else
                             *  {
                             *      // do nothing
                             *  }
                             * }
                             */
                            #endregion

                            #region delete lock in ris

                            if (dtLock != null && dtLock.Rows.Count > 0)
                            {
                                string strOrgRpGuids = Convert.ToString(dtLock.Rows[0]["RPGuids"]);


                                string   strOrgOwner   = Convert.ToString(dtLock.Rows[0]["owner"]);
                                string   strOrgOwnerIP = Convert.ToString(dtLock.Rows[0]["ownerIP"]);
                                char[]   sep           = { '|' };
                                string[] arrItems      = rpguids.Split(sep);
                                bool     bLocked       = false;
                                foreach (string strRpGuid in arrItems)
                                {
                                    if (strOrgRpGuids.Contains(strRpGuid + "|"))
                                    {
                                        strOrgRpGuids = strOrgRpGuids.Replace(strRpGuid + "|", "");
                                    }
                                    else if (strOrgRpGuids.Contains(strRpGuid))
                                    {
                                        strOrgRpGuids = strOrgRpGuids.Replace(strRpGuid, "");
                                    }
                                }
                                strOrgRpGuids = strOrgRpGuids.TrimEnd('|');
                                if (strOrgRpGuids.Trim().Length == 0)
                                {
                                    strSQL = string.Format("delete from tSync where guid='{0}'", lockGuid);
                                }
                                else
                                {
                                    string[] arrItems1 = strOrgOwner.Split(sep);
                                    if (arrItems1.Length > 1)
                                    {
                                        foreach (string strOwner in arrItems1)
                                        {
                                            bool     bRPGuidContainOwner = false;
                                            string[] arr10 = strOrgRpGuids.Split('|');
                                            foreach (string strRPGuid10 in arr10)
                                            {
                                                string[] arr11 = strRPGuid10.Split('&');
                                                if (owner.ToUpper() == arr11[1].ToUpper())
                                                {
                                                    bRPGuidContainOwner = true;
                                                    break;
                                                }
                                            }

                                            bool     bOwnerContain = false;
                                            string[] arr12         = strOrgOwner.Split('|');
                                            foreach (string strOwner10 in arr12)
                                            {
                                                if (owner.ToUpper() == strOwner10.ToUpper())
                                                {
                                                    bOwnerContain = true;
                                                    break;
                                                }
                                            }

                                            if (bOwnerContain && !bRPGuidContainOwner)
                                            {
                                                if (strOrgOwner.Contains(owner + "|"))
                                                {
                                                    strOrgOwner = strOrgOwner.Replace(owner + "|", "");
                                                }
                                                else
                                                {
                                                    //strOrgOwner = strOrgOwner.Replace(owner, "");
                                                    strOrgOwner = "";
                                                    foreach (string strOwner10 in arr12)
                                                    {
                                                        if (owner.ToUpper() != strOwner10.ToUpper())
                                                        {
                                                            strOrgOwner += strOwner10;
                                                            strOrgOwner += "|";
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        strOrgOwner = strOrgOwner.TrimEnd('|');

                                        string[] arrItems2 = strOrgOwnerIP.Split(sep);
                                        foreach (string strOwnerIP in arrItems2)
                                        {
                                            if (strOrgOwnerIP.Contains(ownerIP + "|") && !strOrgRpGuids.Contains(ownerIP))
                                            {
                                                strOrgOwnerIP = strOrgOwnerIP.Replace(ownerIP + "|", "");
                                            }
                                            else if (strOrgOwnerIP.Contains(ownerIP) && !strOrgRpGuids.Contains(ownerIP))
                                            {
                                                strOrgOwnerIP = strOrgOwnerIP.Replace(ownerIP, "");
                                            }
                                        }
                                        strOrgOwnerIP = strOrgOwnerIP.TrimEnd('|');
                                        strSQL        = string.Format("update tSync set owner='{0}',ownerip='{1}',rpguids='{2}' where guid='{3}'", strOrgOwner, strOrgOwnerIP, strOrgRpGuids, lockGuid);
                                    }
                                    else
                                    {
                                        strSQL = string.Format("update tSync set rpguids='{0}' where guid='{1}'", strOrgRpGuids, lockGuid);
                                    }
                                }



                                dal.ExecuteQuery(strSQL, ds, "tSync");
                            }
                            #endregion
                        }
                        #endregion
                        else
                        #region Query
                        {
                            string sql = "select * from tSync, tUser where tSync.Owner=tUser.UserGuid and tSync.SyncType="
                                         + lockType + " and tSync.Guid='" + lockGuid + "'";

                            dal.ExecuteQuery(sql, ds, "tSync");
                        }
                        #endregion
                    }
                }
                catch (Exception ex)
                {
                    //dal.RollbackTransaction();

                    System.Diagnostics.Debug.Assert(false, ex.Message);

                    ServerPubFun.RISLog_Error(0, "GetLockDAO=" + ex.Message,
                                              (new System.Diagnostics.StackFrame()).GetFileName(),
                                              (new System.Diagnostics.StackFrame()).GetFileLineNumber());

                    throw (ex);
                }



                return(ds);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "GetLockDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return(null);
        }
Esempio n. 30
0
        public object Execute(object param)
        {
            try
            {
                Dictionary <string, object> inMap = param as Dictionary <string, object>;

                if (inMap == null || inMap.Count < 1)
                {
                    throw (new Exception("No parameter in DisqualifyImageDAO!"));
                }

                string rpGuids = "", reportGuid = "", curUserGuid = "", reason = "";
                string strDomain = CommonGlobalSettings.Utilities.GetCurDomain();
                foreach (string key in inMap.Keys)
                {
                    if (key.ToUpper() == "REPORTGUID")
                    {
                        reportGuid = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "USERID")
                    {
                        curUserGuid = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "PROCEDUREGUID")
                    {
                        rpGuids = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "REASON")
                    {
                        reason = inMap[key] as string;
                    }
                }

                if ((reportGuid == null || reportGuid.Length < 1) &&
                    (rpGuids == null || rpGuids.Length < 1))
                {
                    System.Diagnostics.Debug.Assert(false, "Missing Parameter");
                    throw (new Exception("Miss Parameter in DisqualifyImageDAO!"));
                }

                if (curUserGuid == null || curUserGuid.Length < 1)
                {
                    System.Diagnostics.Debug.Assert(false, "Missing Parameter");
                    throw (new Exception("Miss Parameter in DisqualifyImageDAO!"));
                }

                if (reportGuid == null)
                {
                    reportGuid = "";
                }

                reportGuid = reportGuid.Trim(" ,".ToCharArray());

                if (rpGuids == null)
                {
                    rpGuids = "";
                }

                rpGuids = rpGuids.Trim(" ,".ToCharArray());

                reason = reason == null ? "" : reason.Length >= 512 ? reason.Substring(0, 512) : reason;

                string sql = " begin tran \r\n";

                using (RisDAL dal = new RisDAL())
                {
                    if (reportGuid != null && reportGuid.Length > 0)
                    {
                        string sqlGetRPs = "select procedureGuid from tRegProcedure where ReportGuid='" + reportGuid + "'";

                        DataTable dtTmp = dal.ExecuteQuery(sqlGetRPs);
                        if (dtTmp != null)
                        {
                            foreach (DataRow dr in dtTmp.Rows)
                            {
                                string tmpRP = System.Convert.ToString(dr[0]);
                                if (string.IsNullOrEmpty(tmpRP))
                                {
                                    continue;
                                }

                                sql += " if exists(select 1 from tReShot where procedureGuid ='" + tmpRP + "') \r\n"
                                       + " update tReShot set reason='" + reason + "', rejectDoctor='" + curUserGuid + "',"
                                       + " rejectDt = getdate(),domain='" + strDomain + "' "
                                       + " where procedureGuid = '" + tmpRP + "' \r\n"
                                       + " else "
                                       + " insert tReShot(ProcedureGuid, reason, rejectDoctor, rejectDt, domain) "
                                       + " values ('" + tmpRP + "', '" + reason + "', '" + curUserGuid + "', getdate(), '" + strDomain + "') \r\n"
                                ;
                            }
                        }

                        //sql += " delete from tReShot where procedureGuid in (select procedureGuid from tRegProcedure where ReportGuid='" + reportGuid + "') \r\n"
                        //    + " insert tReShot(ProcedureGuid) select procedureGuid from tRegProcedure "
                        //    + " where reportGuid = '" + reportGuid + "' \r\n"
                        //    + " update tReShot set reason='" + reason + "', rejectDoctor='" + curUserGuid + "', rejectDt = getdate(),domain='" + strDomain + "' "
                        //    + " where (rejectDoctor is null or rejectDoctor = '')"
                        //    + " and procedureGuid in (select procedureGuid from tRegProcedure"
                        //    + "  where reportGuid = '" + reportGuid + "') \r\n";

                        sql += ""
                               + " update tRegProcedure set status = " + System.Convert.ToInt32(ReportCommon.RP_Status.Repeatshot).ToString() + ",reportguid=null where  "
                               + "  reportGuid = '" + reportGuid + "' \r\n"
                               + " delete from tReportlist where reportGuid = '" + reportGuid + "' \r\n"
                               + " delete from tReport where reportGuid = '" + reportGuid + "' \r\n";
                    }
                    else if (rpGuids != null && rpGuids.Length > 0)
                    {
                        string[] arrRPs = rpGuids.Split(",;".ToCharArray());

                        foreach (string tmpRP in arrRPs)
                        {
                            if (string.IsNullOrEmpty(tmpRP))
                            {
                                continue;
                            }

                            sql += " if exists(select 1 from tReShot where procedureGuid ='" + tmpRP + "') \r\n"
                                   + " update tReShot set reason='" + reason + "', rejectDoctor='" + curUserGuid + "',"
                                   + " rejectDt = getdate(),domain='" + strDomain + "' "
                                   + " where procedureGuid = '" + tmpRP + "' \r\n"
                                   + " else "
                                   + " insert tReShot(ProcedureGuid, reason, rejectDoctor, rejectDt, domain) "
                                   + " values ('" + tmpRP + "', '" + reason + "', '" + curUserGuid + "', getdate(), '" + strDomain + "') \r\n"
                            ;
                        }

                        if (!rpGuids.Contains("'"))
                        {
                            rpGuids = rpGuids.Replace(",", "','");
                            rpGuids = rpGuids.Replace(";", "','");
                            rpGuids = "'" + rpGuids + "'";
                        }

                        //sql += " delete from tReShot where procedureGuid in (" + rpGuids + ") \r\n"
                        //+ " insert tReShot(ProcedureGuid) select procedureGuid from tRegProcedure"
                        //+ " where procedureGuid in (" + rpGuids + ") \r\n"
                        //+ " update tReShot set reason='" + reason + "', rejectDoctor='" + curUserGuid + "', rejectDt = getdate(),domain='" + strDomain + "' "
                        //+ " where (rejectDoctor is null or rejectDoctor = '') and procedureGuid in (" + rpGuids + ") \r\n";

                        sql += " update tRegProcedure set status = " + System.Convert.ToInt32(ReportCommon.RP_Status.Repeatshot).ToString()
                               + " where procedureGuid in (" + rpGuids + ") \r\n";
                    }

                    sql += " commit";

                    ServerPubFun.RISLog_Info(0, "DisqualifyImageDAO_MSSQL, SQL=" + sql,
                                             (new System.Diagnostics.StackFrame()).GetFileName(),
                                             (new System.Diagnostics.StackFrame()).GetFileLineNumber());

                    // Delete
                    tagReportInfo rptInfo = ServerPubFun.GetReportInfo2(rpGuids); //ServerPubFun.GetReportInfo(reportGuid);

                    ServerPubFun.OnReportDelete(rptInfo, ReportCommon.RP_Status.Repeatshot);



                    dal.ExecuteNonQuery(sql);

                    return(true);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "DisqualifyImageDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }

            return("-1");
        }