示例#1
0
        /// <summary>
        /// Retrieves list of EmailTemplate objects from SqlCommand, after database query
        /// number of rows retrieved and returned depends upon the rows field value
        /// </summary>
        /// <param name="cmd">The command object to use for query</param>
        /// <param name="rows">Number of rows to process</param>
        /// <returns>A list of EmailTemplate objects</returns>
        private EmailTemplateList GetList(SqlCommand cmd, long rows)
        {
            // Select multiple records
            SqlDataReader reader;
            long          result = SelectRecords(cmd, out reader);

            //EmailTemplate list
            EmailTemplateList list = new EmailTemplateList();

            using ( reader )
            {
                // Read rows until end of result or number of rows specified is reached
                while (reader.Read() && rows-- != 0)
                {
                    EmailTemplate emailTemplateObject = new EmailTemplate();
                    FillObject(emailTemplateObject, reader);

                    list.Add(emailTemplateObject);
                }

                // Close the reader in order to receive output parameters
                // Output parameters are not available until reader is closed.
                reader.Close();
            }

            return(list);
        }
示例#2
0
    public void PopulateTemplatePanel(Button pressedButton)
    {
        lblTempError.Text = string.Empty;
        lblError.Text     = string.Empty;

        IptechLib.Forms.RemoveHighlightControls(phSelectTemplate);

        List <EmailTemplate> defaultEmailTempalteList = EmailTemplateList.GetEmailTemplateList(Guid.Empty).Where(m => m.TemplateId != new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultTemplateId")[0].Value) &&
                                                                                                                 m.IsActive && !m.IsInvitation).ToList();

        if (defaultEmailTempalteList.Count == 0)
        {
            lblError.Text = "No Email Template found.<br/>";
        }

        phSelectTemplate.Visible = (defaultEmailTempalteList.Count != 0);

        if (defaultEmailTempalteList.Count != 0)
        {
            ddlTemplateList.DataSource     = defaultEmailTempalteList;
            ddlTemplateList.DataTextField  = "Title";
            ddlTemplateList.DataValueField = "Id";
            ddlTemplateList.DataBind();

            ddlTemplateList.Items.Insert(0, new ListItem("Please Select", Guid.Empty.ToString()));

            hlkPreview.Visible = !ddlTemplateList.SelectedValue.Equals(Guid.Empty.ToString());

            lblTitle.Text = pressedButton.Text;
        }
    }
