예제 #1
0
    protected void mail_to_lab(long labid)
    {
        string sub = "GSK: Samples for tests at your lab";
        string from;

        ds_analytics.m_usersRow receiver_row = m_users.getUserByUserid(req_row.responsible)[0];
        if (receiver_row.email != "")
        {
            from = receiver_row.email;
        }
        else
        {
            from = "*****@*****.**";
        }

        WebClient wclient = new WebClient();
        string    url     = HttpContext.Current.Request.Url.AbsoluteUri;

        url = url.Replace("UI/users/reqaction.aspx", "Mailer/reqlab.htm");
        string pagedata = wclient.DownloadString(url);
        string body     = pagedata;

        string[] to  = new string[2];
        string[] cc  = new string[2];
        string[] bcc = new string[2];

        //mail to lab
        ds_analytics.m_labsRow lab_row = m_labs.getLabByLabid(labid)[0];
        if (!lab_row.Isemail1Null() || !lab_row.Isemail2Null())
        {
            if (!lab_row.Isemail1Null() && !lab_row.Isemail2Null())
            {
                //notnull && notnull
                body  = body.Replace("!!~lab_manager~!!", lab_row.contact_person);
                to[0] = lab_row.email1;
                cc[0] = lab_row.email2;
            }
            else if (!lab_row.Isemail1Null() && lab_row.Isemail2Null())
            {
                //notnull && null
                body  = body.Replace("!!~lab_manager~!!", lab_row.contact_person);
                to[0] = lab_row.email1;
            }
            else if (lab_row.Isemail1Null() && !lab_row.Isemail2Null())
            {
                //null && notnull
                body  = body.Replace("!!~lab_manager~!!", lab_row.key_acc_person);
                to[0] = lab_row.email2;
            }
            analyticsmail ana_mail = new analyticsmail();
            ana_mail.sendmails(to, cc, bcc, from, sub, body, "");
        }
    }
예제 #2
0
    private void do_mail(string req_status)
    {
        string sub = "Analytics: Your Request " + req_row.reqid + " has been " + req_status;
        string from;

        ds_analytics.m_usersRow receiver_row = m_users.getUserByUserid(req_row.responsible)[0];
        if (receiver_row.email != "")
        {
            from = receiver_row.email;
        }
        else
        {
            from = "*****@*****.**";
        }

        WebClient wclient = new WebClient();
        string    url     = HttpContext.Current.Request.Url.AbsoluteUri;

        url = url.Replace("UI/users/reqaction.aspx", "Mailer/reqapprove.htm");
        string pagedata = wclient.DownloadString(url);
        string body     = pagedata;

        //mail to requestor
        ds_analytics.m_usersRow requestor_row = m_users.getUserByUserid(req_row.reqfrom)[0];
        if (requestor_row != null && requestor_row.email != "")
        {
            //1. Creating login page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            int    len      = url.IndexOf("UI");
            string base_url = url.Substring(0, len);
            base_url = base_url + "Default.aspx?login="******"&redirect=";
            //2. Creating request page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            len = url.IndexOf("reqaction");
            string       redirect_url = url.Substring(0, len);
            Encryption64 e64          = new Encryption64();
            redirect_url = redirect_url + "reqaction_byme.aspx?reqid=" + e64.Encrypt(req_row.reqid);
            //3. Adding login + redirect link
            string web_link = "<a href='" + base_url + redirect_url + "' target='_blank'>Open Request</a>";
            body = body.Replace("!!~requestor_name~!!", requestor_row.fullname);
            body = body.Replace("!!~req_no~!!", req_row.reqid);
            body = body.Replace("!!~req_decision~!!", req_status);
            body = body.Replace("!!~receiver_name~!!", receiver_row.fullname);
            body = body.Replace("!!~You can open the request at web_link~!!", "You can open the request at " + web_link);

            string[]      to       = { requestor_row.email };
            string[]      cc       = new string[2];
            string[]      bcc      = new string[2];
            analyticsmail ana_mail = new analyticsmail();
            ana_mail.sendmails(to, cc, bcc, from, sub, body, "");
        }
    }
예제 #3
0
    private void do_mail(string mode, string submitted_reqid)
    {
        ds_analytics.requestsDataTable req_dt            = requests.getRequestbyReqid(submitted_reqid);
        ds_analytics.requestsRow       submitted_req_row = req_dt[0];
        ds_analytics.m_usersRow        requestor_row     = m_users.getUserByUserid(submitted_req_row.reqfrom)[0];
        string sub = "";

        if (mode == "edit")
        {
            sub = "Analytics: Request " + submitted_req_row.reqid + " resubmitted by " + requestor_row.fullname;
        }
        else if (mode == "copy")
        {
            sub = "Analytics: New Request " + submitted_req_row.reqid + " raised by " + requestor_row.fullname;
        }

        string from;

        if (requestor_row.email != "")
        {
            from = requestor_row.email;
        }
        else
        {
            from = "*****@*****.**";
        }

        WebClient wclient = new WebClient();
        string    url     = HttpContext.Current.Request.Url.AbsoluteUri;

        url = url.Replace("UI/users/process_request1.aspx", "Mailer/reqsubmit.htm");
        string pagedata = wclient.DownloadString(url);
        string body     = pagedata;

        //mail to receiver
        ds_analytics.m_usersRow rec_row = m_users.getUserByUserid(ddl_lead.SelectedValue)[0];
        if (rec_row != null && rec_row.email != "")
        {
            //1. Creating login page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            int    len      = url.IndexOf("UI");
            string base_url = url.Substring(0, len);
            base_url = base_url + "Default.aspx?login="******"&redirect=";
            //2. Creating request page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            len = url.IndexOf("process_request1");
            string       redirect_url = url.Substring(0, len);
            Encryption64 e64          = new Encryption64();
            redirect_url = redirect_url + "reqaction.aspx?reqid=" + e64.Encrypt(submitted_req_row.reqid);
            //3. Adding login + redirect link
            string web_link = "<a href='" + base_url + redirect_url + "' target='_blank'>Open Request</a>";
            body = body.Replace("!!~receiver_name~!!", rec_row.fullname);
            body = body.Replace("!!~no_samples~!!", no_samples.ToString());
            body = body.Replace("!!~requestor_name~!!", requestor_row.fullname);
            body = body.Replace("!!~You can open the request at web_link~!!", "You can open the request at " + web_link);

            string[]      to       = { rec_row.email };
            string[]      cc       = new string[2];
            string[]      bcc      = new string[2];
            analyticsmail ana_mail = new analyticsmail();
            ana_mail.sendmails(to, cc, bcc, from, sub, body, "");
        }
    }
예제 #4
0
    private void do_mail()
    {
        ds_analytics.m_usersRow req_row = m_users.getUserByUserid(userid)[0];
        string sub = "Analytics: New Request " + reqid + " raised by " + req_row.fullname;
        string from;

        if (req_row.email != "")
        {
            from = req_row.email;
        }
        else
        {
            from = "*****@*****.**";
        }

        WebClient wclient = new WebClient();
        string    url     = HttpContext.Current.Request.Url.AbsoluteUri;

        url = url.Replace("UI/users/request2.aspx", "Mailer/reqsubmit.htm");
        string pagedata = wclient.DownloadString(url);
        string body     = pagedata;

        //mail to receiver
        ds_analytics.m_usersRow rec_row = m_users.getUserByUserid(ddl_lead.SelectedValue)[0];
        if (rec_row != null && rec_row.email != "")
        {
            //1. Creating login page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            int    len      = url.IndexOf("UI");
            string base_url = url.Substring(0, len);
            base_url = base_url + "Default.aspx?login="******"&redirect=";
            //2. Creating request page link
            url = HttpContext.Current.Request.Url.AbsoluteUri;
            len = url.IndexOf("request2");
            string       redirect_url = url.Substring(0, len);
            Encryption64 e64          = new Encryption64();
            redirect_url = redirect_url + "reqaction.aspx?reqid=" + e64.Encrypt(reqid);
            //3. Adding login + redirect link
            string web_link = "<a href='" + base_url + redirect_url + "' target='_blank'>Open Request</a>";
            body = body.Replace("!!~receiver_name~!!", rec_row.fullname);
            body = body.Replace("!!~no_samples~!!", no_samples.ToString());
            body = body.Replace("!!~requestor_name~!!", req_row.fullname);
            body = body.Replace("!!~You can open the request at web_link~!!", "You can open the request at " + web_link);

            string[]      to       = { rec_row.email };
            string[]      cc       = new string[2];
            string[]      bcc      = new string[2];
            analyticsmail ana_mail = new analyticsmail();
            ana_mail.sendmails(to, cc, bcc, from, sub, body, "");
        }

        //mail to Backup-ID
        body = pagedata;
        DataTable dt_bke = other.getDropdownsbyType("backupemail");

        if (dt_bke.Rows.Count > 0)
        {
            DataTable dt_bkn     = other.getDropdownsbyType("backupname");
            string    backupname = "";
            if (dt_bkn.Rows.Count > 0)
            {
                backupname = dt_bkn.Rows[0]["value"].ToString();
            }
            body = body.Replace("!!~receiver_name~!!", backupname);
            body = body.Replace("!!~no_samples~!!", no_samples.ToString());
            body = body.Replace("!!~requestor_name~!!", req_row.fullname);
            body = body.Replace("!!~You can open the request at web_link~!!", "");

            string[]      to       = { dt_bke.Rows[0]["value"].ToString() };
            string[]      cc       = new string[2];
            string[]      bcc      = new string[2];
            analyticsmail ana_mail = new analyticsmail();
            ana_mail.sendmails(to, cc, bcc, from, sub, body, "");
        }
    }