Beispiel #1
0
        public override void SaveRecord(SavingParemeter Paras)
        {
            DAL.tblLeaveType SaveModel = null;

            if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew || EditRecordDataSource == null)
            {
                SaveModel = new DAL.tblLeaveType();
            }
            else
            {
                SaveModel = DALObject.FindSaveModelByPrimeKey(((LeaveTypeEditListModel)EditRecordDataSource).LeaveTypeID);

                if (SaveModel == null)
                {
                    Paras.SavingResult = new SavingResult();
                    Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError;
                    Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another user.";
                    return;
                }
            }

            SaveModel.LeaveTypeName      = txtLeaveTypeName.Text;
            SaveModel.AnnualEntitledDays = Model.CommonFunctions.ParseDecimal(txtAnnualEntitledDays.Text);
            SaveModel.ApplicableTo       = (byte)cmbApplicableTo.SelectedIndex;
            SaveModel.Notes                = txtNotes.Text;
            SaveModel.IsEncashable         = cmbEncashable.SelectedIndex == 0;
            SaveModel.CanCarryForward      = cmbCarryForwardable.SelectedIndex == 0;
            SaveModel.IncludeWeekend       = cmbIncludeWeekend.SelectedIndex == 0;
            SaveModel.IncludePublicHoliday = cmbIncludePublicHoliday.SelectedIndex == 0;
            SaveModel.Distribute           = (byte)cmbLeaveDistribution.SelectedIndex;

            Paras.SavingResult = DALObject.SaveNewRecord(SaveModel);
            base.SaveRecord(Paras);
        }
Beispiel #2
0
 private void lookupLeaveType_EditValueChanged(object sender, EventArgs e)
 {
     UpdateBalance();
     if (lookupLeaveType.EditValue != null)
     {
         SelectedLeaveType = LeaveTypeDALObj.FindSaveModelByPrimeKey((int)lookupLeaveType.EditValue);
     }
     else
     {
         SelectedLeaveType = null;
     }
     LoadDayDetail();
 }