Example #1
0
        protected void btnReject_Click(object sender, EventArgs e)
        {
            ApprovalEntity entity = new ApprovalEntity();

            entity.AgreementTypeID = SessionManager.AgreementTypeID;
            entity.ApprovalID = SessionManager.ApprovalID;
            entity.Comments = txtComment.Text.Trim();
            entity.Actions = txtAction.Text.Trim();
            entity.Status = "R";

            ApprovalBI approver = new ApprovalBI();
            approver.Insert(entity);

            /*#TODO:Get user's email id based on the agreement id.*/
            AgreementTypeBI agreementTypeBI = new AgreementTypeBI();
            AgreementTypeEntity agreemententity = agreementTypeBI.ReadTitle(SessionManager.AgreementTypeID);

            string email = agreemententity.Email;
            string agreementTitle = agreemententity.Title;

            string approverName = SessionManager.UsersEntity.FullName;
            string body = null;

            //body =
            using (StreamReader sr = new StreamReader(Server.MapPath("Templates\\EmailTemplete.txt")))
            {
                body = sr.ReadToEnd();
            }

            body = body.Replace("[APPROVER_NAME]", approverName);
            body = body.Replace("[AGREEMENT_TITLE]", agreementTitle);
            body = body.Replace("[APPROVER_NAME]", approverName);
            body = body.Replace("[COMMENTS]", txtComment.Text.Trim());
            body = body.Replace("[ACTIONS]", txtAction.Text.Trim());

            EmailHelper.SendEmail(new List<string>() { email }, agreementTitle + " Agreement Rejected", body, null);

            ClientScript.RegisterStartupScript(Page.GetType(), "_Rejected_", "alert('Agreement Rejected');window.location='home.aspx';", true);
            //ClearData();

            //btnApprove.Visible = false;
            //btnReject.Visible = false;
            //btnCancel.Text = "Go To Home";
        }
Example #2
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            ApprovalEntity entity = new ApprovalEntity();
            int approvalID = Convert.ToInt32(SessionManager.ApprovalID);
            entity.ApprovalID = (approvalID);
            entity.AgreementTypeID = SessionManager.AgreementTypeID;
            entity.Comments = txtComment.Text.Trim();
            entity.Actions = txtAction.Text.Trim();
            entity.Status = "A";

            ApprovalBI approver = new ApprovalBI();
            approver.Insert(entity);

            ClientScript.RegisterStartupScript( Page.GetType(), "_Approved_", "alert('Agreement Approved');window.location='home.aspx';", true);

            //ClearData();

            //btnApprove.Visible = false;
            //btnReject.Visible = false;
            //btnCancel.Text = "Go TO Home";
        }