Esempio n. 1
0
        public object Execute(object param)
        {
            bool isModified = false;

            try
            {
                Dictionary <string, object> paramMap = param as Dictionary <string, object>;
                if (paramMap == null || paramMap.Count < 1)
                {
                    throw (new Exception("No parameter in UpdateReportIsModifiedDAO!"));
                }


                string reportGuid = paramMap["reportguid"] as string;
                using (RisDAL dal = new RisDAL())
                {
                    DataSet ds = new DataSet();

                    string strLatestSumittedSQL = string.Format("select top 1 reporttext from treportlist where reportguid='{0}' and status = 110 order by operationtime desc", reportGuid);
                    string strLatestApprovedSQL = string.Format("select top 1 reporttext from treportlist where reportguid='{0}' and status = 120 order by operationtime desc", reportGuid);
                    string strUpdateIsModified  = "update treport set ismodified = {0} where reportguid ='{1}'";
                    object lastSumittedRptText  = Convert.ToString(dal.ExecuteScalar(strLatestSumittedSQL));
                    if (string.IsNullOrEmpty(Convert.ToString(lastSumittedRptText)))    //no submitted record
                    {
                        dal.ExecuteNonQuery(string.Format(strUpdateIsModified, 0, reportGuid));
                        return(isModified);
                    }
                    else
                    {
                        object lastApprovedRptText = Convert.ToString(dal.ExecuteScalar(strLatestApprovedSQL));
                        if (string.IsNullOrEmpty(Convert.ToString(lastApprovedRptText)))    //no approved record
                        {
                            dal.ExecuteNonQuery(string.Format(strUpdateIsModified, 0, reportGuid));
                            return(isModified);
                        }
                        else if (lastSumittedRptText.ToString().Equals(lastApprovedRptText.ToString(), StringComparison.OrdinalIgnoreCase))
                        {
                            dal.ExecuteNonQuery(string.Format(strUpdateIsModified, 0, reportGuid));
                            return(isModified);
                        }
                        else
                        {
                            dal.ExecuteNonQuery(string.Format(strUpdateIsModified, 1, reportGuid));
                            return(isModified = true);   //sumbmited reporttext differ with approved one
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

                ServerPubFun.RISLog_Error(0, "UpdateReportIsModifiedDAO=" + ex.Message,
                                          (new System.Diagnostics.StackFrame()).GetFileName(),
                                          (new System.Diagnostics.StackFrame()).GetFileLineNumber());
                return(isModified);
            }
        }
Esempio n. 2
0
        public override bool AddNewLeafNode(string strItemGuid, string strParentID, int depth, string strItemName, int itemOrder, int type, string strUserID, string strTemplateGuid, string strGender, ReportTemplateModel model)
        {
            RisDAL dataAccess = new RisDAL();

            model.CheckItemName = model.CheckItemName.Replace("'", "''");
            model.DoctorAdvice  = model.DoctorAdvice.Replace("'", "''");
            //model.TechInfo  = model.TechInfo.Replace("'", "''");
            //model.WYG = model.WYG.Replace("'", "''");
            //model.WYS = model.WYS.Replace("'", "''");
            string sql = string.Format("Insert into tReportTemplateDirec(ItemGUID,ParentID,Depth,ItemName,ItemOrder,Type,UserGuid,TemplateGuid,Leaf) values('{0}','{1}',{2},'{3}',{4},{5},'{6}','{7}',{8})"
                                       , strItemGuid, strParentID, depth, strItemName, itemOrder, type, strUserID, strTemplateGuid, 1);
            string sql1 = string.Format("Insert into tReportTemplate(TemplateGuid,TemplateName,ModalityType,BodyPart,CheckItemName,DoctorAdvice,ShortcutCode,ACRCode,ACRAnatomicDesc,ACRPathologicDesc,BodyCategory) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')"
                                        , strTemplateGuid, model.TemplateName, model.ModalityType, model.BodyPart, model.CheckItemName, model.DoctorAdvice, model.ShortcutCode, model.ACRCode, model.ACRAnatomicDesc, model.ACRPathologicDesc, model.BodyCategory);

            try
            {
                dataAccess.BeginTransaction();
                dataAccess.ExecuteNonQuery(sql, RisDAL.ConnectionState.KeepOpen);

                dataAccess.ExecuteNonQuery(sql1, RisDAL.ConnectionState.KeepOpen);
                byte [] byteWYS        = System.Text.Encoding.Default.GetBytes(model.WYS);
                byte [] byteWYG        = System.Text.Encoding.Default.GetBytes(model.WYG);
                byte [] byteAppendInfo = System.Text.Encoding.Default.GetBytes(model.AppendInfo);
                byte [] byteTechInfo   = System.Text.Encoding.Default.GetBytes(model.TechInfo);

                dataAccess.CommitTransaction();
                dataAccess.WriteLargeObj("tReportTemplate", "TemplateGuid", strTemplateGuid, "WYS", byteWYS, byteWYS.Length, RisDAL.ConnectionState.CloseOnExit);
                dataAccess.WriteLargeObj("tReportTemplate", "TemplateGuid", strTemplateGuid, "WYG", byteWYG, byteWYG.Length, RisDAL.ConnectionState.CloseOnExit);
                dataAccess.WriteLargeObj("tReportTemplate", "TemplateGuid", strTemplateGuid, "AppendInfo", byteAppendInfo, byteAppendInfo.Length, RisDAL.ConnectionState.CloseOnExit);
                dataAccess.WriteLargeObj("tReportTemplate", "TemplateGuid", strTemplateGuid, "TechInfo", byteTechInfo, byteTechInfo.Length, RisDAL.ConnectionState.CloseOnExit);
            }
            catch (Exception e)
            {
                lm.Error((long)ModuleEnum.Templates_DA, ModuleInstanceName.Templates, 1, e.Message, Application.StartupPath.ToString(),
                         (new System.Diagnostics.StackFrame(true)).GetFileName(),
                         Convert.ToInt32(new System.Diagnostics.StackFrame(true).GetFileLineNumber().ToString()));
                return(false);
            }
            finally
            {
                if (dataAccess != null)
                {
                    dataAccess.Dispose();
                }
            }

            return(true);
        }
Esempio n. 3
0
        public override void LogOutBySessionID(string SessionID)
        {
            StringBuilder strBuilder = new StringBuilder();

            strBuilder.AppendFormat("Update tOnlineClient Set IsOnline = 0 where SessionID = '{0}'", SessionID);
            RisDAL oKodakDAL = new RisDAL();

            try
            {
                oKodakDAL.ExecuteNonQuery(strBuilder.ToString());
            }
            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();
                }
            }
        }
Esempio n. 4
0
        public override bool ModifyPrintTemplateFieldInfo(string strTemplateGuid, string strTemplateInfo)
        {
            RisDAL dataAccess = new RisDAL();

            string sql = string.Format("Update tPrintTemplate set Version = Version+1  where TemplateGuid = '{0}'", strTemplateGuid);

            byte[] byteTemplateInfo = System.Text.Encoding.Unicode.GetBytes(strTemplateInfo);
            try
            {
                dataAccess.ExecuteNonQuery(sql);
                dataAccess.WriteLargeObj("tPrintTemplate", "TemplateGuid", strTemplateGuid, "TemplateInfo", byteTemplateInfo, byteTemplateInfo.Length, RisDAL.ConnectionState.CloseOnExit);
            }
            catch (Exception e)
            {
                lm.Error((long)ModuleEnum.Templates_DA, ModuleInstanceName.Templates, 1, e.Message, Application.StartupPath.ToString(),
                         (new System.Diagnostics.StackFrame(true)).GetFileName(),
                         Convert.ToInt32(new System.Diagnostics.StackFrame(true).GetFileLineNumber().ToString()));
                return(false);
            }
            finally
            {
                if (dataAccess != null)
                {
                    dataAccess.Dispose();
                }
            }

            return(true);
        }
Esempio n. 5
0
        public override void LogOut(string UserGuid, bool bWebUser)
        {
            StringBuilder strBuilder = new StringBuilder();

            if (bWebUser)
            {
                strBuilder.AppendFormat("Update tOnlineClient Set IsOnline = 0 where UserGuid = '{0}' and (comments = 'web login user')", UserGuid);
            }
            else
            {
                strBuilder.AppendFormat("Update tOnlineClient Set IsOnline = 0 where UserGuid = '{0}' and (comments is null or comments != 'web login user')", UserGuid);
            }
            RisDAL oKodakDAL = new RisDAL();

            try
            {
                oKodakDAL.ExecuteNonQuery(strBuilder.ToString());
            }
            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();
                }
            }
        }
Esempio n. 6
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 SaveLeaveSoundDAO!"));
                }



                using (RisDAL dal = new RisDAL())
                {
                    DataSet ds = paramMap["DataSet"] as DataSet;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string strSoundGuid  = Guid.NewGuid().ToString();
                        string strReportGuid = Convert.ToString(dr["ReportGuid"]);
                        string strPath       = Convert.ToString(dr["Path"]);
                        int    nStatus       = 0;
                        string strLeaveTime  = GlobalCommon.ToLongDateTime(DateTime.Now);
                        string strOwner      = Convert.ToString(dr["Owner"]);
                        string strDomain     = Convert.ToString(dr["Domain"]);

                        string strSQL = string.Format("insert into tLeaveSound(SoundGuid,ReportGuid,Path,Status,LeaveTime,Owner,Domain) values('{0}','{1}','{2}',{3},'{4}','{5}','{6}')",
                                                      strSoundGuid, strReportGuid, strPath, nStatus, strLeaveTime, strOwner, strDomain);
                        dal.ExecuteNonQuery(strSQL);
                        strSQL = string.Format("update tReport set IsLeaveSound=1 where ReportGuid='{0}'", strReportGuid);
                        dal.ExecuteNonQuery(strSQL);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

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

            return(true);
        }
Esempio n. 7
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 DeleteReportDAO!"));
                }

                string orderGuid = "", assignSite = "";

                foreach (string key in inMap.Keys)
                {
                    if (key.ToUpper() == "ORDERGUID")
                    {
                        orderGuid = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "ASSIGNSITE")
                    {
                        assignSite = inMap[key] as string;
                    }
                }

                if (orderGuid == null || orderGuid.Length < 1 ||
                    assignSite == null || assignSite.Length < 1)
                {
                    System.Diagnostics.Debug.Assert(false, "Missing Parameter");
                    throw (new Exception("Miss Parameter in DeleteReportDAO!"));
                }
                string sql = string.Format("update tRegOrder set Assign2Siet ={0} where orderGuid={1}",
                                           orderGuid, assignSite);


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

                using (RisDAL dal = new RisDAL())
                {
                    dal.ExecuteNonQuery(sql);
                }

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

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

            return("-1");
        }
