Exemplo n.º 1
0
        public static int DeleteRecord(AttendanceApplication theAttendanceApplication)
        {
            int ProcReturnValue = AttendanceApplicationManagement.DeletetAttendanceApplication(theAttendanceApplication);


            return(ProcReturnValue);
        }
        private void BindGridLeaveApplicationsToApproveReject(string searchText = "")
        {
            try
            {
                PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
                Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);
                List <AttendanceApplication> theAttendanceApplication = new List <AttendanceApplication>();
                theAttendanceApplication = AttendanceApplicationManagement.GetPeningAttendanceApplicationsByReportingEmployee(TheEmployee.EmployeeID);
                // AttendanceAmendmentManagement.GetPeningAttendanceAmendmentApplicationsByReportingEmployee(TheEmployee.EmployeeID);

                string TheMessage;

                if (!(theAttendanceApplication.Count.Equals(0)))
                {
                    TheMessage = String.Format("<div id='LeaveCount'>Total No. of Attendance Applications(s) to approve:<b>{0}</b> </div> ", theAttendanceApplication.Count);


                    gridview_AttendanceApproves.DataSource = theAttendanceApplication;
                    gridview_AttendanceApproves.DataBind();
                }
                else
                {
                    TheMessage = "<div id='BiggerTextInformation'>There are no Attendance applications to approve/reject at this moment.<div>";
                }
                lit_Message.Text = TheMessage;
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void FillGridView()
        {
            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);

            PageVariables.AttendanceApplicationList = AttendanceApplicationManagement.GetAttendanceApplicationsByEmployee(TheEmployee.EmployeeID);


            gridview_AttendanceApply.DataSource = PageVariables.AttendanceApplicationList;
            gridview_AttendanceApply.DataBind();
        }
Exemplo n.º 4
0
        private int UpdateRecord()
        {
            int ProcReturnValue = 0;



            PageVariables.ThisAttendanceApplication.DateOfAttendance = DateTime.Parse(txt_AttendanceDate.Text);

            PageVariables.ThisAttendanceApplication.InTime            = DateTime.Parse(txt_InTime.Text);
            PageVariables.ThisAttendanceApplication.OutTime           = DateTime.Parse(txt_OutTime.Text);
            PageVariables.ThisAttendanceApplication.ApplicationReason = txt_Reason.Text;

            ProcReturnValue = AttendanceApplicationManagement.UpdateAttendanceApplication(PageVariables.ThisAttendanceApplication);


            return(ProcReturnValue);
        }
Exemplo n.º 5
0
        private int InsertRecord()
        {
            int ProcReturnValue = 0;

            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);
            // AttendanceAmendment TheAttendanceAmendment = new AttendanceAmendment();
            AttendanceApplication TheAttendanceApplication = new AttendanceApplication();

            TheAttendanceApplication.EmployeeID       = TheEmployee.EmployeeID;
            TheAttendanceApplication.DateOfAttendance = DateTime.Parse(txt_AttendanceDate.Text);
            TheAttendanceApplication.InTime           = DateTime.Parse(txt_InTime.Text);
            TheAttendanceApplication.OutTime          = DateTime.Parse(txt_OutTime.Text);

            TheAttendanceApplication.ApplicationReason = txt_Reason.Text;

            ProcReturnValue = AttendanceApplicationManagement.InsertAttendanceApplication(TheAttendanceApplication);


            return(ProcReturnValue);
        }
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                int ProcReturnValue;
                AttendanceApplication TheAttendanceApplication = new AttendanceApplication();

                TheAttendanceApplication.AttendanceApplicationID = AttendanceApplicationID;

                TheAttendanceApplication.Status = ddl_AmmendmentStatus.SelectedValue;

                TheAttendanceApplication.ApproveDate = DateTime.Now.Date;
                TheAttendanceApplication.ApprovalOrRejectionReason = txt_Reason.Text;

                ProcReturnValue = AttendanceApplicationManagement.ApproveOrRejectAttendanceApplication(TheAttendanceApplication);
                if (ProcReturnValue > 0)
                {
                    // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Message", String.Format("alert('successfully {0} the leave application.');", TheLeaveApplication.Status), true);
                    lbl_TheMessage.Text = ReadXML.GetSuccessMessage("OK_ATTENDANCEAPPLICATION_APRPOVED");

                    dialog_Message.Show();
                    BindGridLeaveApplicationsToApproveReject();
                    ResetTextBoxes();
                }
                else if (ProcReturnValue < 0)
                {
                    lbl_TheMessage.Text = ReadXML.GetSuccessMessage("KO_ATTENDANCEAPPLICATION_APRPOVED");
                    BindGridLeaveApplicationsToApproveReject();
                    dialog_Message.Show();
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Message", "alert('Sorry! failed to approve / reject the leave application.');", true);
                    ResetTextBoxes();
                }
                EnableDisableCommandButtons(false);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        protected void lnkEdit_Click(object sender, EventArgs e)
        {
            EnableDisableCommandButtons(true);

            LinkButton lnkBtn = (LinkButton)sender;

            AttendanceApplicationID = int.Parse(lnkBtn.CommandArgument);
            AttendanceApplication objAttendanceApplication = new AttendanceApplication();

            objAttendanceApplication = AttendanceApplicationManagement.GetAttendanceApplicationByAttendanceApplicationID(AttendanceApplicationID);
            // objAttendanceAmendment = AttendanceAmendmentManagement.GetAttendanceAmendmentByAttendanceAmendmentID(AttendanceAmendmentID);


            // lbl_AttandanceApproval.Text = String.Format("{0} details of {1}", objAttendanceApplication.EmployeeName, objAt);

            txt_EmpCode.Text     = objAttendanceApplication.EmployeeCode;
            txt_EmpName.Text     = objAttendanceApplication.EmployeeName;
            txt_Designation.Text = objAttendanceApplication.DesignationDescription;

            txt_AttendanceDate.Text = objAttendanceApplication.DateOfAttendance.ToShortDateString();
            txt_InTime.Text         = objAttendanceApplication.InTime.ToString("HH:mm:ss");
            txt_OutTime.Text        = objAttendanceApplication.OutTime.ToString("HH:mm:ss");
        }
Exemplo n.º 8
0
        protected void gridview_AttendanceApply_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                // EnabledisableButtons(true);
                int RowIndex = Convert.ToInt32(e.CommandArgument);
                int RecordID = int.Parse(((Label)gridview_AttendanceApply.Rows[RowIndex].FindControl("lbl_AttendanceApplicationID")).Text);
                lbl_DataOperationMode.Text = String.Format("EDIT APPLICATION : {0} [{1}]", gridview_AttendanceApply.Rows[RowIndex].Cells[2].Text.ToUpper(), RecordID);

                PageVariables.ThisAttendanceApplication = AttendanceApplicationManagement.GetAttendanceApplicationByAttendanceApplicationID(RecordID);

                if (e.CommandArgument.Equals("First"))
                {
                    RowIndex = 0;
                }
                else if (e.CommandArgument.Equals("Last"))
                {
                    RowIndex = gridview_AttendanceApply.PageCount - 1;
                }
                else
                {
                    RowIndex = Convert.ToInt32(e.CommandArgument);
                }

                if (e.CommandName.Equals(MicroEnums.DataOperation.Edit.GetStringValue()))
                {
                    Btn_Save.Text = MicroEnums.DataOperation.Update.GetStringValue();

                    multiView_AttandenceApplicationDetails.SetActiveView(view_InputControls);
                    PopulatePageFields(PageVariables.ThisAttendanceApplication);
                    EnableControls(view_InputControls, true);
                    //ChangeBackColor(view_InputControls);
                }
                else if (e.CommandName.Equals(MicroEnums.DataOperation.Delete.GetStringValue()))
                {
                    int ProcReturnValue = 0;

                    ProcReturnValue = DeleteRecord(PageVariables.ThisAttendanceApplication);
                    if (ProcReturnValue > 0)
                    {
                        lbl_TheMessage.Text = ReadXML.GetSuccessMessage("OK_ATTENDANCEAMMENDMENT_DELETED");
                        FillGridView();
                        dialog_Message.Show();
                    }
                    else
                    {
                        lbl_TheMessage.Text = ReadXML.GetFailureMessage("KO_ATTENDANCEAMMENDMENT_DELETED");
                        dialog_Message.Show();
                    }
                }

                //else if (e.CommandName.Equals(MicroEnums.DataOperation.Select.GetStringValue()))
                //{
                //    lbl_DataOperationMode.Text = String.Format("VIEW DCACCOUNT : {0} [{1}]", gridview_AttendanceAmmendmentApply.Rows[RowIndex].Cells[2].Text.ToUpper(), RecordID);
                //    multiView_DCAccounts.SetActiveView(view_InputControls);
                //    EnableControls(view_InputControls, false);
                //    PopulateFormFields(PageVariables.ThisDCAccount);
                //    EnabledisableButtons(false);

                //}
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }