示例#1
0
    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();
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        #region validation
        if (this.Tippani.TippaniText.Text.Trim() == "")
        {
            this.lblStatusMessage.Text = "कृपया टिप्पणीको बिषय राख्नुहोस्।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.Tippani.FileNo.Text.Trim() == "")
        {
            this.lblStatusMessage.Text = "कृपया टिप्पणीको फाइल नं राख्नुहोस्।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.Tippani.TippaniPriority.SelectedIndex <= 0)
        {
            this.lblStatusMessage.Text = "कृपया टिप्पणीको प्राथमिक्ता छन्नुहोस।";
            this.programmaticModalPopup.Show();
            return;
        }
        #endregion

        /* tippani created */
        this.Tippani.ActionMode = this.hdnMode.Value;
        ATTGeneralTippani tippani = this.Tippani.GetTippani(this.User.UserName, this.hdnMsgIDs.Value, this.hdnDarIDs.Value);  

        /* tippani detail created */
        this.PunishmentEntry.ActionMode = this.hdnMode.Value;
        tippani.LstTippaniDetail = this.PunishmentEntry.GetPunishmentList();

        /* tippani attachment created */
        this.TippaniAttachment.ActionMode = this.hdnMode.Value;
        tippani.LstTippaniAttachment = this.TippaniAttachment.GetAttachment(tippani.OrgID, tippani.TippaniID, this.User.UserName);

        /* tippani process created for self actor */
        ATTGeneralTippaniProcess selfProcess = new ATTGeneralTippaniProcess();
        if (hdnMode.Value == "A")
        {
            selfProcess.OrgID = tippani.OrgID;
            selfProcess.TippaniID = tippani.TippaniID;
            selfProcess.TippaniProcessID = 0;
        }
        else if (hdnMode.Value == "E")
        {
            char[] token ={ '/' };
            selfProcess.OrgID = int.Parse(this.hdnIDs.Value.Split(token)[0]);
            selfProcess.TippaniID = int.Parse(this.hdnIDs.Value.Split(token)[1]);
            selfProcess.TippaniProcessID = 1;
        }
        selfProcess.SenderOrgID = null;
        selfProcess.SenderUnitID = null;
        selfProcess.SendBy = null;
        selfProcess.SendOn = "";
        selfProcess.ReceiverOrgID = this.User.OrgID;
        selfProcess.ReceiverUnitID = this.User.UnitID;
        selfProcess.SendTo = (int)this.User.PID;
        selfProcess.Note = this.PunishmentEntry.GetPunishmentNote();
        selfProcess.Status = int.Parse(this.PunishmentEntry.Status.SelectedValue);
        selfProcess.SendType = "F";
        selfProcess.IsChannelPerson = "Y";
        selfProcess.EntryBy = this.User.UserName;
        selfProcess.Action = this.hdnMode.Value;

        /* created list of process for tippani movement */
        //if (this.hdnMode.Value == "A")
        {
            tippani.LstTippaniProcess = this.chnlPerson.GetTippaniProcessList(tippani.OrgID, tippani.TippaniID, this.User.UserName);
        }

        /* add self process object at the begining of the process list */
        tippani.LstTippaniProcess.Insert(0, selfProcess);

        #region Validation
        bool hasDetail = tippani.LstTippaniDetail.Exists
                                                    (
                                                        delegate(ATTGeneralTippaniDetail d)
                                                        {
                                                            return d.Action != "D";
                                                        }
                                                    );
        if (hasDetail == false)
        {
            this.lblStatusMessage.Text = "कृपया टिप्पणीको लागी कर्मचारी राख्नुहोस्।";
            this.programmaticModalPopup.Show();
            return;
        }
        #endregion

        try
        {
            BLLGeneralTippani.AddGeneralTippani(tippani);

            foreach (ATTGeneralTippaniAttachment attach in tippani.LstTippaniAttachment)
            {
                if (attach.RawContent != null)
                {
                    GC.Collect();
                    GC.SuppressFinalize(attach.RawContent);
                    attach.RawContent = null;
                }
            }

            this.ClearME();

            this.lblStatusMessage.Text = "Punishment Tippani has been saved successfully.";
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }