Exemple #1
0
    public void SendMailBatch(bool isReturn)
    {
        if (PageUtility.GetAppConfig("Mail.UseDraftMailYN") == "N")
        {
            return;
        }

        string sC_EMP_MAIL = "";
        string sP_EMP_MAIL = "";
        string sN_EMP_MAIL = "";
        string sFile       = "Mail_Draft.htm";

        EmpInfos             objEmp = new EmpInfos(gUserInfo.Emp_Ref_ID);
        Biz_Com_Approval_Prc objPrc = new Biz_Com_Approval_Prc();

        for (int i = 0; i < ugrdDraft.Rows.Count; i++)
        {
            int    appid, verno;
            string biztype = string.Empty;
            if (ugrdDraft.Rows[i].Cells.FromKey("BIZ_TYPE").Value.ToString() == Biz_Type.biz_type_kpi_docbatch)
            {
                biztype = Biz_Type.biz_type_kpi_doc;
            }
            else if (ugrdDraft.Rows[i].Cells.FromKey("BIZ_TYPE").Value.ToString() == Biz_Type.biz_type_kpi_rstbatch)
            {
                biztype = Biz_Type.biz_type_kpi_rst;
            }
            else if (ugrdDraft.Rows[i].Cells.FromKey("BIZ_TYPE").Value.ToString() == Biz_Type.biz_type_target_resultbatch)
            {
                biztype = Biz_Type.biz_type_target_result;
            }
            appid = DataTypeUtility.GetToInt32(ugrdDraft.Rows[i].Cells.FromKey("APP_REF_ID").Value);
            verno = DataTypeUtility.GetToInt32(ugrdDraft.Rows[i].Cells.FromKey("VERSION_NO").Value);
            bool bRtn = objPrc.GetSendMailUser(appid, verno, gUserInfo.Emp_Ref_ID, out sC_EMP_MAIL, out sP_EMP_MAIL, out sN_EMP_MAIL);
            if (!bRtn)
            {
                return;
            }

            if (isReturn && (!PageUtility.CheckMailAddress(sC_EMP_MAIL) || !PageUtility.CheckMailAddress(sN_EMP_MAIL)))
            {
                return;
            }

            if (!isReturn && (!PageUtility.CheckMailAddress(sC_EMP_MAIL) || !PageUtility.CheckMailAddress(sP_EMP_MAIL)))
            {
                return;
            }

            bool      rtnValue    = false;
            DataTable dtMailParam = new DataTable("PARAM");
            dtMailParam.Columns.Add("KEY", typeof(string));
            dtMailParam.Columns.Add("VAL", typeof(string));

            Biz_Com_Approval_Info objMst = new Biz_Com_Approval_Info(appid, verno);

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

            string strFullPath = strProto + "://" + strSHost + ":" + strSPort + strVPath;

            DataRow dr = null;
            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[SITE_URL]";
            dr["VAL"] = strFullPath;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[BIZ_TYPE]";
            dr["VAL"] = Biz_Com_Approval_Info.GetBizTypeName(biztype);
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[APP_CODE]";
            dr["VAL"] = objMst.IApp_Code;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[TITLE]";
            dr["VAL"] = objMst.ITitle;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[EMP_NAME]";
            dr["VAL"] = objEmp.Emp_Name;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[DEPT_NAME]";
            dr["VAL"] = objEmp.Dept_Name;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[TRX_DATE]";
            dr["VAL"] = objMst.IUpdate_Date.ToShortDateString();
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[TODAY]";
            dr["VAL"] = DateTime.Now.ToString();
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[DRAFT_TYPE]";
            dr["VAL"] = (isReturn) ? "반려" : "승인요청";
            dtMailParam.Rows.Add(dr);

            string sMailTitle = "[성과관리 - " + Biz_Com_Approval_Info.GetBizTypeName(biztype) + " 건 알림메일]";

            bool ismail = PageUtility.SendMail(dtMailParam, sC_EMP_MAIL, (isReturn) ? sN_EMP_MAIL : sP_EMP_MAIL, sMailTitle, sFile);
        }
    }
