Example #1
0
 public void Insert(ApprovalEntity entity)
 {
     Parameters = new List<SqlParameter>();
        Parameters.Add(new SqlParameter("@ApprovalID", entity.ApprovalID));
        Parameters.Add(new SqlParameter("@AgreementTypeID", entity.AgreementTypeID));
        Parameters.Add(new SqlParameter("@Actions", entity.Actions));
        Parameters.Add(new SqlParameter("@Comments", entity.Comments));
        Parameters.Add(new SqlParameter("@Status", entity.Status));
        Parameters.Add(new SqlParameter("@Action", "EA"));
        ExecCommand(DBCommands.Approval);
 }
Example #2
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 #3
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";
        }
Example #4
0
        public ApprovalEntity Read(int id, int approvalID)
        {
            Parameters = new List<SqlParameter>();

               Parameters.Add(new SqlParameter("@AgreementTypeID", id));
               Parameters.Add(new SqlParameter("@ApprovalID", approvalID));
               ApprovalEntity entity = null;
               SqlDataReader reader = null;
               try
               {
               Parameters.Add(new SqlParameter("@Action", "R"));
               reader = ExecDataReader(DBCommands.Approval);
               if (reader.Read())
               {
                   entity = new ApprovalEntity();
                   entity.Status = reader["Status"].ToStr();
                   entity.Actions = reader["Actions"].ToStr();
                   entity.Comments = reader["Comments"].ToStr();
                   if (reader.NextResult())
                   {
                       if (reader.Read())
                       {
                           entity.Title = reader["Title"].ToStr();
                       }
                   }
               }
               }
               finally
               {
               if (reader != null)
               {
                   reader.Close();
                   reader.Dispose();
               }
               }

               return entity;
        }
Example #5
0
 public void Insert(ApprovalEntity entity)
 {
     ApprovalDao approvalDao = new ApprovalDao();
     approvalDao.Insert(entity);
 }