Esempio n. 8
0
        /// <summary>
        /// DeclareNoCase
        /// </summary>
        public static void DeclareOracleNoCase()
        {
            try
            {
                string sql0 = " alter session set nls_comp=ANSI";
                string sql1 = " alter session set nls_sort=GENERIC_BASELETTER";

                using (RisDAL dal = new RisDAL())
                {
                    if (dal.DriverClassName.ToUpper() == "ORACLE")
                    {
                        dal.ExecuteNonQuery(sql0);
                        dal.ExecuteNonQuery(sql1);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);
            }
        }
Esempio n. 9
0
        public override bool ModifyReportTemplate(string strTemplateGuid, ReportTemplateModel model)
        {
            RisDAL dataAccess = new RisDAL();

            model.CheckItemName = model.CheckItemName.Replace("'", "''");
            model.DoctorAdvice  = model.DoctorAdvice.Replace("'", "''");
            // model.TechInfo = model.TechInfo.Replace("'", "''");
            // model.WYG = model.WYG.Replace("'", "''");
            // model.WYS =  model.WYS.Replace("'", "''");
            int    mark = 0;
            string sql  = string.Format("Update tReportTemplate set TemplateName='{0}',ModalityType='{1}',BodyPart='{2}',CheckItemName='{3}',DoctorAdvice='{4}',ShortcutCode='{5}',ACRCode='{6}',ACRAnatomicDesc='{7}',ACRPathologicDesc='{8}',BodyCategory='{9}'where TemplateGuid='{10}'",
                                        model.TemplateName, model.ModalityType, model.BodyPart, model.CheckItemName, model.DoctorAdvice, model.ShortcutCode, model.ACRCode, model.ACRAnatomicDesc, model.ACRPathologicDesc, model.BodyCategory, strTemplateGuid);

            byte[] byteWYS        = System.Text.Encoding.Default.GetBytes(model.WYS);
            byte[] byteWYG        = System.Text.Encoding.Default.GetBytes(model.WYG);
            byte[] byteAppendInfo = System.Text.Encoding.Default.GetBytes(model.AppendInfo);
            byte[] byteTechInfo   = System.Text.Encoding.Default.GetBytes(model.TechInfo);

            try
            {
                mark = dataAccess.ExecuteNonQuery(sql);
                dataAccess.WriteLargeObj("tReportTemplate", "TemplateGuid", strTemplateGuid, "WYS", byteWYS, byteWYS.Length, RisDAL.ConnectionState.CloseOnExit);
                dataAccess.WriteLargeObj("tReportTemplate", "TemplateGuid", strTemplateGuid, "WYG", byteWYG, byteWYG.Length, RisDAL.ConnectionState.CloseOnExit);
                dataAccess.WriteLargeObj("tReportTemplate", "TemplateGuid", strTemplateGuid, "AppendInfo", byteAppendInfo, byteAppendInfo.Length, RisDAL.ConnectionState.CloseOnExit);
                dataAccess.WriteLargeObj("tReportTemplate", "TemplateGuid", strTemplateGuid, "TechInfo", byteTechInfo, byteTechInfo.Length, RisDAL.ConnectionState.CloseOnExit);
            }
            catch (Exception e)
            {
                lm.Error((long)ModuleEnum.Templates_DA, ModuleInstanceName.Templates, 1, e.Message, Application.StartupPath.ToString(),
                         (new System.Diagnostics.StackFrame(true)).GetFileName(),
                         Convert.ToInt32(new System.Diagnostics.StackFrame(true).GetFileLineNumber().ToString()));
                return(false);
            }
            finally
            {
                if (dataAccess != null)
                {
                    dataAccess.Dispose();
                }
            }
            if (mark == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
        public object Execute(object param)
        {
            try
            {
                BaseDataSetModel bdsm = param as BaseDataSetModel;

                if (bdsm == null || bdsm.DataSetParameter == null)
                {
                    throw (new Exception("No parameter in SaveLeaveWordDAO!"));
                }



                //KodakDAL dal = new KodakDAL();
                {
                    DataSet ds = bdsm.DataSetParameter;
                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        string strReportGuid = Convert.ToString(ds.Tables[0].Rows[0]["ReportGuid"]);
                        string strLeaveWord  = Convert.ToString(ds.Tables[0].Rows[0]["LeaveWord"]);
                        string strSQL        = string.Format("update tReport set isLeaveWord=1, Comments= @Comments where ReportGuid='{0}'", strReportGuid);
                        using (var dal = new RisDAL())
                        {
                            dal.Parameters.Add("@Comments", strLeaveWord);
                            dal.ExecuteNonQuery(strSQL);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

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


            return(true);
        }
Esempio n. 11
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 ";

                if (reportGuid != null && reportGuid.Length > 0)
                {
                    sql += " delete from tReShot where procedureGuid in (select procedureGuid from tRegProcedure "
                           + " where reportGuid = '" + reportGuid + "'; "
                           + " insert into tReShot(ProcedureGuid) select procedureGuid from tRegProcedure"
                           + " where reportGuid = '" + reportGuid + "'; "
                           + " update tReShot set reason='" + reason + "', rejectDoctor='" + curUserGuid + "', rejectDt = sysdate,domain='" + strDomain + "' "
                           + " where (rejectDoctor is null or rejectDoctor = '')"
                           + " and procedureGuid in (select procedureGuid from tRegProcedure "
                           + "  where reportGuid = '" + reportGuid + "'); ";

                    sql += " update tRegProcedure set status = " + System.Convert.ToInt32(ReportCommon.RP_Status.Repeatshot).ToString() + " where "
                           + "  reportGuid = '" + reportGuid + "'; "
                           + " delete from tReportlist where reportGuid = '" + reportGuid + "';"
                           + "  delete from tReport where reportGuid = '" + reportGuid + "'; ";
                }
                else if (rpGuids != null && rpGuids.Length > 0)
                {
                    if (!rpGuids.Contains("'"))
                    {
                        rpGuids = rpGuids.Replace(",", "','");
                        rpGuids = rpGuids.Replace(";", "','");
                        rpGuids = "'" + rpGuids + "'";
                    }


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


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

                sql += " commit; end;";



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

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

                using (RisDAL dal = new RisDAL())
                {
                    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");
        }
Esempio n. 12
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. 13
0
        /// <summary>
        /// OnReportDelete
        /// </summary>
        /// <param name="rptInfo"></param>
        /// <param name="nextStatus"></param>
        public static void OnReportDelete(tagReportInfo rptInfo, ReportCommon.RP_Status nextStatus)
        {
            try
            {
                // Need to send gateway
                if (!ServerPubFun.GetSystemProfile_Bool("SendToGateServer", ReportCommon.ModuleID.Integration))
                {
                    return;
                }

                //
                // Gateway
                using (RisDAL dal = new RisDAL())
                {
                    string guid = Guid.NewGuid().ToString();

                    if (dal.DriverClassName.ToUpper() == "ORACLE")
                    #region Oracle
                    {
                        string sql = " insert into GW_DataIndex(data_id, data_dt, event_type, RECORD_INDEX_1, Data_Source)"
                                     + " values('" + guid + "', SYSDATE, '" + (nextStatus == ReportCommon.RP_Status.Repeatshot ? "32" : "33") + "', 'ReportGuid', 'Local'); "
                                     + " insert into GW_Patient(DATA_ID,DATA_DT,PATIENTID,PATIENT_NAME,PATIENT_LOCAL_NAME,BIRTHDATE,SEX)"
                                     + "    values('" + guid + "', SYSDATE, '" + rptInfo.patientID + "','" + rptInfo.patientName + "',N'" + rptInfo.patientLocalName + "','" + rptInfo.birthday.ToString("yyyy-MM-dd") + "','" + rptInfo.gender + "'); "
                                     + " insert into GW_Order(DATA_ID,DATA_DT,ORDER_NO,FILLER_NO,PATIENT_ID,EXAM_STATUS) "
                                     + "    values('" + guid + "', SYSDATE, '" + rptInfo.orderGuid + "', '" + rptInfo.AccNO + "', '" + rptInfo.patientID
                                     + "', '" + (nextStatus == ReportCommon.RP_Status.Repeatshot ? "17" : "16") + "'); "
                                     + " insert into GW_Report(data_id, data_dt, report_no, ACCESSION_NUMBER, PATIENT_ID, REPORT_STATUS, MODALITY, "
                                     + " REPORT_TYPE, REPORT_FILE, REPORT_WRITER, REPORT_APPROVER, REPORTDT, OBSERVATIONMETHOD)"
                                     + " values('" + guid + "', SYSDATE, '"
                                     + ((rptInfo.reportGuid == null || rptInfo.reportGuid == "") ? " " : rptInfo.reportGuid) + "', '"
                                     + rptInfo.AccNO + "'," + " '" + rptInfo.patientID + "', '204', '"
                                     + rptInfo.modality + "', '0', '', '" + rptInfo.reportCreater_LocalName + "',"
                                     + " '" + rptInfo.reportApprover_LocalName + "', '" + rptInfo.reportApproveDt.ToString("yyyy-MM-dd HH:mm:ss") + "',"
                                     + " '" + ReportCommon.ReportCommon.StringLeft(rptInfo.operationStep, ServerPubFun.GetColumnWidth("GW_Report", "OBSERVATIONMETHOD") / 2) + "'); ";

                        sql = "begin " + sql + " commit; end;";

                        dal.ExecuteNonQuery(sql);

                        if (rptInfo.wysText != null && rptInfo.wysText.Length > 0)
                        {
                            dal.WriteLargeObj("GW_Report", "data_id", guid, "DIAGNOSE", rptInfo.wysText, rptInfo.wysText.Length, RisDAL.ConnectionState.KeepOpen);
                        }

                        if (rptInfo.wygText != null && rptInfo.wygText.Length > 0)
                        {
                            dal.WriteLargeObj("GW_Report", "data_id", guid, "COMMENTS", rptInfo.wygText, rptInfo.wygText.Length, RisDAL.ConnectionState.KeepOpen);
                        }
                    }
                    #endregion
                    else if (dal.DriverClassName.ToUpper() == "MSSQL")
                    #region MSSQL
                    {
                        string sql = SaveReportDAO_MSSQL.MakeSQL4GateWay(rptInfo, guid, nextStatus == ReportCommon.RP_Status.Repeatshot ? 32 : 33, 16, 204);

                        using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(dal.ConnectionString))
                        {
                            conn.Open();

                            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
                            cmd.Connection = conn;

                            try
                            {
                                //
                                // begin transaction
                                //cmd.Transaction = conn.BeginTransaction();

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

                                cmd.CommandText = sql;
                                cmd.ExecuteNonQuery();
                            }
                            catch (Exception ex)
                            {
                                //cmd.Transaction.Rollback();

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

                                RISLog_Error(0, "OnReportDelete, MSG=" + ex.Message + ", SQL=" + sql,
                                             (new System.Diagnostics.StackFrame(true)).GetFileName(),
                                             (new System.Diagnostics.StackFrame(true)).GetFileLineNumber());
                            }
                        }
                    }
                    #endregion
                    else
                    {
                        System.Diagnostics.Debug.Assert(false, "Invalid DB setting!");
                    }

                    // Hippa
                    Server.Utilities.HippaLogTool.HippaLogTool.AuditPatientCareAssignMsg(
                        CommonGlobalSettings.HippaName.ActionCode.Delete,

                        rptInfo.AccNO, rptInfo.reportGuid, rptInfo.reportName, rptInfo.patientID, rptInfo.patientName, "", true);
                }
            }
            catch
            {
                Server.Utilities.HippaLogTool.HippaLogTool.AuditPatientCareAssignMsg(
                    CommonGlobalSettings.HippaName.ActionCode.Delete,
                    rptInfo.AccNO, rptInfo.reportGuid, rptInfo.reportName, rptInfo.patientID, rptInfo.patientName, "", false);
            }
        }
Esempio n. 14
0
        public override bool AddPrintTemplate(BaseDataSetModel model)
        {
            RisDAL    dataAccess = new RisDAL();
            DataTable myTable    = model.DataSetParameter.Tables[0];
            string    sql        = "Insert into tPrintTemplate(TemplateGuid,Type,TemplateName,IsDefaultByType,Version,ModalityType,IsDefaultByModality) values(:TemplateGuid,:TemplateType,:TemplateName,:IsDefaultByType,0,:ModalityType,:IsDefaultByModality)";

            dataAccess.Parameters.AddChar(":TemplateGuid", myTable.Rows[0]["TemplateGuid"].ToString());
            dataAccess.Parameters.AddInt(":TemplateType", Convert.ToInt32(myTable.Rows[0]["Type"]));
            dataAccess.Parameters.AddChar(":TemplateName", myTable.Rows[0]["TemplateName"].ToString());
            dataAccess.Parameters.AddInt(":IsDefaultByType", Convert.ToInt32(myTable.Rows[0]["IsDefaultByType"]));
            dataAccess.Parameters.AddChar(":ModalityType", Convert.ToString(myTable.Rows[0]["ModalityType"]));
            dataAccess.Parameters.AddInt(":IsDefaultByModality", Convert.ToInt32(myTable.Rows[0]["IsDefaultByModality"]));
            //  string sql1 = string.Format("select TemplateGuid from tPrintTemplate where Type = {0} and IsDefault=1", Convert.ToInt32(myTable.Rows[0]["Type"]));
            byte[] byteTemplateInfo = System.Text.Encoding.Unicode.GetBytes(myTable.Rows[0]["TemplateInfo"].ToString());
            try
            {
                //  if (myTable.Rows[0]["IsDefault"].ToString() == "0")
                //  {

                dataAccess.ExecuteNonQuery(sql);
                dataAccess.WriteLargeObj("tPrintTemplate", "TemplateGuid", myTable.Rows[0]["TemplateGuid"].ToString(), "TemplateInfo", byteTemplateInfo, byteTemplateInfo.Length, RisDAL.ConnectionState.KeepOpen);

                //  }
                //else
                //{

                //    dataAccess.Parameters.Clear();
                //    Object o = dataAccess.ExecuteScalar(sql1);
                //    if (o == null )
                //    {
                //        sql = "Insert into tPrintTemplate(TemplateGuid,Type,TemplateName,TemplateInfo,IsDefault,Version) values(@TemplateGuid,@Type,@TemplateName,@TemplateInfo,@IsDefault,0)";
                //        dataAccess.Parameters.AddVarChar("@TemplateGuid", myTable.Rows[0]["TemplateGuid"].ToString());
                //        dataAccess.Parameters.AddInt("@Type", Convert.ToInt32(myTable.Rows[0]["Type"]));
                //        dataAccess.Parameters.AddVarChar("@TemplateName", myTable.Rows[0]["TemplateName"].ToString());
                //        dataAccess.Parameters.Add("@TemplateInfo", System.Text.Encoding.Default.GetBytes(myTable.Rows[0]["TemplateInfo"].ToString()));
                //        dataAccess.Parameters.AddInt("IsDefault", Convert.ToInt32(myTable.Rows[0]["IsDefault"]));
                //        dataAccess.ExecuteNonQuery(sql);
                //    }
                //    else
                //    {
                //        string strTemplateGuid = o.ToString();
                //        dataAccess.BeginTransaction();
                //        sql = "Insert into tPrintTemplate(TemplateGuid,Type,TemplateName,TemplateInfo,IsDefault,Version) values(@TemplateGuid,@Type,@TemplateName,@TemplateInfo,@IsDefault,0)";
                //        dataAccess.Parameters.AddVarChar("@TemplateGuid", myTable.Rows[0]["TemplateGuid"].ToString());
                //        dataAccess.Parameters.AddInt("@Type", Convert.ToInt32(myTable.Rows[0]["Type"]));
                //        dataAccess.Parameters.AddVarChar("@TemplateName", myTable.Rows[0]["TemplateName"].ToString());
                //        dataAccess.Parameters.Add("@TemplateInfo", System.Text.Encoding.Default.GetBytes(myTable.Rows[0]["TemplateInfo"].ToString()));
                //        dataAccess.Parameters.AddInt("IsDefault", Convert.ToInt32(myTable.Rows[0]["IsDefault"]));

                //        dataAccess.ExecuteNonQuery(sql, KodakDAL.ConnectionState.KeepOpen);
                //        string sql2 = string.Format("Update tPrintTemplate set IsDefault = 0 where TemplateGuid = '{0}'", strTemplateGuid);
                //        dataAccess.ExecuteNonQuery(sql2,KodakDAL.ConnectionState.KeepOpen);

                //        dataAccess.CommitTransaction();
                //    }
                //}
            }
            catch (Exception e)
            {
                lm.Error((long)ModuleEnum.Templates_DA, ModuleInstanceName.Templates, 1, e.Message, Application.StartupPath.ToString(),
                         (new System.Diagnostics.StackFrame(true)).GetFileName(),
                         Convert.ToInt32(new System.Diagnostics.StackFrame(true).GetFileLineNumber().ToString()));
                return(false);
            }
            finally
            {
                if (dataAccess != null)
                {
                    dataAccess.Dispose();
                }
            }

            return(true);
        }
Esempio n. 15
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 SaveReportDAO!"));
                }

                string[] reportGuids = null;
                string   curUserGuid = "", comments = "", snapShotSrvPath = "", modalityType = "", modality = "";
                int      logType = 0, cnt = 1, costTime = 0;
                string   strType = "", strMultiCostTime = null;
                string   strPrintTemplateGuid = "";

                foreach (string key in inMap.Keys)
                {
                    if (key.ToUpper() == "LOGTYPE")
                    {
                        string tmp = inMap[key] as string;

                        if (tmp != null && tmp.Length > 0)
                        {
                            logType = System.Convert.ToInt32(tmp);
                        }
                    }
                    else if (key.ToUpper() == "REPORTGUIDS" || key.ToUpper() == "REPORTGUID")
                    {
                        string tmp = inMap[key] as string;

                        if (tmp != null && (tmp = tmp.Trim(", ".ToCharArray())).Length > 0)
                        {
                            reportGuids = tmp.Split(',');
                        }
                    }
                    else if (key.ToUpper() == "COUNT")
                    {
                        string tmp = inMap[key] as string;

                        if (tmp != null && tmp.Length > 0)
                        {
                            cnt = System.Convert.ToInt32(tmp);
                        }
                    }
                    else if (key.ToUpper() == "USERID" || key.ToUpper() == "USERGUID")
                    {
                        curUserGuid = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "COMMENTS")
                    {
                        comments = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "SNAPSHOTSRVPATH")
                    {
                        snapShotSrvPath = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "MODALITYTYPE")
                    {
                        modalityType = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "MODALITY")
                    {
                        modality = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "COSTTIME")
                    {
                        string tmp = inMap[key] as string;

                        if (tmp != null && tmp.Length > 0)
                        {
                            costTime = System.Convert.ToInt32(tmp);
                        }
                    }
                    else if (key.ToUpper() == "TYPE")
                    {
                        strType = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "MULTICOSTTIME")
                    {
                        strMultiCostTime = inMap[key] as string;
                    }
                    else if (key.ToUpper() == "PRINTTEMPLATEGUID")
                    {
                        strPrintTemplateGuid = inMap[key] as string;
                    }
                }

                string sql = "";

                string strDomain = CommonGlobalSettings.Utilities.GetCurDomain();

                if (strMultiCostTime != null && strMultiCostTime.Trim().Length > 0)
                {
                    string[] arrCostTime = strMultiCostTime.Split('|');

                    sql += " insert into tEventLog(guid, eventCode, ModalityType, costtime, createdt, operator,Domain)"
                           + " values('" + Guid.NewGuid().ToString() + "', " + (int)ReportCommon.ReportLog_Type.EventLog_Exam2Draft + ", '" + modalityType + "', "
                           + arrCostTime[0].ToString() + ", getdate(), '" + curUserGuid + "','" + strDomain + "') \r\n";

                    sql += " insert into tEventLog(guid, eventCode, ModalityType, costtime, createdt, operator,Domain)"
                           + " values('" + Guid.NewGuid().ToString() + "', " + (int)ReportCommon.ReportLog_Type.EventLog_Draft2Submit + ", '" + modalityType + "', "
                           + arrCostTime[1].ToString() + ", getdate(), '" + curUserGuid + "','" + strDomain + "')  \r\n";

                    sql += " insert into tEventLog(guid, eventCode, ModalityType, costtime, createdt, operator,Domain)"
                           + " values('" + Guid.NewGuid().ToString() + "', " + (int)ReportCommon.ReportLog_Type.EventLog_Submit2Approve + ", '" + modalityType + "', "
                           + arrCostTime[2].ToString() + ", getdate(), '" + curUserGuid + "','" + strDomain + "')  \r\n";

                    sql += " insert into tEventLog(guid, eventCode, ModalityType, costtime, createdt, operator,Domain)"
                           + " values('" + Guid.NewGuid().ToString() + "', " + (int)ReportCommon.ReportLog_Type.EventLog_ApproveStart2End + ", '" + modalityType + "', "
                           + arrCostTime[3].ToString() + ", getdate(), '" + curUserGuid + "','" + strDomain + "')  \r\n";
                }
                else
                {
                    if (logType == System.Convert.ToInt32(ReportCommon.ReportLog_Type.EventLog_Exam2Draft) ||
                        logType == System.Convert.ToInt32(ReportCommon.ReportLog_Type.EventLog_Draft2Submit) ||
                        logType == System.Convert.ToInt32(ReportCommon.ReportLog_Type.EventLog_Submit2Approve) ||
                        logType == System.Convert.ToInt32(ReportCommon.ReportLog_Type.EventLog_ApproveStart2End) ||
                        logType == System.Convert.ToInt32(ReportCommon.ReportLog_Type.EventLog_Exam2Print))
                    {
                        if (reportGuids.Length > 0)
                        {
                            sql = "insert into tEventLog(guid, eventCode, ModalityType, costtime, createdt, operator,Domain)"
                                  + " values('" + Guid.NewGuid().ToString() + "', " + logType.ToString() + ", '" + modalityType + "', "
                                  + costTime.ToString() + ", getdate(), '" + curUserGuid + "','" + strDomain + "')";
                        }
                    }
                    // 2015-06-08, Oscar added (US25173)
                    else if (logType == (int)ReportCommon.ReportLog_Type.EventLog_SubmitCostTime ||
                             logType == (int)ReportCommon.ReportLog_Type.EventLog_ApproveCostTime)
                    {
                        if (reportGuids.Length > 0)
                        {
                            sql += UpsertEventLog(logType, modalityType, costTime, curUserGuid, strDomain, reportGuids[0]);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < reportGuids.Length; i++)
                        {
                            string tmp = reportGuids.GetValue(i) as string;
                            if (tmp != null && tmp.Length > 0)
                            {
                                if (cnt < 1)
                                {
                                    sql += " insert into tReportPrintLog(fileGuid, ReportGuid,Printer,PrintDt,Counts,Comments,snapShotSrvPath,Type,Domain) "
                                           + " values(newid(), '" + tmp + "', '" + curUserGuid + "', getdate(), "
                                           + cnt.ToString() + ", '" + comments + "', '" + snapShotSrvPath + "','" + strType + "','" + strDomain + "') \r\n";
                                }
                                else
                                {
                                    sql += " update tReport set isPrint=1,Optional1='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', PrintTemplateGuid ='" + strPrintTemplateGuid + "' where reportGuid='" + tmp + "' \r\n"
                                           + " insert into tReportPrintLog(fileGuid, ReportGuid,Printer,PrintDt,Counts,Comments,snapShotSrvPath,Type,PrintTemplateGuid,Domain)"
                                           + " values(newid(), '" + tmp + "', '" + curUserGuid + "', getdate(), "
                                           + cnt.ToString() + ", '" + comments + "', '" + snapShotSrvPath + "','" + strType + "','" + strPrintTemplateGuid + "','" + strDomain + "') \r\n";
                                }
                            }
                        }
                    }
                }
                if (0 == iWrittenLog++ % 100)
                {
                    ServerPubFun.RISLog_Info(0, "RecordLogDAO, UserGuid=" + curUserGuid + ", SQL=" + sql,
                                             (new System.Diagnostics.StackFrame()).GetFileName(),
                                             (new System.Diagnostics.StackFrame()).GetFileLineNumber());
                }
                else
                {
                    ServerPubFun.RISLog_Info(0, "RecordLogDAO, UserGuid=" + curUserGuid + ", reportGuids=" + reportGuids.ToString(),
                                             (new System.Diagnostics.StackFrame()).GetFileName(),
                                             (new System.Diagnostics.StackFrame()).GetFileLineNumber());
                }

                if (sql.Length > 0)
                {
                    using (RisDAL dal = new RisDAL())
                    {
                        dal.ExecuteNonQuery(sql);

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

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

            return(false);
        }
Esempio n. 16
0
        public override bool UpdateEYTemplate(DataSet ds, ref string strError)
        {
            bool   bReturn = true;
            RisDAL oKodak  = new RisDAL();

            try
            {
                List <string> listSQL   = new List <string>();
                DataTable     dt        = ds.Tables["EYTemplate"];
                StringBuilder strBuiler = new StringBuilder();
                foreach (DataRow dr in dt.Rows)
                {
                    string strTemplateName = Convert.ToString(dr["TemplateName"]);
                    string strTemplateGuid = Convert.ToString(dr["TemplateGuid"]);

                    string strSQL = string.Format("SELECT count(*) FROM tEmergencyTemplate where TemplateGuid='{0}'", strTemplateGuid);
                    object obj    = oKodak.ExecuteScalar(strSQL);
                    if (obj == null)
                    {
                        throw new Exception("Unknow error");
                    }
                    int nCount = Convert.ToInt32(obj);
                    if (nCount == 0)
                    {
                        throw new Exception("Can not save due to the template not exists.");
                    }

                    strSQL = string.Format("SELECT count(*) FROM tEmergencyTemplate where TemplateName='{0}' AND TemplateGuid!='{1}'", strTemplateName, strTemplateGuid);
                    obj    = oKodak.ExecuteScalar(strSQL);
                    if (obj == null)
                    {
                        throw new Exception("Unknow error");
                    }
                    nCount = Convert.ToInt32(obj);
                    if (nCount > 0)
                    {
                        throw new Exception("Reduplicate template name");
                    }


                    strBuiler.Remove(0, strBuiler.Length);
                    strBuiler = strBuiler.AppendFormat("UPDATE tEmergencyTemplate SET TemplateName='{0}',NamePrefix='{1}',Birthday=to_date('{2}','YYYY-MM-DD'),Gender='{3}',Telephone='{4}',", Convert.ToString(dr["TemplateName"]), Convert.ToString(dr["NamePrefix"]), Convert.ToDateTime(dr["Birthday"]).ToString("yyyy-MM-dd"), Convert.ToString(dr["GenderValue"]), Convert.ToString(dr["Telephone"]))
                                .AppendFormat("InhospitalNo='{0}',ClinicNo='{1}',BedNo='{2}',ApplyDept='{3}',", dr["InhospitalNo"].ToString(), dr["ClinicNo"].ToString(), dr["BedNo"].ToString(), dr["ApplyDeptValue"].ToString())
                                .AppendFormat("ApplyDoctor='{0}',ProcedureCode='{1}',Description='{2}' WHERE TemplateGuid='{3}'", Convert.ToString(dr["ApplyDoctorValue"]), Convert.ToString(dr["ProcedureCode"]), Convert.ToString(dr["Description"]), Convert.ToString(dr["TemplateGuid"]));

                    listSQL.Add(strBuiler.ToString());

                    string strApplyDept   = Convert.ToString(dr["ApplyDeptValue"]);
                    string strApplyDoctor = Convert.ToString(dr["ApplyDoctorValue"]);
                    strApplyDept = strApplyDept.Trim();
                    if (strApplyDept.Length > 0)
                    {
                        strSQL = string.Format("SELECT count(*) FROM tDictionaryValue WHERE (DictionaryValue='{0}' or Description='{1}') and Tag=2", strApplyDept, strApplyDept);
                        obj    = oKodak.ExecuteScalar(strSQL);
                        if (obj == null)
                        {
                            throw new Exception("Unknow error");
                        }
                        nCount = Convert.ToInt32(obj);
                        if (nCount == 0)
                        {
                            strSQL = string.Format("INSERT INTO tDictionaryValue(Tag,DictionaryValue,Description,shortcutcode) VALUES(2,'{0}','{1}','')", strApplyDept, strApplyDept);
                            listSQL.Add(strSQL);
                        }
                    }

                    strApplyDoctor = strApplyDoctor.Trim();
                    if (strApplyDoctor.Length > 0)
                    {
                        strSQL = string.Format("SELECT count(*) FROM tDictionaryValue WHERE (DictionaryValue='{0}' or Description='{1}') and Tag=8", strApplyDoctor, strApplyDoctor);
                        obj    = oKodak.ExecuteScalar(strSQL);
                        if (obj == null)
                        {
                            throw new Exception("Unknow error");
                        }
                        nCount = Convert.ToInt32(obj);
                        if (nCount == 0)
                        {
                            strSQL = string.Format("INSERT INTO tDictionaryValue(Tag,DictionaryValue,Description,shortcutcode) VALUES(8,'{0}','{1}','')", strApplyDoctor, strApplyDoctor);
                            listSQL.Add(strSQL);
                        }
                    }
                }

                oKodak.BeginTransaction();
                foreach (string strSQL in listSQL)
                {
                    oKodak.ExecuteNonQuery(strSQL, RisDAL.ConnectionState.KeepOpen);
                }
                oKodak.CommitTransaction();
            }
            catch (Exception e)
            {
                strError = e.Message;
                bReturn  = false;
                lm.Error((long)ModuleEnum.Templates_DA, ModuleInstanceName.Templates, 1, e.Message, Application.StartupPath.ToString(),
                         (new System.Diagnostics.StackFrame(true)).GetFileName(),
                         Convert.ToInt32(new System.Diagnostics.StackFrame(true).GetFileLineNumber().ToString()));
            }
            finally
            {
                if (oKodak != null)
                {
                    oKodak.Dispose();
                }
            }
            return(bReturn);
        }
Esempio n. 17
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 DeleteReportDAO!"));
                }

                string reportGuid = "", curUserGuid = "";

                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;
                    }
                }

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

                string sql = " begin "
                             + " update tRegProcedure set status = " + System.Convert.ToInt32(ReportCommon.RP_Status.Examination).ToString()
                             + " where reportGuid = '" + reportGuid + "'; "
                             + " delete from tReportlist where reportGuid = '" + reportGuid + "';"
                             + " delete from tReport  where reportGuid = '" + reportGuid + "'; "
                             + " commit; end;";



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

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

                using (RisDAL dal = new RisDAL())
                {
                    dal.ExecuteNonQuery(sql);
                }
                return(true);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

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

            return("-1");
        }
Esempio n. 18
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");
        }