Beispiel #1
0
 protected virtual void ShowMessage(IDataManager dataManager)
 {
     if (dataManager.IsSuccess)
     {
         MsgHelpers.ShowInfo(this, dataManager.Message);
         Close();
         MaintainData.RefreshList();
     }
     else
     {
         MsgHelpers.ShowError(this, "Error", dataManager.Message);
     }
 }
 protected override void Save()
 {
     try
     {
         base.Save();
         CurrentDate = DateTime.Now;
         var payrollgroup = PopulatePayrollGroupModelFromInterface();
         payrollgroup.ListPayrollItemModel = PopulatePayrolItem();
         using (var facade = new PayrollGroupCore())
         {
             // TODO SAVE TRANSACTION
             facade.Save(payrollgroup);
         }
     }
     catch (Exception err)
     {
         MsgHelpers.ShowError(this, err);
     }
 }
 private void PopulateInterfaceFromModel(int id)
 {
     using (var facade = new PositionModuleCore())
     {
         var positionModel = facade.Get <IPositionModel>(WhereTerm.DefaultParam(id, "ID")).FirstOrDefault();
         if (positionModel == null || !facade.IsSuccess)
         {
             MsgHelpers.ShowError(this, string.IsNullOrEmpty(facade.Message) ? "Employee Position not found" : facade.Message);
             return;
         }
         createdBy.Text     = positionModel.CreatedBy;
         createdDate.Value  = positionModel.CreatedDate;
         recordId.Text      = positionModel.Id.ToString();
         positionName.Text  = positionModel.PositionName;
         createdBy.Text     = positionModel.CreatedBy;
         createdDate.Value  = positionModel.CreatedDate;
         modifiedBy.Text    = positionModel.ModifiedBy;
         modifiedDate.Value = positionModel.ModifiedDate.HasValue ? positionModel.ModifiedDate.Value : DateTime.Now;
     }
 }
Beispiel #4
0
 private void PopulateInterfaceFromModel(int id)
 {
     using (var facade = new EmployeeCore())
     {
         var employee = facade.Get <IEmployeeModel>(WhereTerm.DefaultParam(id, "ID")).FirstOrDefault();
         if (employee == null || !facade.IsSuccess)
         {
             MsgHelpers.ShowError(this, string.IsNullOrEmpty(facade.Message) ? "Employee not found" : facade.Message);
             return;
         }
         address.Text              = employee.Address;
         bankAccount.Text          = employee.BankAccount;
         bankName.Text             = employee.BankName;
         birthDate.Value           = employee.BirthDate;
         cityName.Text             = employee.City;
         createdBy.Text            = employee.CreatedBy;
         createdDate.Value         = employee.CreatedDate;
         firstName.Text            = employee.FirstName;
         gender.Text               = employee.Gender;
         hireDate.Value            = employee.HiredDate;
         recordId.Text             = employee.Id.ToString(CultureInfo.InvariantCulture);
         lastName.Text             = employee.LastName;
         maritalStatus.Text        = employee.MaritalStatus;
         middleName.Text           = employee.MiddleName;
         nationalIdNumber.Text     = employee.NationalIDNumber;
         payrollGroupCode.Text     = employee.PayrollGroupCode;
         positionName.Text         = employee.PositionName;
         postalCode.Text           = employee.PostalCode;
         stateName.Text            = employee.State;
         titleName.Text            = employee.Title;
         createdBy.Text            = employee.CreatedBy;
         createdDate.Value         = employee.CreatedDate;
         modifiedBy.Text           = employee.ModifiedBy;
         modifiedDate.Value        = employee.ModifiedDate.HasValue ? employee.ModifiedDate.Value : DateTime.Now;
         employeeId.Text           = employee.EmployeeID;
         isTerminate.Text          = employee.IsTerminate.ToString();
         terminateDate.Value       = employee.TerminateDate.HasValue ? employee.TerminateDate.Value : DateTime.Now;
         terminateDate.Checked     = employee.TerminateDate.HasValue;
         terminateDescription.Text = employee.TerminateDescription;
     }
 }
Beispiel #5
0
 private void PopulateInterfaceFromModel(int id)
 {
     using (var facade = new CityCore())
     {
         var city = facade.Get <ICityModel>(WhereTerm.DefaultParam(id, "ID")).FirstOrDefault();
         if (city == null || !facade.IsSuccess)
         {
             MsgHelpers.ShowError(this, string.IsNullOrEmpty(facade.Message) ? "Employee not found" : facade.Message);
             return;
         }
         recordId.Text     = city.Id.ToString();
         cityName.Text     = city.CityName;
         createdBy.Text    = city.CreatedBy;
         createdDate.Value = city.CreatedDate;
         modifiedBy.Text   = city.ModifiedBy;
         if (city.ModifiedDate != null)
         {
             modifiedDate.Value = (DateTime)city.ModifiedDate;
         }
     }
 }
 protected void ValidateOpenItem()
 {
     if (CurrentListView == null)
     {
         MsgHelpers.ShowError(this, "Data List not define");
         IsReadyEdited = false;
         return;
     }
     if (CurrentListView.Items.Count == 0)
     {
         MsgHelpers.ShowError(this, "No Data in List");
         IsReadyEdited = false;
         return;
     }
     if (CurrentListView.FocusedItem == null)
     {
         MsgHelpers.ShowError(this, "No item selected");
         IsReadyEdited = false;
         return;
     }
     IsReadyEdited = true;
 }
        protected virtual void BindDataSource <T>() where T : IBaseModel
        {
            if (DataManager == null)
            {
                MsgHelpers.ShowError(CMainForm, "Error", " paging manager is not initialized");
                return;
            }
            DataManager.ErrorEventHandler += DataManager_ErrorEventHandler;
            var source = PopulateDataSource <T>();

            if (source == null)
            {
                return;
            }
            Application.DoEvents();
            // TODO SET DATA SOURCE
            PopulateListView(source);
            if (lastButtonNavigator != null)
            {
                lastButtonNavigator.Enabled = true;
            }
        }
 void DataManager_ErrorEventHandler(object sender, OnErrorArgs e)
 {
     MsgHelpers.ShowError(this, e.CException.Message);
 }