protected void btnSendBack_Click(object sender, EventArgs e)
    {
        if (this.IsTippaniValidate() == false)
        {
            return;
        }

        if (this.TippaniRequestViewer.GrdRequestViewer.SelectedRow.Cells[13].Text == "3" || this.TippaniRequestViewer.GrdRequestViewer.SelectedRow.Cells[13].Text == "4")
        {
            this.lblStatusMessage.Text = "तपाईले Final approve भएको टिप्पणीमा काम गर्न सक्नुहुन्न।";
            this.programmaticModalPopup.Show();
            return;
        }

        ATTGeneralTippaniProcess updateProcess = new ATTGeneralTippaniProcess();

        if (this.hdnForm.Value == "0")
        {
            /* created update process */
            updateProcess        = this.TippaniRequestViewer.GetSelfActorProcess();
            updateProcess.Note   = this.txtNote.Text;
            updateProcess.Status = int.Parse(this.ddlDStatus_Rqd.SelectedValue);
        }
        else if (this.hdnForm.Value == "1")
        {
            updateProcess = null;
        }

        /* created sendback process */
        ATTGeneralTippaniProcess process = this.TippaniRequestViewer.GetSendBackProcess();

        List <ATTGeneralTippaniProcess> lstProcess = new List <ATTGeneralTippaniProcess>();

        lstProcess.Add(process);

        List <ATTGeneralTippaniAttachment> lstAttachment = this.TippaniAttachment.GetAttachment(process.OrgID, process.TippaniID, this.User.UserName);

        foreach (ATTGeneralTippaniAttachment attachment in lstAttachment)
        {
            attachment.TippaniID        = process.TippaniID;
            attachment.TippaniProcessID = process.TippaniProcessID;
        }

        try
        {
            BLLGeneralTippaniProcess.UpdateChannelPersonDecisionAndAddProcess(updateProcess, lstProcess, lstAttachment, this.TippaniRequestViewer.TippaniSubjectType);
            this.ClearME();

            this.lblStatusMessage.Text = "Tippani send back successfully.";
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
    protected void btnSaveAsDraft_Click(object sender, EventArgs e)
    {
        if (this.TippaniRequestViewer.GrdRequestViewer.SelectedIndex < 0)
        {
            this.lblStatusMessage.Text = "क्रिपया टिप्पनी छान्नुहोस।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.TippaniRequestViewer.IsValidForSending == false)
        {
            this.lblStatusMessage.Text = "यो टिप्पणी पहिलेनै पठाइसकेको छ।<br>त्यसैले यो टिप्पणीको लागी लेख Draft गर्न सक्नुहुन्न।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.TippaniRequestViewer.GrdRequestViewer.SelectedRow.Cells[13].Text == "3" || this.TippaniRequestViewer.GrdRequestViewer.SelectedRow.Cells[13].Text == "4")
        {
            this.lblStatusMessage.Text = "तपाईले Final approve भएको टिप्पणीमा काम गर्न सक्नुहुन्न।";
            this.programmaticModalPopup.Show();
            return;
        }

        ATTGeneralTippaniProcess updateProcess = new ATTGeneralTippaniProcess();

        if (this.hdnForm.Value == "0")
        {
            updateProcess        = this.TippaniRequestViewer.GetSelfActorProcess();
            updateProcess.Note   = this.txtNote.Text;
            updateProcess.Status = null;
        }
        else if (this.hdnForm.Value == "1")
        {
            updateProcess = null;

            this.ClearME();
            this.hdnForm.Value         = "1";
            this.lblStatusMessage.Text = "तपाईले पठाउनु भएको टिप्पणीमा तपाईले काम गर्न सक्नुहुन्न।.";
            this.programmaticModalPopup.Show();

            return;
        }

        try
        {
            if (this.hdnForm.Value == "0")
            {
                BLLGeneralTippaniProcess.UpdateChannelPersonDecisionAndAddProcess(updateProcess, null, null, this.TippaniRequestViewer.TippaniSubjectType);
                this.ClearME();

                this.TippaniRequestViewer.LoadTippaniRequest(1);

                this.lblStatusMessage.Text = "Tippani text has been saved as draft.";
                this.programmaticModalPopup.Show();
            }
            else if (this.hdnForm.Value == "1")
            {
                this.ClearME();
                this.hdnForm.Value         = "1";
                this.lblStatusMessage.Text = "तपाईले पठाउनु भएको टिप्पणीमा तपाईले काम गर्न सक्नुहुन्न।.";
                this.programmaticModalPopup.Show();
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        #region Validation

        if (this.IsTippaniValidate() == false)
        {
            return;
        }

        #endregion

        ATTGeneralTippaniProcess updateProcess = new ATTGeneralTippaniProcess();
        if (this.hdnForm.Value == "0")
        {
            updateProcess        = this.TippaniRequestViewer.GetSelfActorProcess();
            updateProcess.Note   = this.txtNote.Text;
            updateProcess.Status = int.Parse(this.ddlDStatus_Rqd.SelectedValue);
        }
        else if (this.hdnForm.Value == "1")
        {
            updateProcess = null;

            this.ClearME();
            this.hdnForm.Value         = "1";
            this.lblStatusMessage.Text = "तपाईले पठाउनु भएको टिप्पणीमा तपाईले काम गर्न सक्नुहुन्न।";
            this.programmaticModalPopup.Show();

            return;
        }

        List <ATTGeneralTippaniProcess> processlst = new List <ATTGeneralTippaniProcess>();

        if (this.hdnForm.Value == "0")
        {
            processlst = this.chnlPerson.GetTippaniProcessList(updateProcess.OrgID, updateProcess.TippaniID, this.User.UserName);
        }

        List <ATTGeneralTippaniAttachment> lstAttachment = this.TippaniAttachment.GetAttachment(updateProcess.OrgID, updateProcess.TippaniID, this.User.UserName);

        try
        {
            if (this.hdnForm.Value == "0")
            {
                BLLGeneralTippaniProcess.UpdateChannelPersonDecisionAndAddProcess(updateProcess, processlst, lstAttachment, this.TippaniRequestViewer.TippaniSubjectType);
                this.ClearME();

                this.TippaniRequestViewer.LoadTippaniRequest(1);

                this.lblStatusMessage.Text = "Your decision and process has been saved successfully.";
                this.programmaticModalPopup.Show();
            }
            else if (this.hdnForm.Value == "1")
            {
                this.ClearME();
                this.hdnForm.Value         = "1";
                this.lblStatusMessage.Text = "तपाईले पठाउनु भएको टिप्पणीमा तपाईले काम गर्न सक्नुहुन्न।";
                this.programmaticModalPopup.Show();
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }