示例#1
0
 /// <summary>
 /// Fatching row details into Textboxes on Edit button click.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals(CommonConstants.EditRow))
     {
         int         index = Convert.ToInt32(e.CommandArgument);
         GridViewRow row   = grdView1.Rows[index];
         Session[CommonConstants.SelectedRowIndex] = row.RowIndex;
         txtPolicyNo.Text    = row.Cells[0].Text;
         txtPolicyNo.Enabled = CommonConstants.False;
         txtUserName.Text    = row.Cells[2].Text;
         txtRequestDate.Text = row.Cells[3].Text;
         txtMailId.Text      = row.Cells[4].Text;
         TextBox tbox = (TextBox)row.FindControl("GrdTxtBusinessReason");
         txtBusinessReason.Text  = tbox.Text.ToString();
         txtRootSegCount.Text    = row.Cells[6].Text;
         txtMachineSegCount.Text = row.Cells[7].Text;
         txtFaceSegCount.Text    = row.Cells[8].Text;
     }
     if (e.CommandName.Equals(CommonConstants.DeleteRow))
     {
         int status;
         int index = Convert.ToInt32(e.CommandArgument);
         PolicyDetailsBusinessEntity   policyDetails  = new PolicyDetailsBusinessEntity();
         MilePostBuzLogic              milePostBuzObj = new MilePostBuzLogic();
         UserInfoDetailsBusinessEntity userInfo       = (UserInfoDetailsBusinessEntity)Session[CommonConstants.UserInfo];
         try
         {
             GridViewRow row = grdView1.Rows[index];
             policyDetails.PolicyNo = row.Cells[0].Text;
             policyDetails.UserId   = userInfo.UserId;
             status = milePostBuzObj.DeletePolicyDetails(policyDetails);
             if (status == CommonConstants.StatusOne)
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), CommonConstants.ShowAlert, CommonConstants.SuccessDeleted, true);
                 LoadGrid();
             }
         }
         catch (Exception ex)
         {
             HandleLogging.AddtoLogFile(ex.Message, CommonConstants.PolicyEntry);
             Response.Redirect(CommonConstants.Error);
         }
         finally
         {
             if (!txtPolicyNo.Enabled)
             {
                 txtPolicyNo.Enabled = CommonConstants.True;
             }
             txtPolicyNo.Text        = string.Empty;
             txtRequestDate.Text     = string.Empty;
             txtRootSegCount.Text    = string.Empty;
             txtBusinessReason.Text  = string.Empty;
             txtMachineSegCount.Text = string.Empty;
             txtFaceSegCount.Text    = string.Empty;
         }
     }
 }
示例#2
0
        /// <summary>
        /// Invokes the GetPolicyDetails method of the MilePostProvider class to retrive the policy details.
        /// </summary>
        /// <param name="userInfoDetails"></param>
        /// <returns></returns>
        public DataSet GetPolicyDetails(UserInfoDetailsBusinessEntity userInfoDetails)
        {
            DataSet ds = new DataSet();

            try
            {
                MilePostProvider provider = new MilePostProvider();
                ds = provider.GetPolicyDetails(userInfoDetails);
            }
            catch (DataException ex)
            {
                throw ex;
            }
            return(ds);
        }
示例#3
0
        /// <summary>
        /// Invokes the CheckUserCredential method of the MilePostProvider class to check the credentails authentication
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public UserInfoDetailsBusinessEntity CheckUserAuth(UserInfoDetailsBusinessEntity userInfo)
        {
            UserInfoDetailsBusinessEntity userInfoBe = new UserInfoDetailsBusinessEntity();
            MilePostProvider provider = new MilePostProvider();

            try
            {
                userInfo = provider.CheckUserAuth(userInfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(userInfo);
        }
示例#4
0
        /// <summary>
        /// Invokes SendApproveRejectMail method of the MilePostProvider class to send trigger mail on policy approval and policy reject to Business Team
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public bool SendApproveRejectMail(PolicyDetailsBusinessEntity policyDetails, UserInfoDetailsBusinessEntity userInfoDetails, string mailType)
        {
            bool status = false;

            try
            {
                MilePostProvider provider = new MilePostProvider();
                status = provider.SendApproveRejectMail(policyDetails, userInfoDetails, mailType);
            }
            catch (DataException ex)
            {
                throw ex;
            }
            return(status);
        }
示例#5
0
        /// <summary>
        /// CheckUserAuth method is userful to check the authorization of the user.
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public UserInfoDetailsBusinessEntity CheckUserAuth(UserInfoDetailsBusinessEntity userInfo)
        {
            userInfo.Status = CommonConstants.StatusZero;
            try
            {
                conn = new SqlConnection(connStr);
                conn.Open();
                SqlCommand cmd = new SqlCommand(sqlQry.GetUserInfoQuery(userInfo.UserName, userInfo.Password), conn);
                cmd.CommandType = CommandType.Text;
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        userInfo.UserId = (int)reader[CommonConstants.UserId];
                        userInfo.RoleId = (int)reader[CommonConstants.RoleId];
                        //userInfo.PhoneNumber = Convert.ToString(reader[CommonConstants.PhoneNo]);
                        userInfo.EmailId = Convert.ToString(reader[CommonConstants.EmailId]);
                        userInfo.Status  = CommonConstants.StatusOne;
                    }
                }
                reader.Close();
                // Retrieve the user Role details from T_ROLE_MASTER table
                SqlCommand cmdRole = new SqlCommand(sqlQry.GetUserRoleQuery(userInfo.RoleId), conn);
                cmdRole.CommandType = CommandType.Text;

                reader = cmdRole.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        userInfo.Role = reader[CommonConstants.Role1].ToString();
                    }
                }
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }

            return(userInfo);
        }
示例#6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            UserInfoDetailsBusinessEntity userInfo = new UserInfoDetailsBusinessEntity();
            MilePostBuzLogic milepostBuz           = new MilePostBuzLogic();

            userInfo.UserName = txtUsername.Text;
            userInfo.Password = txtPassword.Text;

            userInfo = milepostBuz.CheckUserAuth(userInfo);

            Session["UserInfo"] = userInfo;
            Session["UserName"] = userInfo.UserName;
            Session["Role"]     = userInfo.Role;

            if (userInfo.Status == 1)
            {
                Response.Redirect("Home.aspx");
            }
        }
示例#7
0
        /// <summary>
        /// This method is usefult to Load the grid.
        /// </summary>
        protected void LoadGrid()
        {
            DataSet ds = null;
            PolicyDetailsBusinessEntity   policyDetails = new PolicyDetailsBusinessEntity();
            UserInfoDetailsBusinessEntity userInfo      = (UserInfoDetailsBusinessEntity)Session[CommonConstants.UserInfo];
            MilePostBuzLogic milePostBuzObj             = new MilePostBuzLogic();

            try
            {
                policyDetails.UserId    = userInfo.UserId;
                policyDetails.PolicyNo  = txtPolicyNo.Text.ToUpper();
                policyDetails.StartDate = txtRequestDate.Text;
                policyDetails.EndDate   = txtEndDate.Text;

                ds = milePostBuzObj.GetPolicyEnquiry(policyDetails);
                if (ds.Tables[0].Rows.Count > CommonConstants.StatusZero)
                {
                    GrdView2.Visible    = CommonConstants.True;
                    GrdView2.DataSource = ds;
                    GrdView2.DataBind();
                }
                else
                {
                    if (GrdView2.Visible)
                    {
                        GrdView2.Visible = CommonConstants.False;
                    }
                    lblNoRecords.Visible = CommonConstants.True;
                }
            }
            catch (Exception ex)
            {
                HandleLogging.AddtoLogFile(ex.ToString(), CommonConstants.PolicyEnquiry);
                Response.Redirect(CommonConstants.Error);
            }
            finally
            {
                ds.Dispose();
            }
        }
示例#8
0
        /// <summary>
        /// GetPolicyDetails method is useful to retrieve the policy details from the T_Policy_Details tabel.
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public DataSet GetPolicyDetails(UserInfoDetailsBusinessEntity infoDetails)
        {
            DataSet ds = new DataSet();

            try
            {
                conn = new SqlConnection(connStr);
                conn.Open();
                SqlCommand cmd = new SqlCommand(sqlQry.GetPolicyDetailsQuery(infoDetails.UserId), conn);
                cmd.ExecuteNonQuery();
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(ds);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
            return(ds);
        }
示例#9
0
        /// <summary>
        /// This method is usefult to Load the grid.
        /// </summary>
        protected void LoadGrid()
        {
            DataSet ds = null;
            UserInfoDetailsBusinessEntity userInfo = (UserInfoDetailsBusinessEntity)Session["UserInfo"];
            MilePostBuzLogic milePostBuzObj        = new MilePostBuzLogic();

            try
            {
                ds = milePostBuzObj.GetPolicyDetails(userInfo);
                Cache[CommonConstants.PolicyUnapproved] = ds;
                if (ds.Tables[0].Rows.Count > CommonConstants.StatusZero)
                {
                    grdView1.Visible    = CommonConstants.True;
                    grdView1.DataSource = ds;
                    grdView1.DataBind();
                    txtUserName.Text     = userInfo.UserName;
                    txtMailId.Text       = userInfo.EmailId;
                    lblNoRecords.Visible = CommonConstants.False;
                }
                else
                {
                    txtUserName.Text     = userInfo.UserName;
                    txtMailId.Text       = userInfo.EmailId;
                    grdView1.Visible     = CommonConstants.False;
                    lblNoRecords.Visible = CommonConstants.True;
                }
            }
            catch (Exception ex)
            {
                HandleLogging.AddtoLogFile(ex.ToString(), CommonConstants.PolicyEntry);
                Response.Redirect(CommonConstants.Error);
            }
            finally
            {
                //ds.Dispose();
            }
        }
示例#10
0
 public string UpdatePolicyRejectQuery(PolicyDetailsBusinessEntity policyDetails, UserInfoDetailsBusinessEntity userInfoDetails)
 {
     try
     {
         queryString = "UPDATE " + CommonConstants.tblPolicyDetails + " SET APPROVER_ID_ACCTNG =  " + userInfoDetails.UserId + " WHERE POLICY_NUMBER   = " + CommonConstants.invertedComma + policyDetails.PolicyNo + CommonConstants.invertedComma;
         return(queryString);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         queryString = string.Empty;
     }
 }
示例#11
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ArrayList rowIndex         = null;
            ArrayList rowIndexRejected = null;
            int       status;
            //bool sendMailStatus = false;
            bool sendMailStatus = true;

            SaveCheckedValues();
            UserInfoDetailsBusinessEntity userInfo      = null;
            PolicyDetailsBusinessEntity   policyDetails = null;
            MilePostBuzLogic milePostBuzObj             = new MilePostBuzLogic();
            DataSet          ds = milePostBuzObj.GetAllPolicyNumber();

            try
            {
                if (Session[CommonConstants.CheckedItems] != null || Session[CommonConstants.CheckedRejected] != null)
                {
                    rowIndex         = (ArrayList)Session[CommonConstants.CheckedItems];
                    rowIndexRejected = (ArrayList)Session[CommonConstants.CheckedRejected];
                    if (Session[CommonConstants.UserInfo] != null)
                    {
                        userInfo = (UserInfoDetailsBusinessEntity)Session[CommonConstants.UserInfo];
                    }
                    if (rowIndex != null)
                    {
                        if (rowIndex.Count > 1)
                        {
                            if (rowIndexRejected != null)
                            {
                                if (rowIndexRejected.Count > 1)
                                {
                                    lblNotSelected.Visible = CommonConstants.True;
                                    lblNotSelected.Text    = CommonConstants.MsgSelectAppRej;
                                }
                            }
                            else
                            {
                                lblNotSelected.Visible = CommonConstants.True;
                                lblNotSelected.Text    = CommonConstants.MsgSelectApprove;
                            }
                        }
                        else
                        {
                            if (rowIndexRejected != null)
                            {
                                if (rowIndexRejected.Count > 1 || rowIndexRejected.Count == 1)
                                {
                                    lblNotSelected.Visible = CommonConstants.True;
                                    lblNotSelected.Text    = CommonConstants.MsgSelectAppRej;
                                }
                            }
                            else
                            {
                                policyDetails            = new PolicyDetailsBusinessEntity();
                                policyDetails.UserId     = userInfo.UserId;
                                policyDetails.ApprovalId = userInfo.UserId;
                                policyDetails.PolicyNo   = rowIndex[0].ToString();

                                status = milePostBuzObj.UpdateApprovalDetails(policyDetails);
                                if (status == CommonConstants.StatusOne)
                                {
                                    LoadGrid();
                                    ScriptManager.RegisterStartupScript(this, GetType(), CommonConstants.ShowAlert, CommonConstants.SuccessApprove, true);

                                    if (ds.Tables[0].Rows.Count > CommonConstants.StatusZero)
                                    {
                                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                        {
                                            policyDetails = new PolicyDetailsBusinessEntity();
                                            if (rowIndex[0].ToString() == Convert.ToString(ds.Tables[0].Rows[i][0]))
                                            {
                                                policyDetails.PolicyNo       = Convert.ToString(ds.Tables[0].Rows[i][0]);
                                                policyDetails.BusinessReason = Convert.ToString(ds.Tables[0].Rows[i][1]);
                                                policyDetails.MailId         = Convert.ToString(ds.Tables[0].Rows[i][6]);
                                                break;
                                            }
                                        }
                                    }
                                    //sendMailStatus = milePostBuzObj.SendApproveRejectMail(policyDetails, userInfo, CommonConstants.ApproveInd);
                                    if (sendMailStatus)
                                    {
                                        LoadGrid();
                                        if (lblNotSelected.Visible)
                                        {
                                            lblNotSelected.Visible = CommonConstants.False;
                                        }
                                    }
                                }
                                if (lblNotSelected.Visible)
                                {
                                    lblNotSelected.Visible = CommonConstants.False;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (rowIndexRejected != null)
                        {
                            if (rowIndexRejected.Count > 1)
                            {
                                lblNotSelected.Visible = CommonConstants.True;
                                lblNotSelected.Text    = CommonConstants.MsgSelectReject;
                            }
                            else
                            {
                                if (txtReasonReject.Text == string.Empty)
                                {
                                    lblNotSelected.Visible = CommonConstants.True;
                                    lblNotSelected.Text    = CommonConstants.MsgProvideReason;
                                }
                                else
                                {
                                    if (ds.Tables[0].Rows.Count > CommonConstants.StatusZero)
                                    {
                                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                        {
                                            policyDetails = new PolicyDetailsBusinessEntity();
                                            if (rowIndexRejected[0].ToString() == Convert.ToString(ds.Tables[0].Rows[i][0]))
                                            {
                                                policyDetails.PolicyNo       = rowIndexRejected[0].ToString();
                                                policyDetails.BusinessReason = Convert.ToString(ds.Tables[0].Rows[i][1]);
                                                policyDetails.MailId         = Convert.ToString(ds.Tables[0].Rows[i][6]);
                                                policyDetails.RejectedReason = txtReasonReject.Text;
                                                break;
                                            }
                                        }
                                    }
                                    //sendMailStatus = milePostBuzObj.SendApproveRejectMail(policyDetails, userInfo, CommonConstants.RejectInd);
                                    if (sendMailStatus)
                                    {
                                        LoadGrid();
                                        ScriptManager.RegisterStartupScript(this, GetType(), CommonConstants.ShowAlert, CommonConstants.SucccessReject, true);
                                        txtReasonReject.Text = string.Empty;
                                        if (lblNotSelected.Visible)
                                        {
                                            lblNotSelected.Visible = CommonConstants.False;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    lblNotSelected.Visible = CommonConstants.True;
                    lblNotSelected.Text    = CommonConstants.MsgSelectAppRej;
                }
            }
            catch (Exception ex)
            {
                HandleLogging.AddtoLogFile(ex.ToString(), CommonConstants.AccountApproval);
                Response.Redirect(CommonConstants.Error);
            }
            finally
            {
                Session.Remove(CommonConstants.CheckedItems);
                Session.Remove(CommonConstants.CheckedRejected);
            }
        }
示例#12
0
        /// <summary>
        /// Invokes SendApproveRejectMail method of the MilePostProvider class to send trigger mail on policy approval or policy reject to Account Team.
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public bool SendApproveRejectMail(PolicyDetailsBusinessEntity policyDetails, UserInfoDetailsBusinessEntity userInfoDetails, string mailType)
        {
            bool status = true;

            char[]        sepArray  = new char[] { ',', ';' };
            StringBuilder emailBody = null;

            string      errorMessage     = string.Empty;
            string      policyNo         = policyDetails.PolicyNo;
            string      phoneNo          = userInfoDetails.PhoneNumber;
            string      date             = DateTime.Today.ToString(CommonConstants.DateFormat);
            int         pmrRecordCnt     = policyDetails.RootSegmentCount;
            int         machineRecordCnt = policyDetails.MachineSegmentCount;
            int         faceRecordCnt    = policyDetails.FaceSegmentCount;
            string      businessReason   = policyDetails.BusinessReason;
            string      rejectedReason   = policyDetails.RejectedReason;
            MailMessage mailMessage      = null;
            string      emailAddress     = string.Empty;

            try
            {
                conn      = new SqlConnection(connStr);
                emailBody = new StringBuilder();
                //New code
                conn.Open();
                SqlCommand cmd = new SqlCommand(sqlQry.UpdatePolicyRejectQuery(policyDetails, userInfoDetails), conn);
                cmd.CommandType = CommandType.Text;
                cmd.ExecuteNonQuery();
                //status = CommonConstants.StatusOne;
                /////////////////

                //Mail Message
                mailMessage = new MailMessage();

                mailMessage.From = new MailAddress(fromEmailAddress);
                mailMessage.To.Add(new MailAddress(policyDetails.MailId));
                mailMessage.CC.Add(new MailAddress(userInfoDetails.EmailId));

                emailBody.Append(@"<html><body><div><img src=cid:myImageID> </div>");
                emailBody.AppendLine(CommonConstants.StartNewLine);
                emailBody.Append("<div style=\"font-family:Verdana;font-size:10px;\">");
                emailBody.AppendLine("<div style=\"text-align:right;\"><b>Date: </b>" + date + "</div>");

                if (mailType == CommonConstants.MailType_Approval)
                {
                    mailMessage.Subject = CommonConstants.MailSubjectApproval + policyNo;
                    emailBody.AppendLine("<hr />");
                    emailBody.AppendLine(CommonConstants.MailBodyApproval_Initial);
                    emailBody.Append(CommonConstants.Div_PolicyNumber + policyNo + CommonConstants.DIV);
                    emailBody.Append(CommonConstants.Div_BusinessReason + businessReason + CommonConstants.DIV);
                }
                else
                {
                    mailMessage.Subject = CommonConstants.MailSubjectRejection + policyNo;
                    emailBody.AppendLine("<div style=\"text-align:right;\"><b>Phone No:</b> " + phoneNo + "</div>");
                    emailBody.AppendLine("<hr />");
                    emailBody.AppendLine(CommonConstants.MailBodyRejection_Initial);
                    emailBody.Append(CommonConstants.Div_PolicyNumber + policyNo + CommonConstants.DIV);
                    emailBody.Append(CommonConstants.Div_BusinessReason + businessReason + CommonConstants.DIV);
                    emailBody.Append(CommonConstants.Div_RejectedReason + rejectedReason + CommonConstants.DIV);
                }
                emailBody.Append(CommonConstants.EndNewLine);
                emailBody.Append(CommonConstants.DIV);
                emailBody.Append(CommonConstants.BODY);
                emailBody.Append(CommonConstants.HTML);

                mailMessage.Body       = emailBody.ToString();
                mailMessage.IsBodyHtml = true;

                //create Alrternative HTML view
                AlternateView htmlView = AlternateView.CreateAlternateViewFromString(mailMessage.Body, null, CommonConstants.MailType);
                //Add Image
                LinkedResource theEmailImage = new LinkedResource(logo1);
                theEmailImage.ContentId = CommonConstants.ImageId;

                //Add the Image to the Alternate view
                htmlView.LinkedResources.Add(theEmailImage);

                //Add view to the Email Message
                mailMessage.AlternateViews.Add(htmlView);
                SmtpClient smtpClient = new SmtpClient(smtpServer);
                smtpClient.Port = 25;
                smtpClient.Send(mailMessage);
            }
            catch (System.Net.Mail.SmtpException exception)
            {
                errorMessage = exception.Message;
                status       = false;
            }
            finally
            {
                if (mailMessage != null)
                {
                    mailMessage.Dispose();
                    mailMessage = null;
                }
                sepArray = null;
            }
            return(status);
        }
示例#13
0
        /// <summary>
        /// Adding new policy detials into database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            PolicyDetailsBusinessEntity   policyDetails  = new PolicyDetailsBusinessEntity();
            MilePostBuzLogic              milePostBuzObj = new MilePostBuzLogic();
            UserInfoDetailsBusinessEntity userInfo       = (UserInfoDetailsBusinessEntity)Session[CommonConstants.UserInfo];
            int     addStatus         = CommonConstants.StatusZero;
            bool    exist             = false;
            int     status            = 0;
            bool    sendMailStatus    = false;
            DataSet dsPolicyUnapprove = (DataSet)Cache[CommonConstants.PolicyUnapproved];
            DataSet dsAllPolicyNo     = milePostBuzObj.GetAllPolicyNumber();

            try
            {
                policyDetails.PolicyNo            = txtPolicyNo.Text.Trim();
                policyDetails.UserId              = userInfo.UserId;
                policyDetails.UserName            = userInfo.UserName;
                policyDetails.RequestDate         = txtRequestDate.Text.Trim();
                policyDetails.PhoneNumber         = userInfo.PhoneNumber.Trim();
                policyDetails.BusinessReason      = txtBusinessReason.Text.Trim();
                policyDetails.RootSegmentCount    = Int16.Parse(txtRootSegCount.Text.Trim());
                policyDetails.FaceSegmentCount    = Int16.Parse(txtFaceSegCount.Text.Trim());
                policyDetails.MachineSegmentCount = Int16.Parse(txtMachineSegCount.Text.Trim());

                if (Session[CommonConstants.SelectedRowIndex] != null)
                {
                    status = milePostBuzObj.UpdatePolicyDetails(policyDetails);

                    if (status == CommonConstants.StatusOne)
                    {
                        Session.Remove(CommonConstants.SelectedRowIndex);
                        exist = true;
                        ScriptManager.RegisterStartupScript(this, GetType(), CommonConstants.ShowAlert, CommonConstants.SuccessUpdate, true);
                        txtPolicyNo.Enabled     = CommonConstants.True;
                        txtPolicyNo.Text        = string.Empty;
                        txtRequestDate.Text     = string.Empty;
                        txtRootSegCount.Text    = string.Empty;
                        txtBusinessReason.Text  = string.Empty;
                        txtMachineSegCount.Text = string.Empty;
                        txtFaceSegCount.Text    = string.Empty;
                    }
                    LoadGrid();
                }
                else
                {
                    for (int i = 0; i < dsPolicyUnapprove.Tables[0].Rows.Count; i++)
                    {
                        if (txtPolicyNo.Text.ToUpper() == Convert.ToString(dsPolicyUnapprove.Tables[0].Rows[i][2]))
                        {
                            status = milePostBuzObj.UpdatePolicyDetails(policyDetails);
                            if (status == CommonConstants.StatusOne)
                            {
                                LoadGrid();
                                exist = true;
                                ScriptManager.RegisterStartupScript(this, GetType(), CommonConstants.ShowAlert, CommonConstants.SuccessUpdate, true);
                                txtPolicyNo.Text        = string.Empty;
                                txtRequestDate.Text     = string.Empty;
                                txtRootSegCount.Text    = string.Empty;
                                txtBusinessReason.Text  = string.Empty;
                                txtMachineSegCount.Text = string.Empty;
                                txtFaceSegCount.Text    = string.Empty;
                            }
                            break;
                        }
                    }

                    if (dsAllPolicyNo.Tables[0].Rows.Count > CommonConstants.StatusOne)
                    {
                        for (int i = 0; i < dsAllPolicyNo.Tables[0].Rows.Count; i++)
                        {
                            if (txtPolicyNo.Text.ToUpper() == Convert.ToString(dsAllPolicyNo.Tables[0].Rows[i][0]))
                            {
                                if (Convert.ToChar(dsAllPolicyNo.Tables[0].Rows[i][7]) == CommonConstants.ApproveIndN || Convert.ToChar(dsAllPolicyNo.Tables[0].Rows[i][7]) == CommonConstants.ApproveIndn)
                                {
                                    ScriptManager.RegisterStartupScript(this, GetType(), CommonConstants.ShowAlert, CommonConstants.AddFailure, true);
                                    exist = true;
                                    break;
                                }
                                else
                                {
                                    if (Convert.ToChar(dsAllPolicyNo.Tables[0].Rows[i][7]) == CommonConstants.ApproveIndY || Convert.ToChar(dsAllPolicyNo.Tables[0].Rows[i][7]) == CommonConstants.ApproveIndy)
                                    {
                                        ScriptManager.RegisterStartupScript(this, GetType(), CommonConstants.ShowAlert, CommonConstants.AlreadyApproved, true);
                                        if (lblNoRecords.Visible)
                                        {
                                            lblNoRecords.Visible = CommonConstants.False;
                                        }
                                        exist = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (!exist)
                    {
                        addStatus = milePostBuzObj.AddPolicyDetails(policyDetails);
                        if (addStatus == CommonConstants.StatusOne)
                        {
                            policyDetails.MailId = userInfo.EmailId;
                            // sendMailStatus = milePostBuzObj.SendEmail(policyDetails);
                            if (sendMailStatus)
                            {
                                LoadGrid();
                                //ScriptManager.RegisterStartupScript(this, GetType(), CommonConstants.ShowAlert, CommonConstants.MailSuccess, true);
                            }
                            ScriptManager.RegisterStartupScript(this, GetType(), CommonConstants.ShowAlert, CommonConstants.SuccessAdded, true);
                            txtPolicyNo.Text        = string.Empty;
                            txtRequestDate.Text     = string.Empty;
                            txtRootSegCount.Text    = string.Empty;
                            txtBusinessReason.Text  = string.Empty;
                            txtMachineSegCount.Text = string.Empty;
                            txtFaceSegCount.Text    = string.Empty;
                        }
                        LoadGrid();
                    }
                }
            }
            catch (Exception ex)
            {
                HandleLogging.AddtoLogFile(ex.ToString(), CommonConstants.PolicyEntry);
                Response.Redirect(CommonConstants.Error);
            }
            finally
            {
                Session.Remove(CommonConstants.SelectedRowIndex);
            }
        }