예제 #1
0
        protected void lnkEdit_Click(object sender, EventArgs e)
        {
            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;

            StaffMaster TheStaffMaster = StaffMasterManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);
            LinkButton  TheLinkBtn     = (LinkButton)sender;

            btn_Save.Text           = MicroEnums.DataOperation.Update.GetStringValue();
            btn_LeaveCancel.Visible = true;

            LeaveApplicationID = int.Parse(TheLinkBtn.CommandArgument);
            LeaveApplication LType = new LeaveApplication();

            LType = LeaveApplicationManagement.GetLeaveApplicationByLeaveApplicationID(LeaveApplicationID);


            if (LType.Status != "Pending")
            {
                ddl_LeaveDescription.Text    = LType.LeaveTypeDescription;
                ddl_LeaveDescription.Enabled = false;
                txt_FromDate.Text            = LType.DateFrom.ToShortDateString();
                txt_FromDate.Enabled         = false;
                txt_Todate.Text         = LType.DateTo.ToShortDateString();
                txt_Todate.Enabled      = false;
                txt_Reason.Text         = LType.ApplicationReason;
                txt_Reason.Enabled      = false;
                txt_Status.Text         = LType.Status;
                txt_ApprovedBy.Text     = LType.ApprovedByEmployeeName;
                txt_RemarksDetails.Text = LType.ApprovalOrRejectionReason;

                btn_Save.Visible = false;
            }
            else
            {
                ddl_LeaveDescription.Text = LType.LeaveTypeDescription;
                txt_FromDate.Text         = LType.DateFrom.ToShortDateString();
                txt_Todate.Text           = LType.DateTo.ToShortDateString();

                txt_Reason.Text         = LType.ApplicationReason;
                txt_Status.Text         = LType.Status;
                txt_ApprovedBy.Text     = "";
                txt_RemarksDetails.Text = "";
                btn_Save.Visible        = true;
                txt_Todate_TextChanged(sender, e);
            }
        }
        protected void lnkCancel_Click(object sender, EventArgs e)
        {
            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);

            LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheEmployee.EmployeeID);
            LinkButton TheLinkBtn = (LinkButton)sender;

            LeaveApplicationID = int.Parse(TheLinkBtn.CommandArgument);
            LeaveApplication LType = new LeaveApplication();

            int ProcReturnValue = 0;

            LType = LeaveApplicationManagement.GetLeaveApplicationByLeaveApplicationID(LeaveApplicationID);
            if (LType.Status == "Pending")
            {
                LeaveApplication LeaveApplicationObject = new LeaveApplication();

                LeaveApplicationObject.EmployeeID        = TheEmployee.EmployeeID;
                LeaveApplicationObject.ApplicationReason = txt_Reason.Text;
                LeaveApplicationObject.Status            = "Pending";

                if (LeaveApplicationID > 0)
                {
                    LeaveApplicationObject.LeaveApplicationID = LeaveApplicationID;
                    ProcReturnValue     = LeaveApplicationManagement.DeletetLeaveApplication(LeaveApplicationObject);
                    lbl_TheMessage.Text = ReadXML.GetSuccessMessage("OK_LEAVEAPPLICATION_DELETED");

                    dialog_Message.Show();
                    // ScriptManager.RegisterClientScriptBlock(this, GetType(), "Message", "alert('Leave Application Deleted Successfully');", true);
                    btn_LeaveCancel.Visible = false;
                    FillGridView();
                }
            }
            else
            {
                lbl_TheMessage.Text = ReadXML.GetSuccessMessage("KO_LEAVEAPPLICATION_DELETED");
                dialog_Message.Show();
                // ScriptManager.RegisterClientScriptBlock(this, GetType(), "Message", "alert('Leave Application n't Cancelled Due to Approved/Cancelled');", true);
            }
        }
예제 #3
0
        protected void lnkEdit_Click(object sender, EventArgs e)
        {
            try
            {
                EnableDisableCommandButtons(true);

                LinkButton lnkBtn = (LinkButton)sender;
                LeaveApplicationID = int.Parse(lnkBtn.CommandArgument);
                LeaveApplication objLeaveAppln = new LeaveApplication();
                objLeaveAppln = LeaveApplicationManagement.GetLeaveApplicationByLeaveApplicationID(LeaveApplicationID);

                lbl_LeaveShowHistoyrDetails.Text = String.Format("{0} details of {1}", objLeaveAppln.LeaveTypeDescription, objLeaveAppln.EmployeeName);

                txt_LeaveDescription.Text = objLeaveAppln.LeaveTypeDescription;
                txt_FromDate.Text         = objLeaveAppln.DateFrom.ToShortDateString();
                txt_ToDate.Text           = objLeaveAppln.DateTo.ToShortDateString();
                txt_Reason.Text           = objLeaveAppln.ApplicationReason;
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }