Пример #1
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");
        }
Пример #2
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 tran \r\n"
                             + " update tRegProcedure set status = " + System.Convert.ToInt32(ReportCommon.RP_Status.Examination).ToString()
                             + " ,ReportGuid=null  where reportGuid = '" + reportGuid + "'  \r\n"
                             + " insert into treportdelpool select * from treport where reportguid='" + reportGuid + "' \r\n"
                             + " update treportdelpool set deleter='" + curUserGuid + "',deletedt='" + DateTime.Now.ToString() + "' where reportguid='" + reportGuid + "' \r\n"
                             + " delete from tReportlist where reportGuid = '" + reportGuid + "' \r\n"
                             + " delete from tReport where reportGuid = '" + reportGuid + "' \r\n"
                             #region Kevin For SR
                             + " delete from tReportContent where ReportId = '" + reportGuid + "'\r\n"
                             #endregion
                             + " commit";


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

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



                using (RisDAL dal = new RisDAL())
                {
                    DataTable dt = new DataTable();

                    dal.ExecuteQuery(sql, dt);
                }
                ServerPubFun.OnReportDelete(rptInfo, ReportCommon.RP_Status.Examination);

                //return (dt != null && dt.Rows.Count > 0);
                return(true);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);

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

            return("-1");
        }
Пример #3
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");
        }
Пример #4
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");
        }