示例#1
0
        public AddWindow(Requests request, Service.Service service)
        {
            this.InitializeComponent();
            this.InitializeMembers(service);
            this.InitializeComboBoxes();

            // Fill TextBoxes
            this.textBoxClient.Text = request.Clients.FullName;
            this.textBoxAdress.Text = request.Address;
            this.textBoxComment.Text = request.Comment;

            // Fill ComboBoxes
            this.comboBoxServices.SelectedIndex     = this.comboBoxServices.FindStringExact(request.Services.Name);
            this.comboBoxOperators.SelectedIndex    = this.comboBoxOperators.FindStringExact(request.Operators.FullName);
            this.comboBoxMasters.SelectedIndex      = this.comboBoxMasters.FindStringExact(request.Masters.FullName);

            // Fill DateTimePickers
            this.dateTimePickerRequest.Value = request.RequestDate;
            this.dateTimePickerCloseRequest.Value = request.CloseDate ?? DateTime.Now;
            this.dateTimePickerDepature.Value = request.DateOfDeparture ?? DateTime.Now;

            this.buttonAdd.Text = "Изменить";
            this.isEditMode = true;
            this.requestToEdit = request;
        }
示例#2
0
文件: Service.cs 项目: Morgolt/qwerty
        public string CreateRequest(string clientName, int masterId, int operatorId, int serviceId, string comment,
            string adress, DateTime requestDate, DateTime closeDate, DateTime dateOfDeparture)
        {
            Clients client = new Clients();
            client.FullName = clientName;

            string message;
            this.secondaryRepo.CreateClient(client);
            message = "Заявка добавлена успешно";

            Requests request = new Requests();

            request.ClientId = client.Id;
            request.MasterId = masterId;
            request.OperatorId = operatorId;
            request.ServiceId = serviceId;
            request.Comment = comment;
            request.Address = adress;
            request.RequestDate = requestDate;
            request.CloseDate = closeDate;
            request.DateOfDeparture = dateOfDeparture;

            requestRepo.CreateRequest(request);
            return message;
        }
示例#3
0
 // TODO: FIX OR DELETE IT
 public void UpdateRequest(Requests request)
 {
     Requests req = db.Requests.Single(x => x.Id == request.Id);
     req.Address = request.Address;
     req.ClientId = request.ClientId;
     req.CloseDate = request.CloseDate;
     req.Comment = request.Comment;
     req.DateOfDeparture = request.DateOfDeparture;
     req.OperatorId = request.OperatorId;
     req.MasterId = request.MasterId;
     req.ServiceId = request.ServiceId;
     db.SubmitChanges();
 }
示例#4
0
 private void InitializeMembers(Service.Service service)
 {
     this.isEditMode = false;
     this.requestToEdit = null;
     this.service = service;
 }
示例#5
0
文件: Service.cs 项目: Morgolt/qwerty
        public string UpdateRequest(Requests request, string clientName, int masterId, int operatorId, int serviceId, string comment, 
            string adress, DateTime requestDate, DateTime closeDate, DateTime dateOfDeparture)
        {
            Clients client = new Clients();
            client.FullName = clientName;
            request.Clients = secondaryRepo.CreateClient(client);
            request.Masters = GetMasterExact(masterId);
            request.Operators = GetOperatorExact(operatorId);
            request.Services = GetServiceExact(serviceId);
            request.Address = adress;
            request.Comment = comment;
            request.RequestDate = requestDate;
            request.CloseDate = closeDate;
            request.DateOfDeparture = dateOfDeparture;

            requestDBContext.SubmitChanges();
            requestRepo.UpdateRequest(request);

            return "Заявка успешно изменена";
        }
		private void detach_Requests(Requests entity)
		{
			this.SendPropertyChanging();
			entity.Masters = null;
		}
		private void attach_Requests(Requests entity)
		{
			this.SendPropertyChanging();
			entity.Masters = this;
		}
 partial void DeleteRequests(Requests instance);
 partial void UpdateRequests(Requests instance);
示例#10
0
 partial void InsertRequests(Requests instance);
示例#11
0
 public void DeleteRequest(Requests request)
 {
     db.Requests.DeleteOnSubmit(request);
     db.SubmitChanges();
 }
示例#12
0
 public void CreateRequest(Requests request)
 {
     db.Requests.InsertOnSubmit(request);
     db.SubmitChanges();
 }