Esempio n. 1
0
    protected void grdAttachment_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        e.Row.Cells[0].Visible = false;
        e.Row.Cells[1].Visible = false;
        e.Row.Cells[2].Visible = false;
        e.Row.Cells[3].Visible = false;

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((LinkButton)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick", "return confirm('Do you really want to delete?');");

            ATTGeneralTippaniAttachment attach = e.Row.DataItem as ATTGeneralTippaniAttachment;
            System.Drawing.Color        c      = BLLGeneralTippani.GetActionColor(attach.Action);
            e.Row.ForeColor = c;

            if (attach.Action == "D")
            {
                ((LinkButton)e.Row.Cells[6].Controls[0]).Text = "Undo";
            }
            else if (attach.Action == "N" || attach.Action == "A" || attach.Action == "E")
            {
                ((LinkButton)e.Row.Cells[6].Controls[0]).Text = "Delete";
            }
        }
    }
    protected void grdPostList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        e.Row.Cells[0].Visible  = false;
        e.Row.Cells[2].Visible  = false;
        e.Row.Cells[3].Visible  = false;
        e.Row.Cells[4].Visible  = false;
        e.Row.Cells[5].Visible  = false;
        e.Row.Cells[14].Visible = false;
        e.Row.Cells[15].Visible = false; //select command

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ATTGeneralTippaniSummary summary = e.Row.DataItem as ATTGeneralTippaniSummary;
            System.Drawing.Color     c       = BLLGeneralTippani.GetActionColor(summary.Action);
            e.Row.ForeColor = c;

            if (summary.Action == "D")
            {
                ((LinkButton)e.Row.Cells[16].Controls[0]).Text = "Undo";
            }
            else if (summary.Action == "N" || summary.Action == "A" || summary.Action == "E")
            {
                ((LinkButton)e.Row.Cells[16].Controls[0]).Text = "Delete";
            }
        }
    }
 public static int GetTotalLeaveDays(string toDate, string fromdate)
 {
     try
     {
         return(BLLGeneralTippani.GetDateDifference(toDate, fromdate));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Login_User_Detail"] == null)
        {
            Response.Redirect("~/MODULES/Login.aspx", true);
        }

        if (this.IsPostBack == false)
        {
            this.dlstUnreadTippani.DataSource = BLLGeneralTippani.GetUnreadTippani(this.User.PID, -1);
            this.dlstUnreadTippani.DataBind();
        }
    }
Esempio n. 5
0
    void LoadTippani(int Count)
    {
        ATTGeneralTippaniRequestInfo info = new ATTGeneralTippaniRequestInfo();

        info.OrgID            = int.Parse(this.ddlOrg_Rqd.SelectedValue);
        info.TippaniSubjectID = int.Parse(this.ddlTipaniSubject_Rqd.SelectedValue);
        info.FromDate         = this.txtFromDate.Text;
        info.ToDate           = this.txtToDate.Text;
        info.TippaniStatusID  = int.Parse(this.ddlStatus.SelectedValue);
        info.ProcessBy        = this.txtFirstName.Text;

        try
        {
            decimal totalRecord = Count;
            int     sIndex      = int.Parse(this.hdnIndex.Value);
            int     eIndex      = this.GetMaxRecordNumber();

            this.grdTippaniLst.DataSource = BLLGeneralTippani.GetGeneralTippaniInfo(info, sIndex, eIndex, ref totalRecord);
            this.grdTippaniLst.DataBind();

            if (Count > 0)
            {
                this.hdnTotalRecord.Value = totalRecord.ToString();
            }

            if (this.grdTippaniLst.Rows.Count > 0)
            {
                decimal lastIndex = sIndex + eIndex;

                if (lastIndex > decimal.Parse(this.hdnTotalRecord.Value))
                {
                    lastIndex = decimal.Parse(this.hdnTotalRecord.Value);
                }

                this.lblPaging.Text = "Record (" + (sIndex + 1).ToString() + " - " + lastIndex.ToString() + ") of " + this.hdnTotalRecord.Value;
            }
            else
            {
                this.lblPaging.Text = "";
            }
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
Esempio n. 6
0
    public void LoadTippaniDetail(int orgID, int tippaniID)
    {
        try
        {
            ATTGeneralTippani tippani = BLLGeneralTippani.GetTippaniDetail(orgID, tippaniID);
            this.txtTippaniText.Text       = tippani.TippaniText;
            this.txtFileNo.Text            = tippani.FileNo.ToString();
            this.ddlPriority.SelectedValue = tippani.PriorityID.ToString();

            this.hdnIDS.Value = orgID.ToString() + "/" + tippaniID.ToString();
        }
        catch (Exception ex)
        {
            this.lblStatusMessage.Text = ex.Message;
            this.programmaticModalPopup.Show();
        }
    }
    private ATTGeneralTippaniSummary GetLeaveDetail(int orgID, int tippaniID, double empID, string entryBy)
    {
        ATTGeneralTippaniSummary leave = new ATTGeneralTippaniSummary();

        if (this.grdLeave.SelectedIndex < 0)
        {
            leave.OrgID      = orgID;
            leave.TippaniID  = tippaniID;
            leave.TippaniSNO = 0;
            leave.EmpID      = empID;
            leave.EmpName    = this.EmpName;
            leave.Action     = "A";
        }
        else
        {
            ATTGeneralTippaniSummary detail = this.LeaveList[this.grdLeave.SelectedIndex] as ATTGeneralTippaniSummary;
            leave.OrgID      = detail.OrgID;
            leave.TippaniID  = detail.TippaniID;
            leave.TippaniSNO = detail.TippaniSNO;
            leave.EmpID      = detail.EmpID;
            leave.EmpName    = detail.EmpName;

            if (this.LeaveList[this.grdLeave.SelectedIndex].Action == "A")
            {
                leave.Action = "A";
            }
            else
            {
                leave.Action = "E";
            }
        }

        leave.LeaveTypeID     = int.Parse(this.ddlLeaveType_Rqd.SelectedValue);
        leave.LeaveType       = this.ddlLeaveType_Rqd.SelectedItem.Text;
        leave.ReqFromDate     = this.txtFromDate_Rdt.Text;
        leave.ReqToDate       = this.txtToDate_Rdt.Text;
        leave.ApplicationDate = this.txtApplicationDate_Rdt.Text;
        leave.ReqNoOfDays     = BLLGeneralTippani.GetDateDifference(leave.ReqToDate, leave.ReqFromDate) + 1;
        leave.ReqReason       = this.txtRemark.Text.Trim();
        leave.LeaveLevel      = LeaveMode.Request;
        //leave.Action = "A";
        leave.LeaveEntryBy = entryBy;

        return(leave);
    }
    protected void grdVisiterDetail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ATTGeneralTippaniSummary summary = e.Row.DataItem as ATTGeneralTippaniSummary;
            System.Drawing.Color     c       = BLLGeneralTippani.GetActionColor(summary.Action);
            e.Row.ForeColor = c;

            if (summary.Action == "D")
            {
                ((LinkButton)e.Row.Cells[9].Controls[0]).Text = "Undo";
            }
            else if (summary.Action == "N" || summary.Action == "A" || summary.Action == "E")
            {
                ((LinkButton)e.Row.Cells[9].Controls[0]).Text = "Delete";
            }
        }
    }
    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();
        }
    }
Esempio n. 10
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();
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (this.grdRecommendation.SelectedIndex <= -1)
        {
            if (this.grdLeave.SelectedIndex <= -1)
            {
                this.lblStatusMessage.Text = "कृपया कर्मचारीको बिदाको अनुरोध बिबरण छन्नुहोस ।";
                this.programmaticModalPopup.Show();
                return;
            }
        }

        if (this.chkRec.Checked == true)
        {
            if (this.txtFromDate_Rdt.Text.Trim() == "" || this.txtToDate_Rdt.Text.Trim() == "" || this.txtTotalDays_Rqd.Text.Trim() == "")
            {
                this.lblStatusMessage.Text = "कृपया सिफरिस गरेको कर्मचारीको लागी बिदाको सिफारिस बिबरण राख्नुहोस।";
                this.programmaticModalPopup.Show();
                return;
            }

            if (string.Compare(this.txtToDate_Rdt.Text.Trim(), this.txtFromDate_Rdt.Text.Trim()) < 0)
            {
                this.lblStatusMessage.Text = "बिदाको अवधि देखि मिति अवधि सम्म मिति भन्दा सानो हुनुपर्छ ।";
                this.programmaticModalPopup.Show();
                return;
            }

            if (string.Compare(this.hdnFromDate.Value.Trim(), this.txtFromDate_Rdt.Text.Trim()) > 0)
            {
                this.lblStatusMessage.Text = "सिफारिसको अवधि देखि मिति अनुरोधको अवधि देखि मिति भन्दा सानो हुन सक्दैन् ।";
                this.programmaticModalPopup.Show();
                return;
            }

            if (string.Compare(this.hdnToDate.Value.Trim(), this.txtToDate_Rdt.Text.Trim()) < 0)
            {
                this.lblStatusMessage.Text = "सिफारिसको अवधि सम्म मिति अनुरोधको अवधि सम्म मिति भन्दा ठुलो हुन सक्दैन् ।";
                this.programmaticModalPopup.Show();
                return;
            }
        }

        ATTGeneralTippaniSummary leave = new ATTGeneralTippaniSummary();

        GridViewRow row;

        if (this.grdRecommendation.SelectedIndex < 0)
        {
            row = this.grdLeave.SelectedRow;
        }
        else
        {
            row = this.grdRecommendation.SelectedRow;
        }

        leave.OrgID     = int.Parse(row.Cells[0].Text);
        leave.TippaniID = int.Parse(row.Cells[1].Text);
        leave.EmpID     = double.Parse(row.Cells[2].Text);
        leave.EmpName   = row.Cells[3].Text;

        if (this.grdRecommendation.SelectedIndex < 0)
        {
            bool exist = this.LeaveRec.Exists
                         (
                delegate(ATTGeneralTippaniSummary l)
            {
                return(l.OrgID == leave.OrgID &&
                       l.TippaniID == leave.TippaniID &&
                       l.EmpID == leave.EmpID);
            }
                         );
            if (exist == true)
            {
                this.lblStatusMessage.Text = "यस कर्मचारीको बिदाको सिफारिस बिबरण दिइसकेको छ।";
                this.programmaticModalPopup.Show();
                return;
            }
        }

        //leave.LeaveTypeID = int.Parse(this.ddlLeaveType_Rqd.SelectedValue);
        //leave.LeaveType = this.ddlLeaveType_Rqd.SelectedItem.Text;
        leave.RecFromDate = this.txtFromDate_Rdt.Text;
        leave.RecToDate   = this.txtToDate_Rdt.Text;
        leave.OldFromDate = this.hdnFromDate.Value;
        leave.OldToDate   = this.hdnToDate.Value;
        leave.RecDate     = ""; //set nepali date from database
        leave.RecNoOfDays = BLLGeneralTippani.GetDateDifference(leave.RecToDate, leave.RecFromDate) + 1;
        leave.RecYesNo    = this.chkRec.Checked == true ? "Y" : "N";
        leave.RecReason   = this.txtRemark.Text.Trim();
        leave.LeaveLevel  = LeaveMode.Recommend;
        leave.Action      = "A";
        leave.RecBy       = this.User.PID;

        if (this.grdRecommendation.SelectedIndex < 0)
        {
            this.LeaveRec.Add(leave);
        }
        else
        {
            this.LeaveRec[this.grdRecommendation.SelectedIndex] = leave;
        }

        this.grdRecommendation.DataSource = this.LeaveRec;
        this.grdRecommendation.DataBind();

        this.ClearLeaveDetail();
    }