Пример #1
0
        /////////////////////////////
        //////// Form Events ////////
        /////////////////////////////

        private void frmCDLEdit_Load(object sender, EventArgs e)
        {
            cmbLeaveType.DataSource = LeaveApplicationTypes.DSLLeaveType();

            this.BindDetails();
            this.BindList();
        }
Пример #2
0
        private void btnExcludeAll_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem itm in lvIncluded.Items)
            {
                bool   blnCancelLeave   = false;
                bool   blnHasBalance    = false;
                string strLeaveTypeCode = "";
                string strUsername      = itm.Tag.ToString();
                string strLeaveCode     = CDL.GetLeaveCode(strUsername, _strCDLCode);

                using (LeaveApplication leave = new LeaveApplication())
                {
                    leave.LeaveCode = strLeaveCode;
                    leave.Fill();
                    strLeaveTypeCode = leave.LeaveType;
                    leave.Status     = "C";
                    blnCancelLeave   = leave.UpdateAdmin() > 0;
                }
                blnHasBalance = LeaveApplicationTypes.IsHasBalance(strLeaveTypeCode);

                if (blnHasBalance && blnCancelLeave)
                {
                    LeaveApplicationBalance.AddLeaveBalance(1, strUsername, strLeaveTypeCode);
                }

                if (blnCancelLeave)
                {
                    CDL.RemoveMember(_strCDLCode, strUsername);
                }
            }
            this.BindList();
        }
Пример #3
0
 private void BindLeaveTypeDetails()
 {
     if (cmbLeaveType.Items.Count > 0)
     {
         using (LeaveApplicationTypes lt = new LeaveApplicationTypes())
         {
             lt.LeaveTypeCode = cmbLeaveType.SelectedValue.ToString();
             lt.Fill();
             txtWithPay.Text        = clsValidator.ToYesNo(lt.WithPay);
             txtHasBalance.Text     = clsValidator.ToYesNo(lt.HasBalance);
             txtMaxBalance.Text     = lt.MaximumBalance.ToString();
             txtEntitlement.Text    = lt.MaximumBalance.ToString();
             txtBalance.Text        = txtMaxBalance.Text;
             txtMaxBalance.Enabled  = (lt.HasBalance == "1");
             txtEntitlement.Enabled = (lt.HasBalance == "1");
             txtBalance.Enabled     = (lt.HasBalance == "1");
         }
     }
     else
     {
         txtWithPay.Text     = "";
         txtHasBalance.Text  = "";
         txtMaxBalance.Text  = "";
         txtEntitlement.Text = "";
         txtBalance.Text     = "";
     }
 }
Пример #4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsCorrectEntries())
     {
         int intAffected = 0;
         using (LeaveApplicationTypes lt = new LeaveApplicationTypes())
         {
             lt.LeaveType      = txtLeaveType.Text;
             lt.WithPay        = (chkWithPay.Checked ? "1" : "0");
             lt.HasBalance     = (chkHasBalance.Checked ? "1" : "0");
             lt.MaximumBalance = (chkHasBalance.Checked ? clsValidator.CheckFloat(txtMaxBalance.Text) : 0);
             intAffected       = lt.Insert();
         }
         if (intAffected > 0)
         {
             _frmLeaveTypeList.BindLeaveTypeList();
             if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 ClearFields();
             }
             else
             {
                 this.Close();
             }
         }
     }
 }
Пример #5
0
        //public mdiIpanema MDIIpanema { get { return _mdiIpanema; } set { _mdiIpanema = value; } }

        private void InitializeFields()
        {
            txtEmployee.Text = Employee.GetName(_strUsername);
            using (LeaveApplicationTypes lt = new LeaveApplicationTypes())
            {
                lt.LeaveTypeCode = _strLeaveTypeCode;
                lt.Fill();
                txtLeaveTypeCode.Text  = _strLeaveTypeCode;
                txtLeaveType.Text      = lt.LeaveType;
                txtWithPay.Text        = clsValidator.ToYesNo(lt.WithPay);
                txtMaxBalance.Text     = lt.MaximumBalance.ToString();
                txtHasBalance.Text     = clsValidator.ToYesNo(lt.HasBalance);
                txtBalance.Enabled     = (lt.HasBalance == "1");
                txtEntitlement.Enabled = (lt.HasBalance == "1");
            }

            using (LeaveApplicationBalance lb = new LeaveApplicationBalance())
            {
                lb.LeaveTypeCode = _strLeaveTypeCode;
                lb.Username      = _strUsername;
                lb.Fill();
                txtBalance.Text     = lb.Balance.ToString();
                chkStatus.Checked   = (lb.Status == "1" ? true : false);
                txtEntitlement.Text = lb.Entitlement.ToString();
            }
        }
Пример #6
0
        private bool IsCorrectData()
        {
            bool   blnReturn       = true;
            string strErrorMessage = "";

            if (txtReason.Text == "")
            {
                strErrorMessage = "Reason is required.";
            }

            if (LeaveApplicationTypes.IsHasBalance(_strLeaveTypeCode) && cmbStatus.SelectedValue.ToString() == "A" && _strStatus != "A")
            {
                if (clsValidator.CheckFloat(txtUnits.Text) > clsValidator.CheckFloat(txtBalance.Text))
                {
                    strErrorMessage += "\nNot enough leave balance.";
                }
            }

            if (strErrorMessage != "")
            {
                MessageBox.Show(clsMessageBox.MessageBoxValidationError + strErrorMessage, clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                blnReturn = false;
            }

            return(blnReturn);
        }
Пример #7
0
        private void InitializeFields()
        {
            cmbRequestor.DataSource    = Employee.DSLActive();
            cmbRequestor.ValueMember   = "pvalue";
            cmbRequestor.DisplayMember = "ptext";

            cmbApprover.DataSource    = clsDepartmentApprover.DdlDsByEmployee(cmbRequestor.SelectedValue.ToString(), EFormType.Leave);
            cmbApprover.ValueMember   = "pvalue";
            cmbApprover.DisplayMember = "ptext";

            cmbStatus.DataSource    = LeaveApplication.DdlDsStatus();
            cmbStatus.ValueMember   = "pvalue";
            cmbStatus.DisplayMember = "ptext";

            cmbLeaveType.DataSource    = LeaveApplicationTypes.DSLLeaveType();
            cmbLeaveType.ValueMember   = "pvalue";
            cmbLeaveType.DisplayMember = "ptext";

            txtUnits.Text      = "0";
            dtpDateFile.Value  = DateTime.Now;
            dtpDateStart.Value = DateTime.Now;
            dtpDateStart_ValueChanged(null, null);
            dtpDateEnd.Value = DateTime.Now;
            dtpDateEnd_ValueChanged(null, null);
            txtReason.Text        = "";
            dtpApproverDate.Value = DateTime.Now;
            dtpApproverTime.Value = DateTime.Now;
            txtARemarks.Text      = "";

            cmbStatus.Focus();
        }
Пример #8
0
 private void cmbLeaveType_SelectedIndexChanged(object sender, EventArgs e)
 {
     LoadEmployee();
     if (cmbLeaveType.Items.Count > 0)
     {
         txtMaxBalance.Text = LeaveApplicationTypes.GetMaxBalance(cmbLeaveType.SelectedValue.ToString());
     }
 }
Пример #9
0
        private void ClearFields()
        {
            txtCode.Text          = LeaveApplicationTypes.GenerateCode();
            txtLeaveType.Text     = "";
            chkWithPay.Checked    = false;
            chkHasBalance.Checked = false;
            txtMaxBalance.Text    = "";

            txtLeaveType.Focus();
        }
Пример #10
0
        private void btnInclude_Click(object sender, EventArgs e)
        {
            if (lvExcluded.SelectedItems.Count > 0)
            {
                bool     blnInsertLeave = false;
                bool     blnHasBalance  = LeaveApplicationTypes.IsHasBalance(cmbLeaveType.SelectedValue.ToString());
                string   strLeaveCode   = "";
                string   strUsername    = lvExcluded.SelectedItems[0].Tag.ToString();
                DateTime dteDateStart   = DateTime.Now;
                DateTime dteDateEnd     = DateTime.Now;

                using (clsShift shift = new clsShift())
                {
                    shift.ShiftCode = clsShift.GetDayShiftCode(strUsername, clsDateTime.GetDateOnly(dtpDateApplied.Value));
                    shift.Fill();
                    dteDateStart = clsDateTime.CombineDateTime(dtpDateApplied.Value, shift.TimeStart);
                    dteDateEnd   = clsDateTime.CombineDateTime(dtpDateApplied.Value, shift.TimeEnd);
                }

                if ((clsValidator.CheckFloat(lvExcluded.SelectedItems[0].SubItems[1].Text) >= 1) || (!blnHasBalance))
                {
                    using (LeaveApplication leave = new LeaveApplication())
                    {
                        leave.LeaveType       = cmbLeaveType.SelectedValue.ToString();
                        leave.Requestor       = strUsername;
                        leave.DateFile        = DateTime.Now;
                        leave.DateStart       = dteDateStart;
                        leave.DateEnd         = dteDateEnd;
                        leave.Units           = 1;
                        leave.Reason          = txtReason.Text;
                        leave.Approver        = HRMSCore.Username;
                        leave.ApproverDate    = DateTime.Now;
                        leave.ApproverRemarks = "CDL Application. Auto-generated";
                        leave.Status          = "A";
                        blnInsertLeave        = leave.InsertAdmin();
                        strLeaveCode          = leave.LeaveCode;
                    }
                    if (blnHasBalance && blnInsertLeave)
                    {
                        LeaveApplicationBalance.DeductLeaveBalance(1, strUsername, cmbLeaveType.SelectedValue.ToString());
                    }

                    if (blnInsertLeave)
                    {
                        CDL.InsertMember(_strCDLCode, strUsername, strLeaveCode);
                        this.BindList();
                    }
                }
                else
                {
                    MessageBox.Show(lvExcluded.SelectedItems[0].Tag.ToString() + " has not enough balance.", clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Пример #11
0
        private void frmLeaveEntitlementProcess_Load(object sender, EventArgs e)
        {
            cmbLeaveType.DataSource    = LeaveApplicationTypes.DSLLeaveType();
            cmbLeaveType.ValueMember   = "pvalue";
            cmbLeaveType.DisplayMember = "ptext";

            if (cmbLeaveType.Items.Count > 0)
            {
                txtMaxBalance.Text = LeaveApplicationTypes.GetMaxBalance(cmbLeaveType.SelectedValue.ToString());
            }

            LoadEmployee();
        }
Пример #12
0
 private void cmbEmployee_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (_FormCaller == FormCallers.LeaveEntitlementList)
     {
         try
         {
             cmbLeaveType.DataSource    = LeaveApplicationTypes.GetDSLActive(cmbEmployee.SelectedValue.ToString());
             cmbLeaveType.ValueMember   = "pvalue";
             cmbLeaveType.DisplayMember = "ptext";
         }
         catch { }
     }
 }
Пример #13
0
 private void tbtnDelete_Click(object sender, EventArgs e)
 {
     if (dgLeaveTypeList.Rows.Count != 0)
     {
         if (MessageBox.Show(clsMessageBox.MessageBoxDeleteAsk, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             LeaveApplicationTypes lt = new LeaveApplicationTypes();
             lt.LeaveTypeCode = dgLeaveTypeList.SelectedRows[0].Cells[0].Value.ToString();
             lt.Delete();
             BindLeaveTypeList();
         }
     }
 }
Пример #14
0
        ////////////////////////////////
        ///////// Forms Events /////////
        ////////////////////////////////

        private void frmLeaveEntitlementList_Load(object sender, EventArgs e)
        {
            cmbLeaveType.DataSource    = LeaveApplicationTypes.GetDSLActiveAll();
            cmbLeaveType.ValueMember   = "pvalue";
            cmbLeaveType.DisplayMember = "ptext";

            cmbStatus.DataSource    = LeaveApplicationBalance.DdlDsStatusAll();
            cmbStatus.ValueMember   = "pvalue";
            cmbStatus.DisplayMember = "ptext";

            BindLeaveBalanceList();

            this.WindowState = FormWindowState.Maximized;
        }
Пример #15
0
        public void BindLeaveTypeList()
        {
            DataTable tblCluster = LeaveApplicationTypes.DSGLeaveTypeList();

            dgLeaveTypeList.AutoGenerateColumns         = false;
            dgLeaveTypeList.DataSource                  = tblCluster;
            dgLeaveTypeList.Columns[0].DataPropertyName = "leavtype";
            dgLeaveTypeList.Columns[1].DataPropertyName = "ltdesc";
            dgLeaveTypeList.Columns[2].DataPropertyName = "withpay";
            dgLeaveTypeList.Columns[3].DataPropertyName = "maxbal";
            dgLeaveTypeList.Columns[4].DataPropertyName = "hasbal";
            dgLeaveTypeList.Columns[5].DataPropertyName = "pstatus";
            HRMSCore.UpdateStatusBarFormInfo("Total Records: " + dgLeaveTypeList.Rows.Count.ToString());
        }
Пример #16
0
 private void BindDetails()
 {
     txtCode.Text = _strLeaveTypeCode;
     using (LeaveApplicationTypes lt = new LeaveApplicationTypes())
     {
         lt.LeaveTypeCode = _strLeaveTypeCode;
         lt.Fill();
         txtLeaveType.Text     = lt.LeaveType;
         chkWithPay.Checked    = (lt.WithPay == "1" ? true : false);
         chkHasBalance.Checked = (lt.HasBalance == "1" ? true : false);
         txtMaxBalance.Text    = lt.MaximumBalance.ToString();
         chkStatus.Checked     = (lt.Status == "1" ? true : false);
         _strStatus            = lt.Status;
     }
 }
Пример #17
0
        public void BindBalanceList()
        {
            lvBalance.Items.Clear();
            DataTable tblBalance = LeaveApplicationBalance.GetDataTableEntitlementHasBalance(_strUsername);

            foreach (DataRow drw in tblBalance.Rows)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = LeaveApplicationTypes.GetDescription(drw["leavtype"].ToString());
                lvi.Tag  = drw["leavtype"].ToString();
                lvi.SubItems.Add(drw["entitle"].ToString());
                lvi.SubItems.Add(drw["pbalance"].ToString());
                lvBalance.Items.Add(lvi);
            }
        }
Пример #18
0
 private void cmbLeaveType_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (LeaveApplicationTypes.GetHasBalance(_strLeaveTypeCode) == "1")
         {
             txtBalance.Text = LeaveApplicationBalance.GetRemainingBalance(_strUsername, _strLeaveTypeCode).ToString();
         }
         else
         {
             txtBalance.Text = "NA";
         }
     }
     catch { }
 }
Пример #19
0
 private void cmbLeaveType_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (LeaveApplicationTypes.GetHasBalance(cmbLeaveType.SelectedValue.ToString()) == "1")
         {
             txtBalance.Text = LeaveApplicationBalance.GetRemainingBalance(cmbRequestor.SelectedValue.ToString(), cmbLeaveType.SelectedValue.ToString()).ToString();
         }
         else
         {
             txtBalance.Text = "NA";
         }
     }
     catch { }
 }
Пример #20
0
        private void InitializeFields()
        {
            cmbEmployee.DataSource    = Employee.DSLActive();
            cmbEmployee.ValueMember   = "pvalue";
            cmbEmployee.DisplayMember = "ptext";

            if (_FormCaller == FormCallers.EmployeeDetails)
            {
                cmbLeaveType.DataSource = LeaveApplicationTypes.DSLLeaveType();
            }
            else if (_FormCaller == FormCallers.LeaveEntitlementList)
            {
                cmbLeaveType.DataSource = LeaveApplicationTypes.GetDSLActive(cmbEmployee.SelectedValue.ToString());
            }
            cmbLeaveType.ValueMember   = "pvalue";
            cmbLeaveType.DisplayMember = "ptext";
        }
Пример #21
0
 private void BindLeaveDetails(string pLeaveCode)
 {
     using (LeaveApplication leave = new LeaveApplication(pLeaveCode))
     {
         leave.Fill();
         lblLeaveCode.Text      = pLeaveCode;
         lblLeaveType.Text      = LeaveApplicationTypes.GetDescription(leave.LeaveType);
         lblLeaveRequestor.Text = Employee.GetName(leave.Requestor);
         lblLeaveDateFile.Text  = leave.DateFile.ToString("MMM dd, yyyy hh:mm tt");
         lblLeaveStart.Text     = leave.DateStart.ToString("MMM dd, yyyy hh:mm tt");
         lblLeaveEnd.Text       = leave.DateEnd.ToString("MMM dd, yyyy hh:mm tt");
         lblLeaveUnit.Text      = leave.Units.ToString("####0.00");
         lblLeaveReason.Text    = leave.Reason;
         lblLeaveAName.Text     = Employee.GetName(leave.Approver);
         lblLeaveADate.Text     = leave.ApproverDate.ToString("MMM dd, yyyy");
         lblLeaveARemarks.Text  = leave.ApproverRemarks;
         lblLeaveStatus.Text    = LeaveApplication.ToLeaveStatusDesc(leave.Status);
     }
 }
Пример #22
0
 private void BindDetails()
 {
     using (LeaveApplication leave = new LeaveApplication(_strLeaveCode))
     {
         leave.Fill();
         txtLeaveCode.Text       = _strLeaveCode;
         txtLeaveType.Text       = LeaveApplicationTypes.GetDescription(leave.LeaveType);
         txtRequestor.Text       = Employee.GetName(leave.Requestor);
         txtFiled.Text           = leave.DateFile.ToString("MMM dd, yyyy");
         txtStart.Text           = leave.DateStart.ToString("MMM dd, yyyy hh:mm tt");
         txtEnd.Text             = leave.DateEnd.ToString("MMM dd, yyyy hh:mm tt");
         txtUnits.Text           = leave.Units.ToString("####0.00");
         txtReason.Text          = leave.Reason;
         txtApprover.Text        = Employee.GetName(leave.Approver);
         txtDateProcessed.Text   = leave.ApproverDate.ToString("MMM dd, yyyy");
         txtApproverRemarks.Text = leave.ApproverRemarks;
         txtStatus.Text          = LeaveApplication.ToLeaveStatusDesc(leave.Status);
     }
 }
Пример #23
0
        private void frmLeaveSetting_Load(object sender, EventArgs e)
        {
            using (clsLeaveSetting objLeaveSetting = new clsLeaveSetting())
            {
                lblEL.Text = LeaveName;
                objLeaveSetting.LeaveName = LeaveName;
                objLeaveSetting.Fill();
                txtCode.Text = objLeaveSetting.LeaveCode;
            }

            LeaveApplicationTypes objfill = new LeaveApplicationTypes();

            objfill.LeaveTypeCode = txtCode.Text;
            objfill.Fill();
            cmbELwp.DataSource    = LeaveApplicationTypes.DSLLeaveTypeWithPay();
            cmbELwp.ValueMember   = "pvalue";
            cmbELwp.DisplayMember = "ptext";
            cmbELwp.SelectedValue = objfill.LeaveTypeCode;
            cmbELwp.Text          = objfill.LeaveType;
        }
Пример #24
0
 private void btnProcess_Click(object sender, EventArgs e)
 {
     if (lvEmployee.CheckedItems.Count > 0)
     {
         LeaveApplicationTypes lt = new LeaveApplicationTypes();
         lt.LeaveTypeCode = cmbLeaveType.SelectedValue.ToString();
         lt.Fill();
         foreach (ListViewItem itm in lvEmployee.CheckedItems)
         {
             LeaveApplicationBalance lb = new LeaveApplicationBalance();
             lb.Username      = itm.Tag.ToString();
             lb.LeaveTypeCode = lt.LeaveTypeCode;
             lb.Entitlement   = lt.MaximumBalance;
             lb.Balance       = lt.MaximumBalance;
             lb.Status        = "1";
             lb.Insert();
         }
         MessageBox.Show("Leave processing complete.", clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Information);
         LoadEmployee();
     }
 }
Пример #25
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsCorrectEntries())
     {
         if (_strStatus == "1" && !chkStatus.Checked)
         {
             if (MessageBox.Show("You choose to set inactive this leave type.\nThis action will disable " + txtLeaveType.Text + " to all employee.\n\nDo you want to continue", clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 using (LeaveApplicationTypes lt = new LeaveApplicationTypes())
                 {
                     lt.LeaveTypeCode  = _strLeaveTypeCode;
                     lt.LeaveType      = txtLeaveType.Text;
                     lt.WithPay        = (chkWithPay.Checked ? "1" : "0");
                     lt.HasBalance     = (chkHasBalance.Checked ? "1" : "0");
                     lt.MaximumBalance = clsValidator.CheckFloat(txtMaxBalance.Text);
                     lt.Status         = (chkStatus.Checked ? "1" : "0");
                     lt.Update();
                 }
                 LeaveApplicationBalance.DisableRecords(_strLeaveTypeCode);
             }
         }
         else
         {
             using (LeaveApplicationTypes lt = new LeaveApplicationTypes())
             {
                 lt.LeaveTypeCode  = _strLeaveTypeCode;
                 lt.LeaveType      = txtLeaveType.Text;
                 lt.WithPay        = (chkWithPay.Checked ? "1" : "0");
                 lt.HasBalance     = (chkHasBalance.Checked ? "1" : "0");
                 lt.MaximumBalance = clsValidator.CheckFloat(txtMaxBalance.Text);
                 lt.Status         = (chkStatus.Checked ? "1" : "0");
                 lt.Update();
             }
         }
         _frmLeaveTypeList.BindLeaveTypeList();
         this.Close();
     }
 }
Пример #26
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsCorrectData())
            {
                DateTime dteDateStart = clsDateTime.CombineDateTime(dtpDateStart.Value, cmbTimeFrom.Text);
                DateTime dteDateEnd   = clsDateTime.CombineDateTime(dtpDateEnd.Value, cmbTimeTo.Text);
                if (!LeaveApplication.HasExistingApplication(cmbRequestor.SelectedValue.ToString(), dteDateStart, dteDateEnd))
                {
                    LeaveApplication leave = new LeaveApplication();
                    leave.LeaveCode       = txtLeaveCode.Text;
                    leave.LeaveType       = cmbLeaveType.SelectedValue.ToString();
                    leave.Requestor       = cmbRequestor.SelectedValue.ToString();
                    leave.DateFile        = DateTime.Now;
                    leave.DateStart       = dteDateStart;
                    leave.DateEnd         = dteDateEnd;
                    leave.Units           = clsValidator.CheckFloat(txtUnits.Text);
                    leave.Reason          = txtReason.Text;
                    leave.Approver        = cmbApprover.SelectedValue.ToString();
                    leave.ApproverDate    = clsDateTime.CombineDateTime(dtpDateEnd.Value, dtpApproverTime.Value);
                    leave.ApproverRemarks = txtARemarks.Text;
                    leave.Status          = cmbStatus.SelectedValue.ToString();
                    leave.InsertAdmin();
                    MessageBox.Show("save");

                    if (cmbStatus.SelectedValue.ToString() == "A" && LeaveApplicationTypes.IsHasBalance(cmbLeaveType.SelectedValue.ToString()))
                    {
                        LeaveApplicationBalance.DeductLeaveBalance(clsValidator.CheckFloat(txtUnits.Text), cmbRequestor.SelectedValue.ToString(), cmbLeaveType.SelectedValue.ToString());
                    }

                    _frmLeaveList.BindLeaveList();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("There is already an existing leave application on specified dates.", clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #27
0
 private void BindDetails()
 {
     using (LeaveApplication leave = new LeaveApplication(_strLeaveCode))
     {
         leave.Fill();
         txtLeaveCode.Text       = _strLeaveCode;
         txtLeaveType.Text       = LeaveApplicationTypes.GetDescription(leave.LeaveType);
         txtRequestor.Text       = Employee.GetName(leave.Requestor);
         txtFiled.Text           = leave.DateFile.ToString("MMM dd, yyyy");
         txtDateStart.Text       = leave.DateStart.ToString("MMM dd, yyyy hh:mm tt");
         txtDateEnd.Text         = leave.DateEnd.ToString("MMM dd, yyyy hh:mm tt");
         txtUnits.Text           = leave.Units.ToString("####0.00");
         txtReason.Text          = leave.Reason;
         txtApprover.Text        = Employee.GetName(leave.Approver);
         dtpApproverDate.Value   = leave.ApproverDate;
         dtpApproverTime.Value   = leave.ApproverDate;
         txtApproverRemarks.Text = leave.ApproverRemarks;
         cmbStatus.SelectedValue = leave.Status;
         _strLeaveTypeCode       = leave.LeaveType;
         _strUsername            = leave.Requestor;
         _strStatus = leave.Status;
     }
 }
Пример #28
0
        ///////////////////////////////
        ///////// Form Events /////////
        ///////////////////////////////

        private void frmLeaveList_Load(object sender, EventArgs e)
        {
            cmbLeaveType.DataSource    = LeaveApplicationTypes.GetDSLAll();
            cmbLeaveType.ValueMember   = "pvalue";
            cmbLeaveType.DisplayMember = "ptext";

            // Load the current time sheet period
            string strCurrentTimeSheetPeriod = clsTimeSheetPeriod.GetCurrentTimeSheetPeriod();

            using (clsTimeSheetPeriod tsp = new clsTimeSheetPeriod(strCurrentTimeSheetPeriod))
            {
                tsp.Fill();
                dtpFrom.Value = tsp.PeriodFrom;
                dtpTo.Value   = tsp.PeriodTo;
            }

            cmbStatus.DataSource    = LeaveApplication.DdlDsStatusAll();
            cmbStatus.ValueMember   = "pvalue";
            cmbStatus.DisplayMember = "ptext";

            BindLeaveList();
            this.WindowState = FormWindowState.Maximized;
        }
Пример #29
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsCorrectData())
     {
         using (LeaveApplication leave = new LeaveApplication())
         {
             leave.LeaveCode = txtLeaveCode.Text;
             leave.Fill();
             leave.Reason       = txtReason.Text;
             leave.ApproverDate = clsDateTime.CombineDateTime(dtpApproverDate.Value, dtpApproverTime.Value);
             leave.Status       = cmbStatus.SelectedValue.ToString();
             leave.UpdateAdmin();
             if (cmbStatus.SelectedValue.ToString() == "A" && _strStatus != "A" && LeaveApplicationTypes.IsHasBalance(_strLeaveTypeCode))
             {
                 LeaveApplicationBalance.DeductLeaveBalance(clsValidator.CheckFloat(txtUnits.Text), _strUsername, _strLeaveTypeCode);
             }
             else if (cmbStatus.SelectedValue.ToString() != "A" && _strStatus == "A" && LeaveApplicationTypes.IsHasBalance(_strLeaveTypeCode))
             {
                 LeaveApplicationBalance.AddLeaveBalance(clsValidator.CheckFloat(txtUnits.Text), _strUsername, _strLeaveTypeCode);
             }
         }
         _frmLeaveList.BindLeaveList();
         this.Close();
     }
 }