Пример #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 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");
        }
Пример #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> paramMap = param as Dictionary<string, object>;

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


                try
                {
                    DataSet ds = paramMap["DataSet"] as DataSet;

                    object objSign = ds.Tables[0].Rows[0]["DrawerSign"];
                    string strTakeFilmDept = Convert.ToString(ds.Tables[0].Rows[0]["TakeFilmDept"]);
                    string strTakeFilmRegion = Convert.ToString(ds.Tables[0].Rows[0]["TakeFilmRegion"]);
                    string strTakeFilmComment = Convert.ToString(ds.Tables[0].Rows[0]["TakeFilmComment"]);
                    //object objReportTextApprovedSign = ds.Tables[0].Rows[0]["ReportTextApprovedSign"];
                    //object objReportTextSubmittedSign = ds.Tables[0].Rows[0]["ReportTextSubmittedSign"];
                    //object objCombinedForCertification = ds.Tables[0].Rows[0]["CombinedForCertification"];
                    //object objSignCombinedForCertification = ds.Tables[0].Rows[0]["SignCombinedForCertification"];
                    using (RisDAL oKodak = new RisDAL())
                    {
                        using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(oKodak.ConnectionString))
                        {
                            conn.Open();
                            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
                            cmd.CommandTimeout = 0;
                            cmd.Connection = conn;



                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                string strReportGuid = Convert.ToString(dr["ReportGuid"]);
                                cmd.CommandText = string.Format(
                                    "update tReport set IsDraw=" + ((objSign is System.DBNull) ? "0" : "1") + ",TakeFilmDept=@dept,"
                                    + " TakeFilmRegion=@region,TakeFilmComment=@comments,"
                                    + " DrawerSign=@file,DrawTime=getdate() "
                                    + " where ReportGuid='{0}'", strReportGuid);
                                cmd.Parameters.Clear();

                                cmd.Parameters.AddWithValue("@dept", strTakeFilmDept);
                                cmd.Parameters.AddWithValue("@region", strTakeFilmRegion);
                                cmd.Parameters.AddWithValue("@comments", strTakeFilmComment);
                                //cmd.Parameters.AddWithValue("@file", objSign);

                                cmd.Parameters.Add("@file", SqlDbType.VarBinary, -1);
                                cmd.Parameters["@file"].Value = (objSign is System.DBNull) ? System.DBNull.Value : objSign;

                                cmd.ExecuteNonQuery();

                                //cmd.CommandText = string.Format("update tReport set "
                                //    + " ReportTextApprovedSign=@objReportTextApprovedSign"
                                //    + " where ReportGuid='{0}'", strReportGuid);
                                //cmd.Parameters.Add("@objReportTextApprovedSign", SqlDbType.VarBinary, -1);
                                //cmd.Parameters["@objReportTextApprovedSign"].Value
                                //    = (objReportTextApprovedSign is System.DBNull) ? System.DBNull.Value : objReportTextApprovedSign;
                                //cmd.ExecuteNonQuery();

                                //cmd.CommandText = string.Format("update tReport set "
                                //    + " ReportTextSubmittedSign=@objReportTextSubmittedSign"
                                //    + " where ReportGuid='{0}'", strReportGuid);
                                //cmd.Parameters.Add("@objReportTextSubmittedSign", SqlDbType.VarBinary, -1);
                                //cmd.Parameters["@objReportTextSubmittedSign"].Value
                                //    = (objReportTextSubmittedSign is System.DBNull) ? System.DBNull.Value : objReportTextSubmittedSign;
                                //cmd.ExecuteNonQuery();

                                //cmd.CommandText = string.Format("update tReport set "
                                //    + " CombinedForCertification=@objCombinedForCertification"
                                //    + " where ReportGuid='{0}'", strReportGuid);
                                //cmd.Parameters.Add("@objCombinedForCertification", SqlDbType.VarBinary, -1);
                                //cmd.Parameters["@objCombinedForCertification"].Value
                                //    = (objCombinedForCertification is System.DBNull) ? System.DBNull.Value : objCombinedForCertification;
                                //cmd.ExecuteNonQuery();

                                //cmd.CommandText = string.Format("update tReport set "
                                //    + " SignCombinedForCertification=@objSignCombinedForCertification"
                                //    + " where ReportGuid='{0}'", strReportGuid);
                                //cmd.Parameters.Add("@objSignCombinedForCertification", SqlDbType.VarBinary, -1);
                                //cmd.Parameters["@objSignCombinedForCertification"].Value
                                //    = (objSignCombinedForCertification is System.DBNull) ? System.DBNull.Value : objSignCombinedForCertification;
                                //cmd.ExecuteNonQuery();

                                //Send to gateway eventtype=34
                                tagReportInfo rptInfo = ServerPubFun.GetReportInfo(strReportGuid);
                                string strSql = OnDeliverReport(rptInfo);
                                if (strSql != null && strSql.Trim().Length > 0)
                                {
                                    cmd.Parameters.Clear();
                                    cmd.CommandText = strSql;
                                    cmd.ExecuteNonQuery();
                                }
                            }
                        }
                    }


                }
                catch (Exception ex)
                {
                    //dal.RollbackTransaction();

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

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

                    throw (ex);
                }



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

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

            return true;
        }