/// <summary> /// BuildBodyEmail /// </summary> /// <param name="DelegationEmailTemplateObject"></param> /// <param name="delegationBodyEmailTemplate"></param> /// <returns></returns> private string BuildBodyEmail(DelegationEmailTemplate DelegationEmailTemplateObject, string delegationBodyEmailTemplate) { var body = string.Empty; try { BasicEvaluationContext basicEvaluationContext = new BasicEvaluationContext(); basicEvaluationContext.Objects["DelegationEmailTemplate"] = DelegationEmailTemplateObject; body = basicEvaluationContext.Eval <string>(delegationBodyEmailTemplate); } catch (Exception ex) { ULSLogging.LogError(ex); } return(body); }
private void btnCalc_Click(object sender, EventArgs e) { BasicEvaluationContext be=new BasicEvaluationContext(); foreach (Variable var in variableBindingSource ) { ParsingReader pr=new ParsingReader(var.Value); be.SetVariable(var.Name, (object)pr.ReadNumber() ?? var.Value); } try { tbResult.Text = Dump.ToDump(be.Eval(tbExpression.Text)); } catch (Exception ex) { tbResult.Text = ex.ToString(); } }
private void btnCalc_Click(object sender, EventArgs e) { BasicEvaluationContext be = new BasicEvaluationContext(); foreach (Variable var in variableBindingSource) { ParsingReader pr = new ParsingReader(var.Value); be.SetVariable(var.Name, (object)pr.ReadNumber() ?? var.Value); } try { tbResult.Text = Dump.ToDump(be.Eval(tbExpression.Text)); } catch (Exception ex) { tbResult.Text = ex.ToString(); } }
//private void RequestApprovalManagement_OnBeforeBuildSubjectEmail(object sender, EventArgs e) //{ //} private void RequestApprovalManagement_OnBeforeBuildBodyEmail(object sender, EventArgs e) { //throw new NotImplementedException(); BasicEvaluationContext basicEvaluationContext = sender as BasicEvaluationContext; if (basicEvaluationContext != null) { SPFieldLookupValue requestTypeRefLookupValue = ObjectHelper.GetSPFieldLookupValue(this.CurrentItem[StringConstant.RequestsList.RequestTypeRefField]); if (requestTypeRefLookupValue != null) { basicEvaluationContext.Objects[StringConstant.RequestsList.RequestTypeRefField] = requestTypeRefLookupValue.LookupValue; } string status = ObjectHelper.GetString(this.CurrentItem[ApprovalFields.Status]); if (string.Compare(status, Status.Completed, true) == 0) { string approverEmailEN = string.Format("Your <strong>Request</strong> has been <strong>approved</strong> by: {0}.</p>", this.CurrentEmployee.FullName); string approverEmailVN = string.Format("<strong>Phiếu đề nghị</strong>của bạn được <strong>duyệt</strong> bởi: {0}.</p>", this.CurrentEmployee.FullName); basicEvaluationContext.Objects[ApproverEmailInfoEN_Key] = approverEmailEN; basicEvaluationContext.Objects[ApproverEmailInfoVN_Key] = approverEmailVN; } } }