Exemple #2
0
    protected void ibtnMail_Click(object sender, ImageClickEventArgs e)
    {
        bool     rtnMail     = false;
        string   sC_EMP_MAIL = "";
        string   sN_EMP_MAIL = "";
        string   sFile       = "";
        string   sMailTitle  = "";
        EmpInfos objEmp;

        if (this.hdfEstID.Value == null)
        {
            ltrScript.Text = JSHelper.GetAlertScript("평가유형을 선택하세요!");
            return;
        }
        if (this.hdfEstID.Value.ToString() == "")
        {
            ltrScript.Text = JSHelper.GetAlertScript("평가유형을 선택하세요!");
            return;
        }

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

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

        string strFullPath = strProto + "://" + strSHost + ":" + strSPort + strVPath;

        DataTable dtMailParam = new DataTable("PARAM");

        dtMailParam.Columns.Add("KEY", typeof(string));
        dtMailParam.Columns.Add("VAL", typeof(string));

        DataRow dr = null;

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[::MAIL_DOMAIN::]";
        dr["VAL"] = strFullPath;
        dtMailParam.Rows.Add(dr);

        switch (hdfEstID.Value.ToString())
        {
        case "3GA":
            sFile      = "mailtemp_보고서작성.htm";
            sMailTitle = "[성과관리 - " + "MBO평가 종합보고서 작성요청 건 알림메일]";
            dr         = dtMailParam.NewRow();
            dr["KEY"]  = "[::APP_GUBUN::]";
            dr["VAL"]  = "MBO";
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[::TO_DAY::]";
            dr["VAL"] = DateTime.Now.ToString();
            dtMailParam.Rows.Add(dr);

            break;

        default:
            ltrScript.Text = JSHelper.GetAlertScript("평가유형을 선택하세요!");
            return;

            break;
        }

        Biz_Datas bizData = new Biz_Datas();
        DataSet   dsData  = bizData.GetEstData(COMP_ID, hdfEstID.Value.ToString(), ESTTERM_REF_ID, ESTTERM_SUB_ID, 0, 0, 0, 0, 0);

        if (dsData.Tables[0].Rows.Count == 0)
        {
            ltrScript.Text = JSHelper.GetAlertScript("메일을 발송할 평가대상자가 없습니다!");
            return;
        }
        DataTable dtDistinct = dsData.Tables[0].DefaultView.ToTable(true, "TGT_EMP_ID");

        sC_EMP_MAIL = PageUtility.GetAppConfig("Mail.From");

        int totalReceiver = dtDistinct.Rows.Count;
        int sendReceiver  = 0;

        foreach (DataRow drReceiver in dtDistinct.Rows)
        {
            objEmp      = new EmpInfos(DataTypeUtility.GetToInt32(drReceiver["TGT_EMP_ID"]));
            sN_EMP_MAIL = objEmp.Emp_Email;

            if (!PageUtility.CheckMailAddress(sC_EMP_MAIL) || !PageUtility.CheckMailAddress(sN_EMP_MAIL))
            {
                return;
            }

            rtnMail = PageUtility.SendMail(dtMailParam, sC_EMP_MAIL, sN_EMP_MAIL, sMailTitle, sFile);
            if (rtnMail)
            {
                sendReceiver++;
            }
        }

        ltrScript.Text = JSHelper.GetAlertScript("대상자 " + totalReceiver.ToString() + "명 중 " + sendReceiver.ToString() + "명에게 안내메일을 발송하였습니다.");
    }
Exemple #3
0
    public bool SendMail(bool isReturn)
    {
        if (PageUtility.GetAppConfig("Mail.UseDraftMailYN") == "N")
        {
            return(true);
        }

        string sC_EMP_MAIL = "";
        string sP_EMP_MAIL = "";
        string sN_EMP_MAIL = "";
        string sFile       = "Mail_Draft.htm";

        EmpInfos             objEmp = new EmpInfos(this.IDraftEmpID);
        Biz_Com_Approval_Prc objPrc = new Biz_Com_Approval_Prc();
        bool bRtn = objPrc.GetSendMailUser(this.IApp_Ref_Id, this.IVersion_No, this.IDraftEmpID, out sC_EMP_MAIL, out sP_EMP_MAIL, out sN_EMP_MAIL);

        if (!bRtn)
        {
            return(false);
        }

        if (isReturn && (!PageUtility.CheckMailAddress(sC_EMP_MAIL) || !PageUtility.CheckMailAddress(sN_EMP_MAIL)))
        {
            return(false);
        }

        if (!isReturn && (!PageUtility.CheckMailAddress(sC_EMP_MAIL) || !PageUtility.CheckMailAddress(sP_EMP_MAIL)))
        {
            return(false);
        }

        DataTable dtMailParam = new DataTable("PARAM");

        dtMailParam.Columns.Add("KEY", typeof(string));
        dtMailParam.Columns.Add("VAL", typeof(string));

        Biz_Com_Approval_Info objMst = new Biz_Com_Approval_Info(this.IApp_Ref_Id, this.IVersion_No);

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

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

        string strFullPath = strProto + "://" + strSHost + ":" + strSPort + strVPath;

        DataRow dr = null;

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[SITE_URL]";
        dr["VAL"] = strFullPath;
        dtMailParam.Rows.Add(dr);

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[BIZ_TYPE]";
        dr["VAL"] = Biz_Com_Approval_Info.GetBizTypeName(this.IBiz_Type);
        dtMailParam.Rows.Add(dr);

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[APP_CODE]";
        dr["VAL"] = objMst.IApp_Code;
        dtMailParam.Rows.Add(dr);

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[TITLE]";
        dr["VAL"] = objMst.ITitle;
        dtMailParam.Rows.Add(dr);

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[EMP_NAME]";
        dr["VAL"] = objEmp.Emp_Name;
        dtMailParam.Rows.Add(dr);

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[DEPT_NAME]";
        dr["VAL"] = objEmp.Dept_Name;
        dtMailParam.Rows.Add(dr);

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[TRX_DATE]";
        dr["VAL"] = objMst.IUpdate_Date.ToShortDateString();
        dtMailParam.Rows.Add(dr);

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[TODAY]";
        dr["VAL"] = DateTime.Now.ToString();
        dtMailParam.Rows.Add(dr);

        dr        = dtMailParam.NewRow();
        dr["KEY"] = "[DRAFT_TYPE]";
        dr["VAL"] = (isReturn) ? "반려" : "승인요청";
        dtMailParam.Rows.Add(dr);

        string sMailTitle = "[성과관리 - " + Biz_Com_Approval_Info.GetBizTypeName(this.IBiz_Type) + " 건 알림메일]";

        return(PageUtility.SendMail(dtMailParam, sC_EMP_MAIL, (isReturn) ? sN_EMP_MAIL : sP_EMP_MAIL, sMailTitle, sFile));
    }
Exemple #4
0
    public bool SendMailBatch(bool isReturn)
    {
        if (PageUtility.GetAppConfig("Mail.UseDraftMailYN") == "N")
        {
            return(true);
        }

        string sC_EMP_MAIL = "";
        string sP_EMP_MAIL = "";
        string sN_EMP_MAIL = "";
        string sFile       = "Mail_Draft.htm";

        EmpInfos             objEmp = new EmpInfos(gUserInfo.Emp_Ref_ID);
        Biz_Com_Approval_Prc objPrc = new Biz_Com_Approval_Prc();
        bool bRtn = objPrc.GetSendMailUser(this.IApp_Ref_Id, this.IVersion_No, gUserInfo.Emp_Ref_ID, out sC_EMP_MAIL, out sP_EMP_MAIL, out sN_EMP_MAIL);

        if (!bRtn)
        {
            return(false);
        }

        if (isReturn && (!PageUtility.CheckMailAddress(sC_EMP_MAIL) || !PageUtility.CheckMailAddress(sN_EMP_MAIL)))
        {
            return(false);
        }

        if (!isReturn && (!PageUtility.CheckMailAddress(sC_EMP_MAIL) || !PageUtility.CheckMailAddress(sP_EMP_MAIL)))
        {
            return(false);
        }

        DataTable dtMailParam = new DataTable("PARAM");

        dtMailParam.Columns.Add("KEY", typeof(string));
        dtMailParam.Columns.Add("VAL", typeof(string));


        MicroBSC.BSC.Biz.Biz_Bsc_Kpi_Info objKPI = new MicroBSC.BSC.Biz.Biz_Bsc_Kpi_Info();
        DataTable dtKpi = new DataTable();

        if (this.IBiz_Type == Biz_Type.biz_type_kpi_docbatch)
        {
            dtKpi = objKPI.GetKpiListForBatchDraft(GetRequestByInt("ESTTERM_REF_ID"), "", "", "Y", gUserInfo.Emp_Ref_ID, GetRequest("KPI_REF_ID", "")).Tables[0];
        }
        else if (this.IBiz_Type == Biz_Type.biz_type_kpi_rstbatch)
        {
            dtKpi = objKPI.GetKpiResultListForBatchDraft(GetRequestByInt("ESTTERM_REF_ID"), GetRequest("YMD"), "", "", "Y", gUserInfo.Emp_Ref_ID, GetRequest("KPI_REF_ID")).Tables[0];
        }
        else if (this.IBiz_Type == Biz_Type.biz_type_target_resultbatch)
        {
            dtKpi = objKPI.GetKpiResultListForBatchDraft(GetRequestByInt("ESTTERM_REF_ID"), GetRequest("YMD"), "", "", "N", gUserInfo.Emp_Ref_ID, GetRequest("KPI_REF_ID")).Tables[0];
        }
        bool rtnValue = false;

        foreach (DataRow drKpi in dtKpi.Rows)
        {
            Biz_Com_Approval_Info objMst = new Biz_Com_Approval_Info(DataTypeUtility.GetToDecimal(drKpi["APP_REF_ID"]), 1);

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

            string strFullPath = strProto + "://" + strSHost + ":" + strSPort + strVPath;

            DataRow dr = null;
            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[SITE_URL]";
            dr["VAL"] = strFullPath;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[BIZ_TYPE]";
            dr["VAL"] = Biz_Com_Approval_Info.GetBizTypeName(Biz_Type.biz_type_kpi_doc);
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[APP_CODE]";
            dr["VAL"] = objMst.IApp_Code;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[TITLE]";
            dr["VAL"] = objMst.ITitle;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[EMP_NAME]";
            dr["VAL"] = objEmp.Emp_Name;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[DEPT_NAME]";
            dr["VAL"] = objEmp.Dept_Name;
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[TRX_DATE]";
            dr["VAL"] = objMst.IUpdate_Date.ToShortDateString();
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[TODAY]";
            dr["VAL"] = DateTime.Now.ToString();
            dtMailParam.Rows.Add(dr);

            dr        = dtMailParam.NewRow();
            dr["KEY"] = "[DRAFT_TYPE]";
            dr["VAL"] = (isReturn) ? "반려" : "승인요청";
            dtMailParam.Rows.Add(dr);

            string sMailTitle = "";
            if (this.IBiz_Type == Biz_Type.biz_type_kpi_docbatch)
            {
                sMailTitle = "[성과관리 - " + Biz_Com_Approval_Info.GetBizTypeName(Biz_Type.biz_type_kpi_doc) + " 건 알림메일]";
            }
            else if (this.IBiz_Type == Biz_Type.biz_type_kpi_rstbatch)
            {
                sMailTitle = "[성과관리 - " + Biz_Com_Approval_Info.GetBizTypeName(Biz_Type.biz_type_kpi_rst) + " 건 알림메일]";
            }
            else if (this.IBiz_Type == Biz_Type.biz_type_target_resultbatch)
            {
                sMailTitle = "[성과관리 - " + Biz_Com_Approval_Info.GetBizTypeName(Biz_Type.biz_type_target_result) + " 건 알림메일]";
            }

            rtnValue = PageUtility.SendMail(dtMailParam, sC_EMP_MAIL, (isReturn) ? sN_EMP_MAIL : sP_EMP_MAIL, sMailTitle, sFile);
        }
        return(rtnValue);
    }