Esempio n. 1
0
 private void FillEMailTemplates()
 {
     string emailTemp = Request.Form["selEmailTemplate"]??"";
     StringBuilder opts = new StringBuilder();
     opts.Append("<option value=\"\"></option>");
     BestEMailTemplate bem = new BestEMailTemplate();
     bem.LoadRows();
     for (int row = 0; row < bem.TableRows.Count; row++)
     {
         bem.currentRowId = row;
         opts.Append("<option value=\"" + HttpUtility.HtmlEncode(bem.emialTemplateName) + "\"");
         if (bem.emialTemplateName.Equals(emailTemp))
         {
             opts.Append(" selected=\"selected\" ");
         }
         opts.Append(">" + HttpUtility.HtmlEncode(bem.emialTemplateName) + "</option>");
     }
     ltrEMailTempOpts.Text = opts.ToString();
 }
Esempio n. 2
0
 private string getEMailBody()
 {
     string result = "";
     string emailTemp = Request.Form["selEmailTemplate"];
     string emailDesc = Request.Form["emailDesc"];
     if (!string.IsNullOrEmpty(emailTemp))
     {
         BestField bsf = new BestField() { fieldName = "emailtemp", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 50 };
         bsf.fieldValue = emailTemp;
         List<BestField> bparam = new List<BestField>();
         bparam.Add(bsf);
         BestEMailTemplate bet = new BestEMailTemplate();
         bet.LoadRows("emialTemplateName = ?", bparam);
         if (bet.HasRows)
         {
             result = bet.TableRows[0].Fields["templateDescription"].fieldValue;
         }
     }
     else if (!string.IsNullOrEmpty(emailDesc))
     {
         result = emailDesc;
     }
     return result;
 }
Esempio n. 3
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentUser"] == null)
            {
                Response.Redirect("Logout.aspx");
            }
            ltrSubMenu.Text = UtilMenu.SetupSubMenu("emailtemplate");
            if (!Utils.User.UserRoleByName("Setup - EMail Template").allowView)
            {
                ltrGrid.Text = "You do not have rights to view.";
                return;
            }

            string ms = Request.QueryString["ms"];
            this.ltrMScript.Text = Utils.MenuSelectScript(ms);

            if (IsPostBack)
            {
                BestEMailTemplate bs = new BestEMailTemplate();
                string isnew = Request.Form["isnew"];
                bool cansave = true;
                if (string.IsNullOrEmpty(isnew))
                {
                    List<BestField> bparams = new List<BestField>();
                    BestField guid = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false };
                    guid.fieldValue = Request.Form["guidfield"];
                    bparams.Add(guid);

                    if (!string.IsNullOrEmpty(guid.fieldValue))
                    {
                        bs.LoadRows("guidfield=?", bparams);
                    }
                    else
                    {
                        string delguid = Request.Form["deleteguid"];
                        if (!string.IsNullOrEmpty(delguid))
                        {
                            bparams[0].fieldValue = delguid;
                            bs.LoadRows("guidfield=?", bparams);
                            bs.CurrentRow.IsDelete = true;
                            bs.CurrentRow.Save();
                        }
                        cansave = false;
                    }
                }

                if (cansave)
                {
                    if (!string.IsNullOrEmpty(isnew)) { bs.emialTemplateName = Request.Form["g_emialTemplateName"]; }
                    if (string.IsNullOrEmpty(bs.emialTemplateName))
                    {
                        ltrValidateMsg.Text = Utils.WarningMessage("EMial Template Name is Required.");
                        cansave = false;
                    }
                    if (cansave)
                    {
                        bs.templateDescription = Request.Form["g_templateDescription"];
                        if (!bs.CurrentRow.Save())
                        {
                            ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError);
                        }
                    }
                }
            }

            BestGrid bsGrid = new BestGrid();
            bsGrid.PageRequest = Page.Request;
            bsGrid.Title = "EMail Templates Information";
            bsGrid.GridTable = new BestEMailTemplate();
            bsGrid.securityPage = "Setup - EMail Template";
            ltrGrid.Text = bsGrid.ToHTML();
        }