示例#3
0
    private void BindGrid(bool needRebind)
    {
        EmailTemplateList emailTemplateList = EmailTemplateList.GetEmailTemplateList();

        radGridJury.DataSource = emailTemplateList.Where(m => m.TemplateId != new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultTemplateId")[0].Value) && !m.IsDelete).OrderByDescending(m => m.DateCreated).ToList();

        if (needRebind)
        {
            radGridJury.Rebind();
        }
    }
示例#4
0
    public void LoadForm()
    {
        EmailTemplateList defaultEmailTempalteList = EmailTemplateList.GetEmailTemplateList(new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultTemplateId")[0].Value));

        ddlTemplateList.DataSource     = defaultEmailTempalteList;
        ddlTemplateList.DataTextField  = "Title";
        ddlTemplateList.DataValueField = "Id";
        ddlTemplateList.DataBind();

        ddlTemplateList.Items.Insert(0, new ListItem("Please Select", Guid.Empty.ToString()));
    }
示例#5
0
        /// <summary>
        /// Retrieves all EmailTemplate objects by PageRequest
        /// </summary>
        /// <returns>A list of EmailTemplate objects</returns>
        public EmailTemplateList GetPaged(PagedRequest request)
        {
            using (SqlCommand cmd = GetSPCommand(GETPAGEDEMAILTEMPLATE))
            {
                AddParameter(cmd, pInt32Out("TotalRows"));
                AddParameter(cmd, pInt32("PageIndex", request.PageIndex));
                AddParameter(cmd, pInt32("RowPerPage", request.RowPerPage));
                AddParameter(cmd, pNVarChar("WhereClause", 4000, request.WhereClause));
                AddParameter(cmd, pNVarChar("SortColumn", 128, request.SortColumn));
                AddParameter(cmd, pNVarChar("SortOrder", 4, request.SortOrder));

                EmailTemplateList _EmailTemplateList = GetList(cmd, ALL_AVAILABLE_RECORDS);
                request.TotalRows = Convert.ToInt32(GetOutParameter(cmd, "TotalRows"));
                return(_EmailTemplateList);
            }
        }
示例#6
0
    public void PopulateTemplatePanel(Button pressedButton)
    {
        lblTempError.Text = string.Empty;
        lblError.Text     = string.Empty;

        IptechLib.Forms.RemoveHighlightControls(phSelectTemplate);

        ddlRounds.Items.Clear();
        ddlRounds.Items.Add(new ListItem("Round 1", RoundsType.Round1));
        ddlRounds.Items.Add(new ListItem("Round 2", RoundsType.Round2));
        ddlRounds.Items.Add(new ListItem("Round 1 & 2", RoundsType.BothRounds));

        if (!pressedButton.CommandName.Equals("add"))
        {
            ddlRounds.Items.Add(new ListItem("N/A", RoundsType.NotApplicable));
        }

        ddlRounds.Items.Insert(0, new ListItem("Please Select", string.Empty.ToString()));

        List <EmailTemplate> defaultEmailTempalteList = EmailTemplateList.GetEmailTemplateList(Guid.Empty)
                                                        .Where(x => x.EmailType == EmailType.Entry.ToString() && x.IsActive && !x.IsDelete).ToList();

        if (defaultEmailTempalteList.Count == 0)
        {
            lblError.Text = "No Email Template found.<br/>";
        }

        roundRow.Visible    = pressedButton.CommandName.Equals("add");
        templateRow.Visible = !pressedButton.CommandName.Equals("add");

        phSelectTemplate.Visible = (defaultEmailTempalteList.Count != 0);

        if (defaultEmailTempalteList.Count != 0)
        {
            ddlTemplateList.DataSource     = defaultEmailTempalteList;
            ddlTemplateList.DataTextField  = "Title";
            ddlTemplateList.DataValueField = "Id";
            ddlTemplateList.DataBind();

            ddlTemplateList.Items.Insert(0, new ListItem("Please Select", Guid.Empty.ToString()));

            hlkPreview.Visible = !ddlTemplateList.SelectedValue.Equals(Guid.Empty.ToString());

            lblTitle.Text = pressedButton.Text;
        }
    }
示例#7
0
        /// <summary>
        /// To fetch details from database
        /// </summary>
        /// <returns></returns>
        public EmailTemplateList GetAllOverdueApprovals()
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_NOTIF_OVERDUE_APPROVAL";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();

            OracleDataReader  dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            EmailTemplateBO   EmailTemplateBOobj   = null;
            EmailTemplateList EmailTemplateListobj = new EmailTemplateList();

            while (dr.Read())
            {
                EmailTemplateBOobj = new EmailTemplateBO();

                if (!dr.IsDBNull(dr.GetOrdinal("DESCRIPTION")))
                {
                    EmailTemplateBOobj.Description = (dr.GetString(dr.GetOrdinal("DESCRIPTION")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("WORKFLOWCODE")))
                {
                    EmailTemplateBOobj.Workflowcode = (dr.GetString(dr.GetOrdinal("WORKFLOWCODE")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("EMAILID")))
                {
                    EmailTemplateBOobj.EmailID = (dr.GetString(dr.GetOrdinal("EMAILID")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("cellnumber")))
                {
                    EmailTemplateBOobj.Cellnumber = (dr.GetString(dr.GetOrdinal("cellnumber")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("triggertype")))
                {
                    EmailTemplateBOobj.Triggertype = (dr.GetString(dr.GetOrdinal("triggertype")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("DISPLAYNAME")))
                {
                    EmailTemplateBOobj.ApproverUserName = (dr.GetString(dr.GetOrdinal("DISPLAYNAME")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("PROJECTCODE")))
                {
                    EmailTemplateBOobj.ProjectCode = (dr.GetString(dr.GetOrdinal("PROJECTCODE")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("PROJECTNAME")))
                {
                    EmailTemplateBOobj.ProjectName = (dr.GetString(dr.GetOrdinal("PROJECTNAME")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("REQUESTDATE")))
                {
                    EmailTemplateBOobj.Requestdate = Convert.ToString(dr.GetValue(dr.GetOrdinal("REQUESTDATE")));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("DUEDATE")))
                {
                    EmailTemplateBOobj.Duedate = Convert.ToString(dr.GetValue(dr.GetOrdinal("DUEDATE")));
                }

                EmailTemplateListobj.Add(EmailTemplateBOobj);
            }
            dr.Close();
            return(EmailTemplateListobj);
        }
 public async Task<EmailTemplateList.response> EmailTemplateList(EmailTemplateList.request request, CancellationToken? token = null)
 {
     return await SendAsync<EmailTemplateList.response>(request.ToXmlString(), token.GetValueOrDefault(CancellationToken.None));
 }
示例#9
0
文件: Program.cs 项目: abigabaw/wis
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());
            EmailTemplateBLL  EmailTemplateBLLobj  = new EmailTemplateBLL();
            EmailTemplateList EmailTemplateListObj = EmailTemplateBLLobj.GetAllOverdueApprovals();
            int a = 0;

            if (EmailTemplateBLLobj != null)
            {
                for (int i = 0; i < EmailTemplateListObj.Count; i++)
                {
                    try
                    {
                        string     fileLoc = ConfigurationManager.AppSettings["ERROS_PATH"].ToString();
                        FileStream fs      = null;
                        if (!File.Exists(fileLoc))
                        {
                            using (fs = File.Create(fileLoc))
                            {
                            }
                        }
                        MailMessage mailMessage = new MailMessage();
                        SmtpClient  smtp        = new SmtpClient();
                        if (EmailTemplateListObj[i].Triggertype.ToUpper() == "SMS" || EmailTemplateListObj[i].Triggertype.ToUpper() == "BOTH")
                        {
                            EmailTemplateBO EmailTemplateBOobj = EmailTemplateBLLobj.GetSMSDetailsForOverDue(EmailTemplateListObj[i].Workflowcode);
                            if (EmailTemplateBOobj != null)
                            {
                                WIS_ConfigBO  WIS_ConfigBO = EmailTemplateBLLobj.GetSMSSenderDataForOverDue();
                                ReddyInfoSoft ris          = new ReddyInfoSoft();
                                ris.sendSMS(WIS_ConfigBO.MobileNumber, WIS_ConfigBO.MobilePassword, EmailTemplateBOobj.Smstext, EmailTemplateListObj[i].Cellnumber, WIS_ConfigBO.SiteUrl, "1");
                            }
                            else
                            {
                                // for get errors
                                using (StreamWriter sw = new StreamWriter(fileLoc, true))
                                {
                                    if (a == 0)
                                    {
                                        sw.WriteLine("[" + DateTime.Now.ToString() + "]" + Environment.NewLine);
                                        a++;
                                    }
                                    sw.WriteLine(i + 1 + ") " + EmailTemplateListObj[i].Workflowcode.ToString() + " Does not contain SMS Text." + Environment.NewLine);
                                    //sw.WriteLine(Environment.NewLine + "-------------------------------------------------------" + Environment.NewLine);
                                }
                                //end
                            }
                        }
                        if (EmailTemplateListObj[i].Triggertype.ToUpper() != "SMS")
                        {
                            string mailBody = "";

                            mailMessage.To.Add(EmailTemplateListObj[i].EmailID);
                            mailMessage.From = new MailAddress(ConfigurationManager.AppSettings["MAIL_FROM"].ToString());
                            EmailTemplateBO EmailTemplateBOobj = EmailTemplateBLLobj.GetEmailDetailsForOverDue(EmailTemplateListObj[i].Workflowcode);
                            if (EmailTemplateBOobj != null)
                            {
                                mailMessage.Subject = EmailTemplateBOobj.EmailSubject;
                                mailMessage.Body    = "Dear Sir, <br/><br/> " + EmailTemplateBOobj.EmailBody + " <br/><br/> ProjectCode : " + EmailTemplateListObj[i].ProjectCode
                                                      + "<br/> ProjectName : " + EmailTemplateListObj[i].ProjectName + "<br/>" +
                                                      "<br/> Requested Date : " + EmailTemplateListObj[i].Requestdate + "<br/>" +
                                                      "<br/> Due Date : " + EmailTemplateListObj[i].Duedate + "<br/><br/>" +
                                                      "Thanks and Regards, <br/> WIS - UETCL Team";
                                mailMessage.IsBodyHtml = true;

                                smtp.Send(mailMessage);
                            }
                            else
                            {
                                // for get errors
                                using (StreamWriter sw = new StreamWriter(fileLoc, true))
                                {
                                    if (a == 0)
                                    {
                                        sw.WriteLine("[" + DateTime.Now.ToString() + "]" + Environment.NewLine);
                                        a++;
                                    }
                                    sw.WriteLine(i + 1 + ") " + EmailTemplateListObj[i].Workflowcode.ToString() + " Does not contain Subject and Body." + Environment.NewLine);
                                    //sw.WriteLine(Environment.NewLine + "-------------------------------------------------------" + Environment.NewLine);
                                }
                                //end
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        // for get errors
                        string     fileLoc = ConfigurationManager.AppSettings["ERROS_PATH"].ToString();
                        FileStream fs      = null;
                        if (!File.Exists(fileLoc))
                        {
                            using (fs = File.Create(fileLoc))
                            {
                            }
                        }
                        using (StreamWriter sw = new StreamWriter(fileLoc, true))
                        {
                            if (a == 0)
                            {
                                sw.WriteLine("[" + DateTime.Now.ToString() + "]" + Environment.NewLine);
                                a++;
                            }
                            sw.WriteLine(i + 1 + ") " + EmailTemplateListObj[i].Workflowcode.ToString() + "-" + ex.ToString());
                            //sw.WriteLine(Environment.NewLine + "-------------------------------------------------------" + Environment.NewLine);
                        }
                        //end
                    }
                }
            }
        }