private void ServicesMenuButton_Click(object sender, EventArgs e) { mainPanel.Controls.Clear(); ServicesControl servicesControl = new ServicesControl { Dock = DockStyle.Fill }; mainPanel.Controls.Add(servicesControl); UnderlineMenuButton(servicesMenuButton); }
public void getServicesOfFile(out string reason, out int? service, out List<int> parts, ref ServicesControl ucServicesControl) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { service = (ucServicesControl.SelectedService != ucServicesControl.OthersValue) ? ucServicesControl.SelectedService : null; parts = ucServicesControl.SelectedParts; if (service != null) { reason = null; } else { reason = ucServicesControl.ReasonValue; } } }
private int? getSelectedServiceEmployee(int? serviceId, string employeeId, ref ServicesControl ucServicesControl) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { if (serviceId == null || serviceId == ucServicesControl.OthersValue) { return null; } else { if (mc.BSI__Employee_Service_Set.Where(o => o.Service_Id == serviceId && o.Employee_Id == employeeId).Count() != 0) { return mc.BSI__Employee_Service_Set.Where(o => o.Service_Id == serviceId && o.Employee_Id == employeeId).First().Id; } else { return null; } } } }
private void createRemoveConnections(Medical_Clinic_Entities mc, int? selectedService, Guid petientId, long financialId, List<int> selectedParts, ref ServicesControl ucServicesControl, ref DropDownList ddlDoctor, ref DropDownList ddlTech) { var connectors = mc.Connectors.Where(o => o.FinancialId == financialId).ToList(); var petientFileId = connectors.First().FileId; var petientFileWriter = connectors.Where(o => o.RelationType == SharedClass.GetRelationType(SharedClass.RelationType.Writer)).FirstOrDefault(); var petientFileWriterId = (petientFileWriter == null) ? null : petientFileWriter.EmployeeId; //If was not NULL it means that a file has been created. //Writer if (petientFileWriterId != null) { ModelClass.RemoveConnectorObjectUsingFileId(petientFileId, SharedClass.RelationType.Writer); ModelClass.CreateConnectorObject( mc, SharedClass.CurrentUser, selectedService, getSelectedServiceEmployee(ucServicesControl.SelectedService, SharedClass.CurrentUser, ref ucServicesControl), petientId, petientFileId, financialId, SharedClass.RelationType.Writer ); } //Doctor ModelClass.RemoveConnectorObjectUsingFinancialId(financialId, SharedClass.RelationType.Doctor); if (ddlDoctor.SelectedValue.ToString() != "") { ModelClass.CreateConnectorObject( mc, ddlDoctor.SelectedValue, selectedService, getSelectedServiceEmployee(ucServicesControl.SelectedService, ddlDoctor.SelectedValue, ref ucServicesControl), petientId, petientFileId, financialId, SharedClass.RelationType.Doctor ); if (selectedParts != null) { ModelClass.CreateConnectorObject( mc, ddlDoctor.SelectedValue, selectedParts, petientId, petientFileId, financialId, SharedClass.RelationType.Doctor ); } } //Tech ModelClass.RemoveConnectorObjectUsingFinancialId(financialId, SharedClass.RelationType.Technician); if (ddlTech.SelectedValue.ToString() != "") { ModelClass.CreateConnectorObject( mc, ddlTech.SelectedValue, selectedService, getSelectedServiceEmployee(ucServicesControl.SelectedService, ddlTech.SelectedValue, ref ucServicesControl), petientId, petientFileId, financialId, SharedClass.RelationType.Technician ); if (selectedParts != null) { ModelClass.CreateConnectorObject( mc, ddlTech.SelectedValue, selectedParts, petientId, petientFileId, financialId, SharedClass.RelationType.Technician ); } } }
private int costOfService(int? serviceId, ref ServicesControl ucServicesControl) { int totalCost = 0; if (serviceId != null) { var servicePartIds = ucServicesControl.SelectedParts; if (servicePartIds != null) { using (Medical_Clinic_Entities mc = new Medical_Clinic_Entities()) { foreach (var partId in servicePartIds) { totalCost = totalCost + mc.BSI__Clinic_Services.Where(o => o.Id == partId).First().Cost; } totalCost = totalCost + mc.BSI__Clinic_Services.Where(o => o.Id == serviceId).First().Cost; } } return totalCost; } else { return totalCost; } }
public Result MakeChecking() { ErrorMessages.Clear(); var result = new Result() { ResultCode = ResultCode.Ok }; // Ping this._pingMsec = 0; try { using (Ping ping = new Ping()) { this._pingMsec = ping.Send(this.HostName).RoundtripTime; } } catch (Exception ex) { this._pingMsec = (int)ResultCode.CommonError; this.AddErrorMessage(ex, $"Ping of {this.HostName}"); } // Get IP try { this._ip = CommonUtils.GetIPAddressFromMachineName(this.HostName); } catch (Exception ex) { this.AddErrorMessage(ex, $"Getting IP of {this.HostName}"); } // Check Windows Services try { var servicesNames = OptionsHelper.GetWindowsServiceNamesToControl(this.HostName); if (servicesNames.Count != 0) { this.WindowsServicesStatus = ServicesControl.MakeChecking(this.HostName, servicesNames); } } catch (Exception ex) { this.AddErrorMessage(ex, $"Checking Windows Services of {this.HostName}"); } // Check disks status var disksInfo = new List <DiskDataModel>(); try { this.DisksData = DiskUtils.GetDrivesListOfRemoteMachine(this.HostName); } catch (Exception ex) { this.AddErrorMessage(ex, $"Checking disks status of {this.HostName} error"); } // Check Databases status this.IsNesseseryToCheckSqlBases = OptionsHelper.IsNessesaryToCheckDatabase(this.HostName); try { if (this.IsNesseseryToCheckSqlBases) { this.CheckingDatabaseResult = DataBaseUtils.CheckBases(this.HostName); if (!string.IsNullOrEmpty(this.CheckingDatabaseResult.ErrorMessage)) { this.AddErrorMessage(null, this.CheckingDatabaseResult.ErrorMessage); } } } catch (Exception ex) { this.AddErrorMessage(ex, $"Checking databases status of {this.HostName} error"); } return(result); }
private void LoadData() { try { var services = Model.Services.GetAllByUser(_user.Id); if (services == null || !services.Any()) { var service = new Service() { Name = "GPS навигатор", User = _user }; Model.Services.Post(service); var service1 = new Service() { Name = "Без депозита", User = _user }; Model.Services.Post(service1); var service2 = new Service() { Name = "Без ограничения пробега", User = _user }; Model.Services.Post(service2); var service3 = new Service() { Name = "Детское кресло", User = _user }; Model.Services.Post(service3); services = Model.Services.GetAllByUser(_user.Id); } _prokat = Model.Prokats.GetbyUser(_user.Id); //panelControlServices.Controls.Clear(); bool gray = true; foreach (var service in services) { var sc = new ServicesControl(service); panelControlServices.Controls.Add(sc); sc.Dock = DockStyle.Top; sc.BringToFront(); if (gray) { sc.SetSkin(); } gray = !gray; } var template = Model.Templates.GetbyUser(_user.Id); if (template != null) { textEditPath.Text = template.Path; _template = template; } if (_prokat != null) { textEditRName.Text = _prokat.Name; textEditRAddress.Text = _prokat.Address; textEditRPhones.Text = _prokat.Phones; textEditRTime.Text = _prokat.Worktime; } } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }