public void Details(TechSpecs item) { OfficeBindingSource.DataSource = new UnitOfWork().OfficesRepo.Get(); EmployeeBindingSource.DataSource = new UnitOfWork().EmployeesRepo.Get(); new UnitOfWork().EquipmentProfilesRepo.Get(m => m.RefId == item.Id && m.TableName == "TechSpecs"); //this.ActionGridControl.DataSource = // new UnitOfWork().DocActionsRepo.Get(m => m.RefId == item.Id && m.TableName == "TechSpecs"); var unitOfWork = new UnitOfWork(); //lblPODescription.Text = item.Id + " - " + item.EquipmentTypes?.EquipmentType; cboOffice.EditValue = item?.Employees?.OfficeId; txtChief.Text = item?.Employees?.Offices?.Chief; txtTel.Text = item?.Employees?.Offices?.Chief; cboEmployeeId.EditValue = item?.Employees?.Id; txtPosition.Text = item.Employees?.Position; cboOffice.EditValue = item.Employees?.Offices?.Id; txtTel.Text = item.Employees?.Offices?.TelNo; txtChief.Text = item.Employees?.Offices?.Chief; cboAssignedTo.EditValue = item.AssignedTo; dtDateRequest.EditValue = item.DateRequested; //this.ActionGridControl.DataSource = // unitOfWork.DocActionsRepo.Get(m => m.RefId == item.Id && m.TableName == "TechSpecs"); this.TechSpecsRequestDetailBindingSource.DataSource = unitOfWork.TechSpecRequestsRepo.Get(m => m.TechSpecsId == item.Id); this.DocumentBindingSource.DataSource = unitOfWork.DocumentsRepo.Get(m => m.RefId == item.Id && m.TableName == "TechSpecs"); }
private void btnEditPo_Click(object sender, EventArgs e) { if (!User.UserInAction("Edit Tech Spec")) { return; } if (UcTechSpecGrid.GridView.GetFocusedRow() is TechSpecs item) { this.oldData = item; this.oldSelectedRow = UcTechSpecGrid.GridView.FocusedRowHandle; frmAddEditTechSpecs frm = new frmAddEditTechSpecs() { frmTechSpecs = this, TechSpecsId = Convert.ToInt32((UcTechSpecGrid.GridView.GetFocusedRow() as TechSpecs)?.Id), MethodType = MethodType.Edit }; frm.ShowDialog(); UcTechSpecGrid.CreateUcControl(); TechSpecDetails.Details(item); lblPODescription.Text = item.TechSpecsId; ucTSEquipmentProfiles1.Details(item.Id, "TechSpecs"); UcTechSpecGrid.GridView.SelectRow(this.oldSelectedRow); UcTechSpecGrid.GridView.FocusedRowHandle = this.oldSelectedRow; UcTechSpecGrid.GridView.MakeRowVisible(oldSelectedRow); } }
void LoadTechSpecsDetails(TechSpecs item) { try { this.EquipmentProfileBindingSource.DataSource = new UnitOfWork().EquipmentProfilesRepo.Get(m => m.RefId == item.Id && m.TableName == "TechSpecs", orderBy: x => x.OrderBy(m => m.RowNumber)); new UnitOfWork().DocActionsRepo.Get(m => m.RefId == item.Id && m.TableName == "TechSpecs"); var unitOfWork = new UnitOfWork(); lblTechSpecNo.Text = item.Id.ToString("EPIS-0000"); this.TechSpecsRequestDetailBindingSource.DataSource = unitOfWork.TechSpecRequestsRepo.Get(m => m.TechSpecsId == item.Id); item = unitOfWork.TechSpecsRepo.Find(x => x.Id == item.Id); cboOffice.EditValue = item?.Employees?.OfficeId; txtChief.Text = item?.Employees?.Offices?.Chief; txtTel.Text = item?.Employees?.Offices?.Chief; cboEmployeeId.EditValue = item?.Employees?.Id; txtPosition.Text = item.Employees?.Position; cboOffice.EditValue = item.Employees?.Offices?.Id; txtTel.Text = item.Employees?.Offices?.TelNo; txtChief.Text = item.Employees?.Offices?.Chief; cboAssignedTo.EditValue = item.AssignedTo; dtDateRequest.EditValue = item.DateRequested; lblWONo.Text = item.WorkOrders?.WorkOrderId; cboWO.EditValue = item.WorOrderId; this.EquipmentProfileBindingSource.DataSource = unitOfWork.EquipmentProfilesRepo.Get(m => m.RefId == item.Id && m.TableName == "TechSpecs", orderBy: x => x.OrderBy(m => m.RowNumber)); } catch (Exception e) { MessageBox.Show(e.Message, "Load Tech Specs Details", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void Initialize() { this.dtDateRequest.EditValue = DateTime.Now; if (MethodType == MethodType.Edit) { UnitOfWork uow = new UnitOfWork(); var res = uow.EquipmentProfilesRepo .Fetch(x => x.RowNumber == null && x.RefId == TechSpecsId && x.TableName == "TechSpecs").Any(); if (res) { var rowNumber = 1; foreach (var i in uow.EquipmentProfilesRepo .Get(x => x.RefId == TechSpecsId && x.TableName == "TechSpecs")) { var eq = uow.EquipmentProfilesRepo.Find(x => x.Id == i.Id); eq.RowNumber = rowNumber; rowNumber++; uow.Save(); } } return; } try { using (UnitOfWork unitOfWork = new UnitOfWork()) { this.TechSpecsId = (unitOfWork.TechSpecsRepo.Fetch().Select(x => new { x.Id }).OrderByDescending(x => x.Id) .FirstOrDefault()?.Id ?? 0) + 1; var ts = new TechSpecs() { Id = TechSpecsId, WorOrderId = workOrders?.Id, Requestedby = workOrders?.RequestedBy, DateRequested = DateTime.Now }; unitOfWork.TechSpecsRepo.Insert(ts); unitOfWork.Save(); lblTechSpecNo.Text = TechSpecsId.ToString("EPIS-0000"); LoadTechSpecs(); LoadTechSpecsDetails(ts); } } catch (Exception e) { MessageBox.Show(e.Message, e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }