/// <summary> /// Class Constructor /// </summary> /// <param name="view">isntance of the phone listing view</param> public PhoneListingViewModel(IPhoneListingView view) { _view = view; _employeeModel = new EmployeeModel(); _customerModel = new CustomerModel(); _divisionModel = new DivisionModel(); }
public void BindCustomer() { CustomerModel customerModel = new CustomerModel(); //_view.AllContactsList = customerModel.ListAllContacts(_view.FilterType, _view.FilterValue); _view.CustomerList = SortCustomer(customerModel.ListAllCustomers(_view.FilterType, _view.FilterValue)); }
/// <summary> /// Class Constructor /// </summary> /// <param name="view">Instance of the CustomerInfo View Interface</param> public CustomerInfoPresenter(ICustomerInfoView view) { this._view = view; this._customerModel = new CustomerModel(); this._divisionModel = new DivisionModel(); this._employeeModel = new EmployeeModel(); this._jobModel = new JobModel(); }
public void TestGetContactById() { //Arrange CustomerModel model = new CustomerModel(new FakeUnitOfWork()); //Act CS_Contact result = model.GetContactById(1); //Assert Assert.IsNotNull(result); }
/// <summary> /// Class Constructor /// </summary> /// <param name="view">Instance of the Permit Info View Interface</param> public JobInfoPresenter(IJobInfoView view) { this._view = view; this._jobModel = new JobModel(); this._divisionModel = new DivisionModel(); this._customerModel = new CustomerModel(); this._employeeModel = new EmployeeModel(); _resourceAllocationModel = new ResourceAllocationModel(); }
public void TestListAllFilteredContacts() { //Arrange CustomerModel model = new CustomerModel(new FakeUnitOfWork()); //Act IList<CS_Contact> resultList1 = model.ListAllFilteredContacts(1, true); //Assert Assert.AreEqual(2, resultList1.Count); }
public CustomerMaintenancePresenter(ICustomerMaintenanceView view) { _view = view; _customerMaintenanceViewModel = new CustomerMaintenanceViewModel(view); _customerModel = new CustomerModel(); _employeeModel = new EmployeeModel(); }
public void ListAllCustomerContactByName() { try { _customerModel = new CustomerModel(); _view.ContactList = _customerModel.ListAllFilteredContactsByName(Int32.Parse(_view.ContextKey), _view.PrefixText); } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to load the Contact Information!\n{0}\n{1}", ex.Message, ex.StackTrace)); } }
public void CheckExistingCustomer() { try { using (_customerModel = new CustomerModel()) { _view.IsNeWCompany = _customerModel.GetCustomerByName(_view.CustomerName); } } catch (Exception ex) { Logger.Write(string.Format("An error has ocurred while trying to Load customer information!\n{0}\n{1}", ex.Message, ex.StackTrace)); } }
/// <summary> /// Service logic method /// </summary> /// <param name="arg"></param> private void DoWork(object arg) { for (; ; ) { if (dynamicsImportStop.WaitOne(20000)) return; try { CustomerModel customerModel = new CustomerModel(); customerModel.ServiceWork(); } catch (Exception ex) { SettingsModel settings = new SettingsModel(); Logger.Write(string.Format("An error has ocurred while running the Dynamics Import Service!\n{0}\n{1}", ex.Message, ex.StackTrace)); StringBuilder mailError = new StringBuilder(); mailError.AppendLine(string.Format("An error has ocurred while running the Dynamics Import Service!\n{0}\n{1}", ex.Message, ex.StackTrace)); //MailUtility.SendMail(settings.GetITEmailOnError(), "", "", mailError.ToString(), "Dynamics Import Service - Error occured on Contact Information", false, null); } //Logger.Write("Test log Service"); } }
/// <summary> /// Class Constructor /// </summary> /// <param name="view">Instance of Customer Request View</param> public CustomerRequestPresenter(ICustomerRequestView view) { _view = view; _customerModel = new CustomerModel(); }
public void SaveContact() { CustomerModel contactModel = new CustomerModel(); List<PhoneNumberVO> numbers = _view.AdditionalContactPhoneList; CS_Contact contact = new CS_Contact() { Attn = _view.ContactAttn, Name = _view.ContactName, LastName = _view.ContactLastName, Alias = _view.ContactAlias, Address1 = _view.ContactAddress, Address2 = _view.ContactAddress2, State = _view.ContactState, City = _view.ContactCity, Country = _view.ContactCountry, Zip = _view.ContactZipcode, HomePhoneCodeArea = _view.ContactHomePhoneCodeArea, Phone = _view.ContactHomePhone, FaxCodeArea = _view.ContactFaxPhoneCodeArea, Fax = _view.ContactFaxPhone, Email = _view.ContactEmail, BillName = _view.ContactBillingName, BillAddress1 = _view.ContactBillingAddress, BillAddress2 = _view.ContactBillingAddress2, BillAttn = _view.ContactBillingAttn, BillState = _view.ContactBillingState, BillCity = _view.ContactBillingCity, BillCountry = _view.ContactBillingCountry, BillingHomePhoneCodeArea = _view.ContactBillingHomePhoneCodeArea, BillPhone = _view.ContactBillingHomePhone, BillFaxCodeArea = _view.ContactBillingFaxPhoneCodeArea, BillFax = _view.ContactBillingFaxPhone, BillSalutation = _view.ContactBillingSalutation, //BillThruProject = _view.ContactBillingThruProject, BillZip = _view.ContactBillingZipcode, CountryID = 1, Webpage = _view.ContactWebpage, IMAddress = _view.ContactIMAddress, DynamicsContact = _view.ContactType.Value }; if (_view.ContactId.HasValue) { contact.ID = _view.ContactId.Value; } _view.SaveMessage = contactModel.SaveContact(_view.ContactCustomerID, contact, numbers, _view.UserName); if (_view.NewContact) _view.SavedContact = contact; }
/// <summary> /// List All added contacts /// </summary> public void ListAllAddedContacts() { try { using (_customerModel = new CustomerModel()) { IList<CS_Contact> contacts = _customerModel.ListAllAddedContact(_view.CallID.Value, (int)Globals.CallEntry.CallLogResourceType.Contact); for (int i = 0; i < contacts.Count; i++) { CS_Contact contact = contacts[i]; _view.SelectedPersons.Add(new CS_CallLogResource() { ContactID = contact.ID, CS_Contact = contact }); } } } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to List all Contacts.\n{0}\n{1}", ex.Message, ex.StackTrace)); _view.DisplayMessage("An Internal Error has ocurred while trying to load the Information. Please try again.", false); } }
public void BindContactsByCustomer() { CustomerModel customerModel = new CustomerModel(); _view.ContactList = SortContact(_view.AllContactsList.Where(e => e.CS_Customer_Contact.Any(f => f.CustomerID == _view.CustomerRowCustomerID)).ToList()); }
/// <summary> /// Load data for call criteria /// </summary> public void ListAllEmployeeCallLogInfoCallCriteria() { try { if (_view.JobId.HasValue && _view.CallID.HasValue) { IList<CS_CallLogResource> resources = new List<CS_CallLogResource>(); using (_callLogModel = new CallLogModel()) { resources = _callLogModel.ListCallLogResourceByCallEntry(_view.CallID.Value); } List<CallCriteriaResourceVO> source = new List<CallCriteriaResourceVO>(); for (int i = 0; i < resources.Count; i++) { if (resources[i].Type == (int)Globals.CallCriteria.EmailVOType.Employee) { using (_employeeModel = new EmployeeModel()) { source.Add(_employeeModel.GetEmployeeDataForInitialAdvise(resources[i].EmployeeID.Value, _view.CallID.Value)); } } else { using (_customerModel = new CustomerModel()) { source.Add(_customerModel.GetContactDataForInitialAdvise(resources[i].ContactID.Value, _view.CallID.Value)); } } } _view.PersonInitialAdviseGridDataSource = source; } else { IList<EmailVO> resourceList = new List<EmailVO>(); List<CallCriteriaResourceVO> source = new List<CallCriteriaResourceVO>(); List<int> callCriteriasIDs = new List<int>(); using (_callCriteriaModel = new CallCriteriaModel()) { resourceList = _callCriteriaModel.ListReceiptsByCallLog(_view.SelectedCallType.ID.ToString(), _view.JobId.Value, null, out callCriteriasIDs); _view.CallCriteriaIDs = callCriteriasIDs; } for (int i = 0; i < resourceList.Count; i++) { if (resourceList[i].Type == (int)Globals.CallCriteria.EmailVOType.Employee) { using (_employeeModel = new EmployeeModel()) { source.Add(_employeeModel.GetEmployeeDataForInitialAdvise(resourceList[i].PersonID)); } } else { using (_customerModel = new CustomerModel()) { source.Add(_customerModel.GetContactDataForInitialAdvise(resourceList[i].PersonID)); } } } _view.PersonInitialAdviseGridDataSource = source; } } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to List .\n{0}\n{1}", ex.Message, ex.StackTrace)); _view.DisplayMessage("An Internal Error has ocurred while trying to load the Information. Please try again.", false); } }
public void CustomerIsCollection() { try { using (_customerModel = new CustomerModel()) { CS_Customer customer = _customerModel.GetCustomerById(_view.CustomerId); if (null != customer) _view.IsCostumerCollection = customer.IsCollection; else _view.IsCostumerCollection = false; } } catch (Exception ex) { if (null != ex.InnerException) Logger.Write(string.Format("An error has occurred while trying to check if the customer is collection\n{0}\n{1}\n{2}\n{3}", ex.Message, ex.StackTrace, ex.InnerException.Message, ex.InnerException.StackTrace)); else Logger.Write(string.Format("An error has occurred while trying to check if the customer is collection\n{0}\n{1}", ex.Message, ex.StackTrace)); } }
public void SaveCustomer() { CustomerModel customerModel = new CustomerModel(); CS_Customer customer = new CS_Customer() { Attn = _view.CustomerAttn, Name = _view.CustomerName, Address1 = _view.CustomerAddress1, Address2 = _view.CustomerAddress2, State = _view.CustomerState, City = _view.CustomerCity, Country = _view.CustomerCountry, Zip = _view.CustomerZipCode, HomePhoneCodeArea = _view.CustomerHomePhoneCodeArea, Phone = _view.CustomerHomePhone, FaxCodeArea = _view.CustomerFaxPhoneAreaCode, Fax = _view.CustomerFaxPhone, Email = _view.CustomerEmail, BillName = _view.CustomerBillingName, BillAddress1 = _view.CustomerBillingAddress1, BillAddress2 = _view.CustomerBillingAddress2, BillAttn = _view.CustomerBillingAttn, BillState = _view.CustomerBillingState, BillCity = _view.CustomerBillingCity, BillCountry = _view.CustomerBillingCountry, BillingHomePhoneCodeArea = _view.CustomerBillingHomePhoneAreaCode, BillPhone = _view.CustomerBillingHomePhone, BillFaxCodeArea = _view.CustomerBillingFaxPhoneCodeArea, BillFax = _view.CustomerBillingFaxPhone, BillSalutation = _view.CustomerBillingSalutation, BillThruProject = _view.CustomerThruProject, BillZip = _view.CustomerBillingZipCode, AlertNotification = _view.CustomerAlertNotification, OperatorAlert = _view.CustomerOperatorAlert, CreditCheck = _view.CustomerCreditCheck, IMAddress = _view.CustomerIMAddress, Webpage = _view.CustomerWebpage, CountryID = 1, IsGeneralLog = false, CreatedBy = _view.UserName, CreationDate = DateTime.Now, ModifiedBy = _view.UserName, ModificationDate = DateTime.Now, Active = true, IsCollection = _view.CustomerCollection }; if (_view.CustomerID.HasValue) { customer.ID = _view.CustomerID.Value; } _view.SaveMessage = customerModel.SaveCustomer(customer, _view.selectedCustomerSpecificInfoType,_view.UserName); if (_view.NewCustomer) _view.SavedCustomer = customer; }
/// List all Customers in the Database and fill the Dropdown /// </summary> public void ListCustomerByName() { try { _customerModel = new CustomerModel(); _view.CustomerList = _customerModel.ListCustomerByName(_view.PrefixText).OrderBy(e => e.FullCustomerInformation).ToList(); } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to load the Customer Information!\n{0}\n{1}", ex.Message, ex.StackTrace)); } }
/// <summary> /// Add Contact to a selected contact list /// </summary> public void AddContactToCallEntry() { try { using (_customerModel = new CustomerModel()) { CS_Contact contact = _customerModel.GetContactById(_view.SelectedContactId); _view.SelectedPersons.Add(new CS_CallLogResource() { ContactID = contact.ID, CS_Contact = contact }); } } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to AddContactToCallEntry.\n{0}\n{1}", ex.Message, ex.StackTrace)); _view.DisplayMessage("An Internal Error has ocurred while trying to load the Information. Please try again.", false); } }
public void GetJob() { try { if (_view.JobId.HasValue) { CS_CustomerInfo customerInfo = null; using (_model = new JobModel()) { _view.Job = _model.GetJobById(_view.JobId.Value); } using (_model = new JobModel()) { _view.SpecialPricingEntity = _model.GetSpecialPricing(_view.JobId.Value); _view.PresetInfoEntity = _model.GetPresetInfo(_view.JobId.Value); _view.LostJobEntity = _model.GetLostJob(_view.JobId.Value); _view.JobDivisionEntityList = _model.ListJobDivision(_view.JobId.Value); _view.JobDescriptionEntity = _model.GetJobDescriptionByJobId(_view.JobId.Value); if (null != _view.Job.CS_JobInfo && !string.IsNullOrEmpty(_view.Job.CS_JobInfo.CustomerSpecificInfo)) _view.CustomerSpecificFields = CustomerSpecificInfo.DeserializeObject(_view.Job.CS_JobInfo.CustomerSpecificInfo); customerInfo = _model.GetCustomerInfoByJobId(_view.JobId.Value); } using (_customerModel = new CustomerModel()) { if (null != customerInfo) _view.CustomerContract = _customerModel.ListAllCustomerContracts(customerInfo.CustomerId); } } } catch (Exception ex) { Logger.Write(string.Format("An error has occurred while trying to load Job Info section!\n{0}\n{1}", ex.Message, ex.StackTrace)); _view.DisplayMessage("An error has occurred while trying to load Job Info Section.", false); } }
public void CustomerHasOperatorAlert() { try { using (_customerModel = new CustomerModel()) { CS_Customer customer = _customerModel.GetCustomerById(_view.CustomerId); if (null != customer && customer.OperatorAlert.HasValue && customer.OperatorAlert.Value) _view.OperatorAlertMessage = "Operator Alert: " + customer.AlertNotification; else _view.OperatorAlertMessage = ""; } } catch (Exception ex) { if (null != ex.InnerException) Logger.Write(string.Format("An error has occurred while trying to check if the customer is collection\n{0}\n{1}\n{2}\n{3}", ex.Message, ex.StackTrace, ex.InnerException.Message, ex.InnerException.StackTrace)); else Logger.Write(string.Format("An error has occurred while trying to check if the customer is collection\n{0}\n{1}", ex.Message, ex.StackTrace)); } }
public void Dispose() { _customerModel.Dispose(); _employeeModel.Dispose(); _employeeModel = null; _customerModel = null; }
/// List all Customers in the Database and fill the Dropdown /// </summary> public void ListCustomerByNameJSON() { try { using (_customerModel = new CustomerModel()) { _view.CustomerList = _customerModel.ListCustomerByName(_view.FilterText); } } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to load the Customer Information!\n{0}\n{1}", ex.Message, ex.StackTrace)); } }
public void GetCustomerByContact() { try { using (_customerModel = new CustomerModel()) { CS_Customer customer = _customerModel.GetCustomerByContact(_view.ContactId); if (null != customer) { _view.ReturnDataObject = new Globals.SampleDataObject(); _view.ReturnDataObject.Id = customer.ID; _view.ReturnDataObject.Name = customer.Name; } } } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to get Customer by Contact.\n{0}\n{1}", ex.Message, ex.StackTrace)); } }
/// <summary> /// Filter the persons to Advise grid based on filter type and value /// </summary> public void FilterContactOrEmployee() { try { List<object> GenericList = new List<object>(); using (_customerModel = new CustomerModel()) { using (_employeeModel = new EmployeeModel()) { switch (_view.TypeOfPerson) { case Globals.CallEntry.typeOfPerson.Contact: if (_view.CustomerId.HasValue) GenericList.AddRange(_customerModel.ListAllFilteredContacts(_view.FilteredEmployeeCustomerName, _view.CustomerId.Value)); break; case Globals.CallEntry.typeOfPerson.Employee: GenericList.AddRange(_employeeModel.ListAllFilteredEmployee(_view.FilteredEmployeeCustomerName)); break; case Globals.CallEntry.typeOfPerson.Both: if (_view.CustomerId.HasValue) GenericList.AddRange(_customerModel.ListAllFilteredContacts(_view.FilteredEmployeeCustomerName, _view.CustomerId.Value)); GenericList.AddRange(_employeeModel.ListAllFilteredEmployee(_view.FilteredEmployeeCustomerName)); break; } _view.PersonGridDataSource = GenericList; } } } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to load the contact list.\n{0}\n{1}", ex.Message, ex.StackTrace)); _view.DisplayMessage("An Internal Error has ocurred while trying to load the contact list.", false); } }
/// <summary> /// Class constructor /// </summary> /// <param name="view">Instance of the ContractDetail View Interface</param> public ContractDetailPresenter(IContractDetailView view) { this._view = view; this._model = new CustomerModel(); }
public void ListDynamicsContactByName() { try { using (_customerModel = new CustomerModel()) { _view.DynamicsContactList = _customerModel.ListFilteredContactsByName(long.Parse(_view.FilterValue), true, _view.FilterText); } } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to load the Contact Information!\n{0}\n{1}", ex.Message, ex.StackTrace)); } }
private void BindList() { CustomerModel customerModel; EmployeeModel employeeModel; LocationModel locationModel; DivisionModel divisionModel; JobModel jobModel; CallLogModel callLogModel; EquipmentModel equipmentModel; IList<CS_Customer> customerDataSource; IList<CS_Contact> contactDataSource; IList<CS_Employee> employeeDataSource; IList<CS_JobStatus> jobStatusDataSource; IList<CS_City> cityDataSource; IList<CS_Division> divisionDataSource; IList<CS_PriceType> priceTypeDataSource; IList<CS_JobAction> jobActionDataSource; IList<CS_Job> jobNumberDataSource; IList<CS_ZipCode> zipCodeDataSource; IList<CS_State> stateDataSource; IList<CS_CallType> callTypeDataSource; IList<CS_EquipmentType> equipmentTypeDataSource; IList<CS_Equipment> equipmentDataSource; IList<CS_LocalEquipmentType> localEquipmentTypeDataSource; switch (Request.QueryString["AutoCompleteSource"]) { case "Customer": customerModel = new CustomerModel(); customerDataSource = customerModel.ListAllCustomers().OrderBy(e => e.Name).ToList(); ViewStateList = customerDataSource; break; case "Contact": customerModel = new CustomerModel(); contactDataSource = customerModel.ListAllFilteredContactsByName(long.Parse(Request.QueryString["FilterId"]), "").OrderBy(e => e.LastName).ThenBy(e => e.Name).ToList(); ViewStateList = contactDataSource; break; case "DynamicsContact": customerModel = new CustomerModel(); contactDataSource = customerModel.ListFilteredContactsByName(long.Parse(Request.QueryString["FilterId"]), true, "").OrderBy(e => e.Attn).ToList(); ViewStateList = contactDataSource; break; case "CustomerServiceContact": customerModel = new CustomerModel(); contactDataSource = customerModel.ListFilteredContactsByName(long.Parse(Request.QueryString["FilterId"]), false, "").OrderBy(e => e.LastName).ThenBy(e => e.Name).ToList(); ViewStateList = contactDataSource; break; case "Employee": employeeModel = new EmployeeModel(); if (Request.QueryString["FilterId"] != "0") employeeDataSource = employeeModel.ListAllFilteredEmployee(long.Parse(Request.QueryString["FilterId"])).OrderBy(e => e.CS_Division.Name).ThenBy(e => e.FullName).ToList(); else employeeDataSource = employeeModel.ListAllEmployee().OrderBy(e => e.CS_Division.Name).ThenBy(e => e.FullName).ToList(); ViewStateList = employeeDataSource; break; case "EmployeeWithDivision": employeeModel = new EmployeeModel(); if (Request.QueryString["FilterId"] != "0") employeeDataSource = employeeModel.ListAllFilteredEmployee(long.Parse(Request.QueryString["FilterId"])).OrderBy(e => e.CS_Division.Name).ThenBy(e => e.FullName).ToList(); else employeeDataSource = employeeModel.ListAllEmployee().OrderBy(e => e.CS_Division, new Globals.JobRecord.EmployeeComparer()).ThenBy(e => e.FullName).ToList(); ViewStateList = employeeDataSource; break; case "JobStatus": jobModel = new JobModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0") { jobStatusDataSource = new List<CS_JobStatus>(); jobStatusDataSource.Add(jobModel.GetJobStatus(int.Parse(Request.QueryString["FilterId"]))); } else jobStatusDataSource = jobModel.ListAllJobStatus(); ViewStateList = jobStatusDataSource; break; case "JobStatusJobRecord": jobModel = new JobModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0" && Request.QueryString["FilterId"] != Globals.JobRecord.JobStatus.ClosedHold.ToString()) { jobStatusDataSource = new List<CS_JobStatus>(); jobStatusDataSource.Add(jobModel.GetJobStatus(int.Parse(Request.QueryString["FilterId"]))); } else { jobStatusDataSource = jobModel.ListAllJobStatus(); if (jobStatusDataSource.Count > 0) { CS_JobStatus jobStatus = jobStatusDataSource.Where(w => w.ID == (int)Globals.JobRecord.JobStatus.ClosedHold).FirstOrDefault(); if (null != jobStatus) jobStatusDataSource.Remove(jobStatus); } } ViewStateList = jobStatusDataSource; break; case "State": locationModel = new LocationModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString.Get("FilterId") != "0") stateDataSource = locationModel.GetStateByCountryId(int.Parse(Request.QueryString.Get("FilterId"))); else stateDataSource = locationModel.ListAllStates(); ViewStateList = stateDataSource; break; case "StateByDivision": locationModel = new LocationModel(); stateDataSource = locationModel.ListAllStatesByAllocatedDivision(); ViewStateList = stateDataSource; break; case "City": locationModel = new LocationModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString.Get("FilterId") != "0") cityDataSource = locationModel.GetCityByState(int.Parse(Request.QueryString.Get("FilterId"))).OrderBy(e => e.Name).ToList(); else cityDataSource = locationModel.ListAllCities().OrderBy(e => e.Name).ToList(); ViewStateList = cityDataSource; break; case "Division": divisionModel = new DivisionModel(); divisionDataSource = divisionModel.ListAllDivision(); ViewStateList = divisionDataSource; break; case "PriceType": jobModel = new JobModel(); priceTypeDataSource = jobModel.ListAllPriceTypes(); ViewStateList = priceTypeDataSource; break; case "JobAction": jobModel = new JobModel(); jobActionDataSource = jobModel.ListAllJobActions().OrderBy(w => w.Description).ToList(); ViewStateList = jobActionDataSource; break; case "ZipCode": locationModel = new LocationModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString.Get("FilterId") != "0") zipCodeDataSource = locationModel.GetZipCodeByCityId(int.Parse(Request.QueryString.Get("FilterId"))).OrderBy(e => e.ZipCodeNameEdited).ToList(); else zipCodeDataSource = locationModel.ListAllZipCodes(); ViewStateList = zipCodeDataSource; break; case "JobNumber": jobModel = new JobModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0") { jobNumberDataSource = new List<CS_Job>(); jobNumberDataSource.Add(jobModel.GetJobById(int.Parse(Request.QueryString["FilterId"]))); } else jobNumberDataSource = jobModel.ListAllJobs(); ViewStateList = jobNumberDataSource; break; case "JobNumberByStatus": jobModel = new JobModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0") { jobNumberDataSource = new List<CS_Job>(); jobNumberDataSource = jobModel.ListAllJobsByNumber("", Request.QueryString["FilterId"]); } else jobNumberDataSource = jobModel.ListAllJobs(); ViewStateList = jobNumberDataSource; break; case "JobNumberWithGeneral": jobModel = new JobModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0") { jobNumberDataSource = new List<CS_Job>(); jobNumberDataSource.Add(jobModel.GetJobById(int.Parse(Request.QueryString["FilterId"]))); } else { List<CS_Job> source = new List<CS_Job>(); source.Add(jobModel.GetGeneralJob()); source.AddRange(jobModel.ListAllJobs()); jobNumberDataSource = source; } ViewStateList = jobNumberDataSource; break; case "BillableJobNumber": jobModel = new JobModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0") { jobNumberDataSource = new List<CS_Job>(); jobNumberDataSource.Add(jobModel.GetJobById(int.Parse(Request.QueryString["FilterId"]))); } else jobNumberDataSource = jobModel.ListAllBillableJobs(); ViewStateList = jobNumberDataSource; break; case "CallType": callLogModel = new CallLogModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0") { callTypeDataSource = new List<CS_CallType>(); callTypeDataSource.Add(callLogModel.GetCallType(int.Parse(Request.QueryString["FilterId"]))); } else callTypeDataSource = callLogModel.ListAllCallType(); ViewStateList = callTypeDataSource; break; case "EquipmentType": equipmentModel = new EquipmentModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0") { equipmentTypeDataSource = new List<CS_EquipmentType>(); equipmentTypeDataSource.Add(equipmentModel.GetEquipmentType(int.Parse(Request.QueryString["FilterId"]))); } else equipmentTypeDataSource = equipmentModel.ListAllEquipmentType(); ViewStateList = equipmentTypeDataSource; break; case "Equipment": equipmentModel = new EquipmentModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0") { equipmentDataSource = new List<CS_Equipment>(); equipmentDataSource = equipmentModel.GetEquipmentByEqType(int.Parse(Request.QueryString["FilterId"])).OrderBy(w => w.Name).ToList(); } else equipmentDataSource = equipmentModel.ListAllEquipment().OrderBy(w => w.Name).ToList(); ; ViewStateList = equipmentDataSource; break; case "LocalEquipmentType": equipmentModel = new EquipmentModel(); if (!string.IsNullOrEmpty(Request.QueryString.Get("FilterId")) && Request.QueryString["FilterId"] != "0") { localEquipmentTypeDataSource = new List<CS_LocalEquipmentType>(); localEquipmentTypeDataSource.Add(equipmentModel.GetLocalEquipmentTypeByID(int.Parse(Request.QueryString["FilterId"]))); } else localEquipmentTypeDataSource = equipmentModel.ListAllLocalEquipmentType(); ViewStateList = localEquipmentTypeDataSource; break; case "ProjectManager": employeeModel = new EmployeeModel(); employeeDataSource = employeeModel.ListAllEmployeeProjectManager(); ViewStateList = employeeDataSource; break; default: break; } }
public void ListCustomers() { try { if (_view.FilterList.Count > 0) { using (_customerModel = new CustomerModel()) { _view.CustomerList = _customerModel.ListCustomerByIds(_view.FilterList); } } else _view.CustomerList = new List<CS_Customer>(); } catch (Exception ex) { Logger.Write(string.Format("An Error has ocurred while trying to load the customer list.\n{0}\n{1}", ex.Message, ex.StackTrace)); _view.DisplayMessage("An Internal Error has ocurred while trying to load the company list.", false); } }
public void GetContactName() { string name = "--"; if (_view.Identifier.HasValue) { using (_customerModel = new CustomerModel()) { name = _customerModel.GetContactById(_view.Identifier.Value).FullContactInformation; } } _view.ParamName = name; }