Ejemplo n.º 1
0
    /// <summary>
    /// 최초기안상태일경우 원문문서 읽어오고 조직정보,결재선 세팅
    /// </summary>
    public void SetFirstDraftStatus()
    {
        WebCommon.FillComDeptTree(trvDept);

        string strTitle = "";
        Biz_Com_Approval_Info objApp = new Biz_Com_Approval_Info();
        bool blnRtn = objApp.GetOriDocTitle(this.IBiz_Type, Request.Params, out strTitle);

        if (blnRtn)
        {
            txtTitle.Text = strTitle;
        }
        else
        {
            ltrScript.Text = JSHelper.GetAlertScript("결재원문을 알수 없습니다.", true);
            return;
        }

        string strHtml = Server.HtmlDecode(Biz_Com_Approval_Info.GetHtmlSource(this.GetQueryString()));
        string strPos  = "{^0^}";
        int    iSPos   = strHtml.IndexOf(strPos) + strPos.Length;
        int    iEPos   = strHtml.LastIndexOf(strPos);

        divArea_M.InnerHtml = strHtml.Substring(iSPos, iEPos - iSPos);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 최초기안상태일경우 원문문서 읽어오고 조직정보,결재선 세팅
    /// </summary>
    public void SetFirstDraftStatus()
    {
        WebCommon.FillComDeptTree(trvDept);

        string strTitle = "";
        Biz_Com_Approval_Info objApp = new Biz_Com_Approval_Info();
        bool blnRtn = objApp.GetOriDocTitle(this.IBiz_Type, Request.Params, out strTitle);

        if (blnRtn)
        {
            txtTitle.Text = strTitle;
            if (this.IBiz_Type == Biz_Type.biz_type_kpi_rstbatch || this.IBiz_Type == Biz_Type.biz_type_target_resultbatch)
            {
                lblAppTitle.Text = strTitle;
            }
        }
        else
        {
            ltrScript.Text = JSHelper.GetAlertScript("결재원문을 알수 없습니다.", true);
            return;
        }
        //http://localhost:3184/_common/Draft/DOC0601S1.aspx?ESTTERM_REF_ID=1000&KPI_REF_ID=1044,1038&APP_CCB=lBtnReload2&BIZ_TYPE=KDB
        string strHtml = Server.HtmlDecode(Biz_Com_Approval_Info.GetHtmlSource(this.GetQueryString()));
        string strPos  = "{^0^}";
        int    iSPos   = strHtml.IndexOf(strPos) + strPos.Length;
        int    iEPos   = strHtml.LastIndexOf(strPos);

        divArea_M.InnerHtml = strHtml.Substring(iSPos, iEPos - iSPos);
    }
Ejemplo n.º 3
0
        /**
         * 결재상신요청 화면 호출
         */
        void IApprovalProcess.CallApprovalView()
        {
            /* 서울우유의 결재요청 프로세스
             * 1. 결재화면 스트림 생성
             * 2. I/F 테이블 생성
             * 3. 결재화면 스트림을 I/F 테이블에 저장
             * 4. 결재화면 호출
             */
            long appSeq      = 0;
            bool successFlag = false;

            bodyInfo = Biz_Com_Approval_Info.GetHtmlSource(this.GetQueryString());
            int startPos = bodyInfo.IndexOf("{^0^}") + 5;
            int endPos   = bodyInfo.LastIndexOf("{^0^}");

            bodyInfo = bodyInfo.Substring(startPos, endPos - startPos);
            IDbConnection conn = DbAgentHelper.CreateDbConnection();

            conn.Open();
            IDbTransaction trx = conn.BeginTransaction();

            try
            {
                String queryLegacyKey = "SELECT MAX(APPSEQ) FROM t_applegacy4erp"
                                        + " WHERE APPREQDATE = '" + makeTime.Substring(0, 8) + "'";

                object maxSeq = this.DbAgentObj.ExecuteScalar(conn, trx, queryLegacyKey, null, CommandType.Text);

                if (maxSeq == System.DBNull.Value || maxSeq == null)
                {
                    appSeq         = appSeq + 1;
                    this.legacyKey = this.bizType + makeTime.Substring(0, 8) + appSeq.ToString().PadLeft(6, '0');
                }
                else
                {
                    appSeq = long.Parse((((decimal)maxSeq) + 1).ToString());

                    this.legacyKey = this.bizType + makeTime.Substring(0, 8) + appSeq.ToString().PadLeft(6, '0');
                }

                String queryString = "INSERT INTO t_applegacy4erp"
                                     + " (LEGACYKEY, LEGACYTYPE, APPFORM, USERID, MAKETIME, TITLE, APPLINE, ESTTERMREFID, KPIREFID, ESTTERMYMD, APPREQDATE, APPSEQ, APPREFID, USERREFID)"
                                     + " VALUES"
                                     + " ('" + this.legacyKey + "', '"
                                     + this.legacyType + "', '"
                                     + this.appForm + "', '"
                                     + this.userCode + "', '"
                                     + this.makeTime + "', '"
                                     + this.appTitle + "', '"
                                     + this.appLine + "', '"
                                     + this.esttermRefId + "', '"
                                     + this.kpiRefId + "', '"
                                     + this.esttermYmd + "', '"
                                     + this.makeTime.Substring(0, 8) + "', "
                                     + appSeq + ", "
                                     + this.appRefId + ", "
                                     + this.userId + ")";
                int success;

                success = this.DbAgentObj.ExecuteNonQuery(conn, trx, queryString);

                String queryBody = "INSERT INTO t_applegacybody4erp(LEGACYKEY, BODYCONTENTS) VALUES ('" + this.legacyKey + "', @bodycontent)";

                System.Data.SqlClient.SqlParameter param = new System.Data.SqlClient.SqlParameter("@bodycontent", SqlDbType.Text);
                param.Value = bodyInfo;

                success = this.DbAgentObj.ExecuteNonQuery(conn, trx, queryBody, new System.Data.SqlClient.SqlParameter[] { param });

                trx.Commit();
                successFlag = true;
            }
            catch (Exception ex)
            {
                trx.Rollback();
            }


            if (successFlag == true)
            {
                context.Response.Redirect(SERVERADDR + "?id=" + this.userCode
                                          + "&legacykey=" + this.legacyKey
                                          + "&reqtime=" + this.makeTime
                                          + "&ifname=SMILK_BSC");
            }
            else
            {
                context.Response.Write("Error !!!!");
            }
        }
Ejemplo n.º 4
0
    /// <summary>
    /// 기안, 재기안, 수정기안
    /// </summary>
    public void SetDraft()
    {
        string KPI_REF_ID            = Request["KPI_REF_ID"].ToString();
        string ymd                   = GetRequest("YMD", "");
        Biz_Com_Approval_Info objApp = new Biz_Com_Approval_Info();
        bool blnRtn                  = false;
        //결재완결처리 결재선이 하나인경우 완결처리
        string sAppStatus = (ugrdAppLine.Rows.Count == 1) ? Biz_Type.app_status_complete : Biz_Type.app_status_draft;

        //기안
        if (this.IDraft_Status == Biz_Type.app_draft_first)         //최초기안
        {
            if (GetRequest("KPI_REF_ID", "").Split(',').Length < 1)
            {
                ltrScript.Text = JSHelper.GetAlertScript("결재처리할 KPI코드를 확인하세요!");
                return;
            }

            IDbConnection conn = MicroBSC.Data.DbAgentHelper.CreateDbConnection();
            conn.Open();
            IDbTransaction trx = conn.BeginTransaction();

            string strTermid = GetRequest("ESTTERM_REF_ID");

            //현재 시점에 결재여부 재확인
            MicroBSC.BSC.Biz.Biz_Bsc_Kpi_Info objkpi = new MicroBSC.BSC.Biz.Biz_Bsc_Kpi_Info();

            DataSet dsKPI = new DataSet();
            if (this.IBiz_Type == Biz_Type.biz_type_kpi_docbatch)
            {
                dsKPI = objkpi.GetKpiListForBatchDraft(DataTypeUtility.GetToInt32(strTermid)
                                                       , "", "", "Y", gUserInfo.Emp_Ref_ID, GetRequest("KPI_REF_ID"));
            }
            else if (this.IBiz_Type == Biz_Type.biz_type_kpi_rstbatch)
            {
                dsKPI = objkpi.GetKpiResultListForBatchDraft(DataTypeUtility.GetToInt32(strTermid)
                                                             , ymd, "", "", "Y", gUserInfo.Emp_Ref_ID, GetRequest("KPI_REF_ID"));
            }
            else if (this.IBiz_Type == Biz_Type.biz_type_target_resultbatch)
            {
                dsKPI = objkpi.GetKpiResultListForBatchDraft(DataTypeUtility.GetToInt32(strTermid)
                                                             , ymd, "", "", "N", gUserInfo.Emp_Ref_ID, GetRequest("KPI_REF_ID"));
            }
            if (dsKPI.Tables[0].Rows.Count > 0)
            {
                if (dsKPI.Tables[0].Rows.Count != KPI_REF_ID.Split(',').Length)
                {
                    trx.Rollback();
                    conn.Close();
                    conn.Dispose();
                    this.IApp_Ref_Id = 0;
                    this.IVersion_No = 0;
                    ltrScript.Text   = JSHelper.GetAlertScript("결재대상 KPI상태를 확인하세요!", true);
                    return;
                }
                if (dsKPI.Tables[0].Select("APP_STATUS NOT IN('NFT', 'MFT', 'AFT', 'RFT')").Length > 0)
                {
                    trx.Rollback();
                    conn.Close();
                    conn.Dispose();
                    this.IApp_Ref_Id = 0;
                    this.IVersion_No = 0;
                    ltrScript.Text   = JSHelper.GetAlertScript("결재대상 KPI상태를 확인하세요!", true);
                    return;
                }
            }
            else
            {
                trx.Rollback();
                conn.Close();
                conn.Dispose();
                this.IApp_Ref_Id = 0;
                this.IVersion_No = 0;
                ltrScript.Text   = JSHelper.GetAlertScript("결재대상 KPI상태를 확인하세요!", true);
                return;
            }

            foreach (string strKpiRefId in KPI_REF_ID.Split(','))
            {
                blnRtn = false;
                try
                {
                    NameValueCollection nvc = new NameValueCollection();
                    nvc.Add("ESTTERM_REF_ID", strTermid);
                    nvc.Add("KPI_REF_ID", strKpiRefId);
                    nvc.Add("YMD", ymd);
                    string strTitle = "";
                    if (this.IBiz_Type == Biz_Type.biz_type_kpi_docbatch)
                    {
                        blnRtn = objApp.GetOriDocTitle(Biz_Type.biz_type_kpi_doc, nvc, out strTitle);
                    }
                    else if (this.IBiz_Type == Biz_Type.biz_type_kpi_rstbatch)
                    {
                        blnRtn = objApp.GetOriDocTitle(Biz_Type.biz_type_kpi_rst, nvc, out strTitle);
                    }
                    else if (this.IBiz_Type == Biz_Type.biz_type_target_resultbatch)
                    {
                        blnRtn = objApp.GetOriDocTitle(Biz_Type.biz_type_target_result, nvc, out strTitle);
                    }
                    if (blnRtn)
                    {
                        txtTitle.Text = strTitle;
                    }
                    else
                    {
                        trx.Rollback();
                        conn.Close();
                        conn.Dispose();
                        this.IApp_Ref_Id = 0;
                        this.IVersion_No = 0;
                        ltrScript.Text   = JSHelper.GetAlertScript("결재처리 중 결재원문을 알수 없습니다.", true);
                        return;
                    }

                    string queryURL = string.Empty;

                    string strFullPath = "";
                    string strPath     = "";
                    string strParam    = string.Empty;

                    if (this.IBiz_Type == Biz_Type.biz_type_kpi_docbatch)
                    {
                        strParam = "ESTTERM_REF_ID=" + strTermid + "&KPI_REF_ID=" + strKpiRefId + "&BIZ_TYPE=" + Biz_Type.biz_type_kpi_doc + "&APP_REF_ID=0&DRAFT_EMP_ID=" + gUserInfo.Emp_Ref_ID.ToString();
                        strPath  = Biz_Com_Approval_Info.GetDraftPagePath(Biz_Type.biz_type_kpi_doc);
                    }
                    else if (this.IBiz_Type == Biz_Type.biz_type_kpi_rstbatch)
                    {
                        strParam = "ESTTERM_REF_ID=" + strTermid + "&KPI_REF_ID=" + strKpiRefId + "&YMD=" + ymd + "&BIZ_TYPE=" + Biz_Type.biz_type_kpi_rst + "&APP_REF_ID=0&DRAFT_EMP_ID=" + gUserInfo.Emp_Ref_ID.ToString();
                        strPath  = Biz_Com_Approval_Info.GetDraftPagePath(Biz_Type.biz_type_kpi_rst);
                    }
                    else if (this.IBiz_Type == Biz_Type.biz_type_target_resultbatch)
                    {
                        strParam = "ESTTERM_REF_ID=" + strTermid + "&KPI_REF_ID=" + strKpiRefId + "&YMD=" + ymd + "&BIZ_TYPE=" + Biz_Type.biz_type_target_result + "&APP_REF_ID=0&DRAFT_EMP_ID=" + gUserInfo.Emp_Ref_ID.ToString();
                        strPath  = Biz_Com_Approval_Info.GetDraftPagePath(Biz_Type.biz_type_kpi_rst);
                    }


                    string strVPath = Request.ApplicationPath;
                    string strSHost = Request.Url.Host;
                    string strSPort = Request.Url.Port.ToString();
                    string strProto = Request.Url.Scheme;

                    strVPath = (strVPath == "/") ? "" : strVPath;

                    strFullPath = strProto + "://" + strSHost + ":" + strSPort + strVPath + strPath + "?" + strParam;

                    string strHtml = Server.HtmlDecode(Biz_Com_Approval_Info.GetHtmlSource(strFullPath));
                    string strPos  = "{^0^}";
                    int    iSPos   = strHtml.IndexOf(strPos) + strPos.Length;
                    int    iEPos   = strHtml.LastIndexOf(strPos);

                    divArea_M.InnerHtml = strHtml.Substring(iSPos, iEPos - iSPos);

                    NameValueCollection nvc2 = new NameValueCollection();
                    nvc2.Add("ESTTERM_REF_ID", strTermid);
                    nvc2.Add("KPI_REF_ID", strKpiRefId);
                    if (this.IBiz_Type == Biz_Type.biz_type_kpi_docbatch)
                    {
                        nvc2.Add("BIZ_TYPE", Biz_Type.biz_type_kpi_doc);
                    }
                    else if (this.IBiz_Type == Biz_Type.biz_type_kpi_rstbatch)
                    {
                        nvc2.Add("BIZ_TYPE", Biz_Type.biz_type_kpi_rst);
                        nvc2.Add("YMD", ymd);
                    }
                    else if (this.IBiz_Type == Biz_Type.biz_type_target_resultbatch)
                    {
                        nvc2.Add("BIZ_TYPE", Biz_Type.biz_type_target_result);
                        nvc2.Add("YMD", ymd);
                    }
                    nvc2.Add("APP_REF_ID", "0");
                    nvc2.Add("DRAFT_EMP_ID", gUserInfo.Emp_Ref_ID.ToString());

                    if (this.IBiz_Type == Biz_Type.biz_type_kpi_docbatch)
                    {
                        blnRtn = objApp.TxrDraftBatch(conn, trx, Server.HtmlEncode(divArea_M.InnerHtml)
                                                      , txtTitle.Text
                                                      , Biz_Type.biz_type_kpi_doc
                                                      , sAppStatus
                                                      , Biz_Type.app_draft_first
                                                      , ""
                                                      , gUserInfo.Emp_Ref_ID
                                                      , this.GetAPPLine(), nvc2);
                    }
                    else if (this.IBiz_Type == Biz_Type.biz_type_kpi_rstbatch)
                    {
                        blnRtn = objApp.TxrDraftBatch(conn, trx, Server.HtmlEncode(divArea_M.InnerHtml)
                                                      , txtTitle.Text
                                                      , Biz_Type.biz_type_kpi_rst
                                                      , sAppStatus
                                                      , Biz_Type.app_draft_first
                                                      , ""
                                                      , gUserInfo.Emp_Ref_ID
                                                      , this.GetAPPLine(), nvc2);
                    }
                    else if (this.IBiz_Type == Biz_Type.biz_type_target_resultbatch)
                    {
                        blnRtn = objApp.TxrDraftBatch(conn, trx, Server.HtmlEncode(divArea_M.InnerHtml)
                                                      , txtTitle.Text
                                                      , Biz_Type.biz_type_target_result
                                                      , sAppStatus
                                                      , Biz_Type.app_draft_first
                                                      , ""
                                                      , gUserInfo.Emp_Ref_ID
                                                      , this.GetAPPLine(), nvc2);
                    }



                    if (!blnRtn)
                    {
                        trx.Rollback();
                        conn.Close();
                        conn.Dispose();
                        this.IApp_Ref_Id = 0;
                        this.IVersion_No = 0;
                        ltrScript.Text   = JSHelper.GetAlertScript("결재 일괄처리 중 오류가 발생하였습니다.");
                        ltrScript.Text   = JSHelper.GetAlertOpenerControlCallBackScript(objApp.Transaction_Message, this.IAPP_CCB, true);
                        return;
                    }

                    this.IApp_Ref_Id = objApp.IApp_Ref_Id;
                    this.IVersion_No = objApp.IVersion_No;
                    if (this.IHISTORY_YN == "Y")
                    {
                        DoInsertUpdateReason();
                    }
                }
                catch
                {
                    trx.Rollback();
                    conn.Close();
                    conn.Dispose();
                    this.IApp_Ref_Id = 0;
                    this.IVersion_No = 0;
                    ltrScript.Text   = JSHelper.GetAlertScript("결재 일괄처리 중 오류가 발생하였습니다.");
                    ltrScript.Text   = JSHelper.GetAlertOpenerControlCallBackScript(objApp.Transaction_Message, this.IAPP_CCB, true);
                    return;
                }
            }

            trx.Commit();
            conn.Close();
            conn.Dispose();

            try
            {
                bool bRtn = this.SendMailBatch(false);
            }
            catch
            {
            }

            ltrScript.Text = JSHelper.GetAlertOpenerControlCallBackScript(objApp.Transaction_Message, this.IAPP_CCB, true);
        }
        else
        {
            ltrScript.Text = JSHelper.GetAlertScript("결재형식이 올바르지 않습니다!");
            return;
        }
    }