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.VisitTippani.ActionMode = this.hdnMode.Value;
        tippani.LstTippaniDetail     = this.VisitTippani.GetVisitorList();
        if (tippani.TippaniDetail == null)
        {
            return;
        }

        /* 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.VisitTippani.Note.Text;
        selfProcess.Status          = int.Parse(this.VisitTippani.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 = "Visit Tippani has been saved successfully.";
            this.programmaticModalPopup.Show();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
Пример #2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        #region Validation
        if (this.grdEmployee.SelectedIndex < 0)
        {
            this.lblStatusMessage.Text = "क्रिपया कर्मचारी छन्नुहोस ।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.txtLocation_Rqd.Text.Trim() == "")
        {
            this.lblStatusMessage.Text = "क्रिपया भ्रमणको स्थना छन्नुहोस ।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.ddlCountry_Rqd.SelectedIndex == 0)
        {
            this.lblStatusMessage.Text = "क्रिपया भ्रमणको देश छन्नुहोस ।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.txtFromDate_Rdt.Text.Trim() == "")
        {
            this.lblStatusMessage.Text = "क्रिपया अवधि देखि को मिति राख्न्नुहोस ।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.txtToDate_Rdt.Text.Trim() == "")
        {
            this.lblStatusMessage.Text = "क्रिपया अवधि सम्म को मिति राख्न्नुहोस ।";
            this.programmaticModalPopup.Show();
            return;
        }

        if (this.txtSubject_Rqd.Text.Trim() == "")
        {
            this.lblStatusMessage.Text = "क्रिपया भ्रमणको बिषय राख्न्नुहोस ।";
            this.programmaticModalPopup.Show();
            return;
        }
        #endregion

        double EmpID = double.Parse(this.grdEmployee.SelectedRow.Cells[0].Text);

        ATTGeneralTippani tippani = new ATTGeneralTippani();

        tippani.TippaniName      = TippaniSubject.Visit;
        tippani.OrgID            = int.Parse(this.ddlOrg_Rqd.SelectedValue);
        tippani.TippaniID        = 0;
        tippani.TippaniSubjectID = int.Parse(this.ddlTippaniSubject_Rqd.SelectedValue);
        tippani.TippaniBy        = this.User.UserName;
        tippani.TippaniOn        = "";
        tippani.TippaniText      = this.txtTippaniText.Text;
        tippani.FinalStatus      = 1;
        tippani.Action           = "A";

        tippani.TippaniDetail.OrgID          = tippani.OrgID;
        tippani.TippaniDetail.TippaniID      = tippani.TippaniID;
        tippani.TippaniDetail.TippaniSNO     = 0;
        tippani.TippaniDetail.EmpID          = EmpID;
        tippani.TippaniDetail.VisitLocation  = this.txtLocation_Rqd.Text;
        tippani.TippaniDetail.VisitCountryID = int.Parse(this.ddlCountry_Rqd.SelectedValue);
        tippani.TippaniDetail.VisitFromDate  = this.txtFromDate_Rdt.Text;
        tippani.TippaniDetail.VisitToDate    = this.txtToDate_Rdt.Text;
        tippani.TippaniDetail.VisitPurpose   = this.txtSubject_Rqd.Text;
        tippani.TippaniDetail.VisitRemark    = this.txtRemarks_Rdt.Text;
        tippani.TippaniDetail.VisitEntryBy   = this.User.UserName;
        tippani.TippaniDetail.Action         = "A";

        /****************** extra added later ******************/
        ATTGeneralTippaniProcess self = new ATTGeneralTippaniProcess();
        self.OrgID            = tippani.OrgID;
        self.TippaniID        = tippani.TippaniID;
        self.TippaniProcessID = 0;
        self.SendBy           = null;
        self.SendOn           = "";
        self.SendTo           = (int)this.User.PID;
        self.Note             = this.txtDOB.Text;
        self.Status           = int.Parse(this.ddlTippaniStatus.SelectedValue);
        self.SendType         = "F";
        self.IsChannelPerson  = "Y";
        self.Action           = "A";

        tippani.LstTippaniProcess.Add(self);
        /************************************/

        foreach (GridViewRow row in this.grdChannelPerson.Rows)
        {
            CheckBox box = (CheckBox)row.FindControl("chkSelect");
            if (box.Checked == true)
            {
                ATTGeneralTippaniProcess process = new ATTGeneralTippaniProcess();

                /*process.OrgID = tippani.OrgID;
                 * process.TippaniID = tippani.TippaniID;
                 * process.TippaniProcessID = 0;
                 * process.ProcessBy = this.User.PID;
                 * process.ProcessOn = "";
                 * process.ProcessTo = int.Parse(row.Cells[1].Text);
                 * process.Status = null;
                 * process.SendType = "F";
                 * process.Action = "A";*/

                process.OrgID            = tippani.OrgID;
                process.TippaniID        = tippani.TippaniID;
                process.TippaniProcessID = 0;
                process.SendBy           = this.User.PID;
                process.SendOn           = "";
                process.SendTo           = int.Parse(row.Cells[8].Text);
                process.Note             = "";
                process.Status           = null;
                process.SendType         = "F";
                process.IsChannelPerson  = "Y";
                process.Action           = "A";

                tippani.LstTippaniProcess.Add(process);

                //box.Checked = false;
            }
        }

        foreach (GridViewRow row in this.grdSEmployee.Rows)
        {
            CheckBox box = (CheckBox)row.FindControl("chkGSelect");
            if (box.Checked == true)
            {
                ATTGeneralTippaniProcess process = new ATTGeneralTippaniProcess();

                process.OrgID            = tippani.OrgID;
                process.TippaniID        = tippani.TippaniID;
                process.TippaniProcessID = 0;
                process.SendBy           = this.User.PID;
                process.SendOn           = "";
                process.SendTo           = int.Parse(row.Cells[0].Text);
                process.Note             = "";
                process.Status           = null;
                process.SendType         = "F";
                process.IsChannelPerson  = "N";
                process.Action           = "A";

                tippani.LstTippaniProcess.Add(process);

                //box.Checked = false;
            }
        }

        try
        {
            BLLGeneralTippani.AddGeneralTippani(tippani);

            this.ClearME();

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