public async Task <IActionResult> Edit(int id, VendorView vendorView) { var vendor = _context.Vendors.Find(id); if (vendor == null) { return(NotFound()); } if (ModelState.IsValid) { try { vendor.Map(vendorView); _context.Update(vendor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorExists(vendor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(vendor)); }
private void GetValidToDate() { DataTable dtValid = new DataTable(); m_iVendorId = Convert.ToInt32(VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorId").ToString()); if (m_iVendorId > 0) { dtValid = m_oVendor.GetValidToDate(m_iVendorId); if (dtValid.Rows.Count > 0) { txtVSupplier.Text = dtValid.Rows[0][0].ToString(); txtVContractor.Text = dtValid.Rows[0][1].ToString(); txtVService.Text = dtValid.Rows[0][2].ToString(); } else { txtVSupplier.Text = ""; txtVContractor.Text = ""; txtVService.Text = ""; } } else { txtVSupplier.Text = ""; txtVContractor.Text = ""; txtVService.Text = ""; } }
public VendorView GetModel() { var model = new VendorView() { Title = "Vendor View" }; try { model.Items = _vendorRepository.TCMSDb.Vendors; model.Countries = _vendorRepository.TCMSDb.Countries.ToList(); model.Credentials = _vendorRepository.TCMSDb.Credentials.ToList(); model.Credits = _vendorRepository.TCMSDb.Credits.ToList(); model.Locations = _vendorRepository.TCMSDb.Locations.ToList(); model.Status = _vendorRepository.TCMSDb.Status.ToList(); model.TankAgencies = _vendorRepository.TCMSDb.TankAgencies.ToList(); model.VendorTypes = _vendorRepository.TCMSDb.VenodrTypes.ToList(); return(model); } catch (Exception ex) { _logger.Log(ex.Message, "In VenderService:GetModel", Logger.LogLevel.Fatal); return(model); } }
public static void VendorMap(this Vendor destination, VendorView source) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (destination == null) { throw new ArgumentNullException(nameof(destination)); } var now = DateTime.UtcNow; if (destination.CreatedAt == null) { destination.CreatedAt = now; } destination.Name = source.Name; destination.Address = source.Address; destination.Email = source.Email; destination.Phone = source.Phone; destination.ModifiedAt = now; destination.Active = source.Active; }
private void EditVendor() { if (BsfGlobal.FindPermission("Vendor-Master-Edit") == false) { MessageBox.Show("No Rights to Vendor-Master-Edit"); return; } if (VendorView.FocusedRowHandle < 0) { return; } int iVendorId = Convert.ToInt32(VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorId").ToString()); VendorName = VendorView.GetFocusedRowCellValue("VendorName").ToString(); int i = VendorView.RowCount - 1; if (BsfGlobal.g_bWorkFlow == true) { //try { this.Parent.Controls.Owner.Hide(); } //catch { } m_oGridMasterView = VendorView; m_oGridMasterView.FocusedRowHandle = VendorView.FocusedRowHandle; iRowId = VendorView.FocusedRowHandle; BsfGlobal.g_bWorkFlow = true; frmMain frm = new frmMain(); frm.m_lVendorId = iVendorId; frm.m_sVendorName = VendorName; m_oDW = (Telerik.WinControls.UI.Docking.DocumentWindow)BsfGlobal.g_oDock.ActiveWindow; m_oDW.Hide(); DevExpress.XtraEditors.PanelControl oPanel = new DevExpress.XtraEditors.PanelControl(); oPanel = BsfGlobal.GetPanel(frm, "Vendor Details"); if (oPanel != null) { oPanel.Controls.Clear(); frm.TopLevel = false; frm.FormBorderStyle = FormBorderStyle.None; frm.Dock = DockStyle.Fill; oPanel.Controls.Add(frm); frm.Execute(); oPanel.Visible = true; Cursor.Current = Cursors.Default; } } else { Cursor.Current = Cursors.WaitCursor; frmMain frm = new frmMain(); frm.m_lVendorId = iVendorId; frm.m_sVendorName = VendorName; frm.Execute(); Cursor.Current = Cursors.Default; } m_bAdd = true; m_iRowId = VendorView.FocusedRowHandle; }
public async Task <ActionResult <Vendor> > PostVendor(VendorView vendorView) { Vendor vendor = new Vendor(); vendor.VendorMap(vendorView); _context.Vendors.Add(vendor); await _context.SaveChangesAsync(); return(CreatedAtAction("GetVendor", new { id = vendor.Id }, vendor)); }
private void GetGradeDetails() { m_iVendorId = Convert.ToInt32(VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorId").ToString()); m_tSupplyGrade = new DataTable(); m_tContractGrade = new DataTable(); m_tServiceGrade = new DataTable(); m_tSupplyGrade = m_oRegister.GetGradeName(m_iVendorId, "S"); m_tContractGrade = m_oRegister.GetGradeName(m_iVendorId, "C"); m_tServiceGrade = m_oRegister.GetGradeName(m_iVendorId, "H"); if (m_tSupplyGrade != null) { if (m_tSupplyGrade.Rows.Count > 0) { txtGSupplier.Text = m_tSupplyGrade.Rows[0][1].ToString(); } else { txtGSupplier.Text = ""; } } else { txtGSupplier.Text = ""; } if (m_tContractGrade != null) { if (m_tContractGrade.Rows.Count > 0) { txtGContractor.Text = m_tContractGrade.Rows[0][1].ToString(); } else { txtGContractor.Text = ""; } } else { txtGContractor.Text = ""; } if (m_tServiceGrade != null) { if (m_tServiceGrade.Rows.Count > 0) { txtGService.Text = m_tServiceGrade.Rows[0][1].ToString(); } else { txtGService.Text = ""; } } else { txtGService.Text = ""; } }
public async Task <IActionResult> Create(VendorView vendorView) { Vendor vendor = new Vendor(); vendor.Map(vendorView); if (ModelState.IsValid) { _context.Add(vendor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(vendor)); }
public void PopulateVendor() { try { m_bAns = false; m_tVendor = new DataTable(); if (option == "fMain") { grdVendor.DataSource = null; VendorView.Columns.Clear(); } m_tVendor = m_oVendor.GetVendorList(); DataView dv; dv = new DataView(m_tVendor); if (toolStripFilter.EditValue != null) { if (toolStripFilter.EditValue.ToString() == "Supplier") { dv.RowFilter = "Supply = 1"; } if (toolStripFilter.EditValue.ToString() == "Sub Contractor") { dv.RowFilter = "Contract = true"; } if (toolStripFilter.EditValue.ToString() == "Service Provider") { dv.RowFilter = "Service = 1"; } } grdVendor.DataSource = dv.ToTable(); DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit txtVendor = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit(); VendorView.PopulateColumns(); VendorView.Columns[0].Visible = false; VendorView.Columns[1].Width = 230; VendorView.Columns[1].Caption = "Vendor Name"; VendorView.Columns[2].Visible = false; VendorView.Columns[3].Visible = false; VendorView.Columns[4].Visible = false; //VendorView.Columns[1].ColumnEdit = txtVendor; //VendorView.OptionsView.RowAutoHeight = true; m_bAns = true; } catch { } //if (grdVendor.RowCount <= 0) { panel3.Visible = false; } //else { grdVendor.Rows[0].Selected = true; } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (VendorView.FocusedRowHandle < 0) { return; } if (BsfGlobal.g_bAdminDB == true) { int m_iVenId = Convert.ToInt32(clsStatic.IsNullCheck(VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorId"), clsStatic.datatypes.vartypenumeric)); string m_sVenName = (clsStatic.IsNullCheck(VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorName"), clsStatic.datatypes.vartypestring)).ToString(); DMS.frmDocument frm = new DMS.frmDocument(); frm.Exe(19, m_iVenId, BsfGlobal.g_sVendorDBName, m_sVenName); } }
private void frmVendorMain_Activated(object sender, EventArgs e) { if (m_bAdd == true) { m_bAdd = false; PopulateVendor(); VendorView.FocusedRowHandle = m_iRowId; if (VendorView.FocusedRowHandle < 0) { return; } int iVendorId = Convert.ToInt32(VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorId").ToString()); lblVendor.Text = VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorName").ToString(); PopulateRegDetails(iVendorId); VendorView.FocusedColumn = VendorView.VisibleColumns[0]; } }
private void VendorView_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if (VendorView.FocusedRowHandle < 0) { return; } if (VendorView.RowCount == 1) { int iVendorId = Convert.ToInt32(VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorId").ToString()); lblVendor.Text = VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorName").ToString(); VendorName = VendorView.GetFocusedRowCellValue("VendorName").ToString(); PopulateRegDetails(iVendorId); GetGradeDetails(); GetValidToDate(); PopulateVendorGeneral(iVendorId); } }
private void GetFocusedRowData(int index) { if (index >= 0 && VendorView.RowCount > 0) { VendorView.FocusedRowHandle = index; btnSave.Enabled = false; btnAddNew.Enabled = btnModify.Enabled = btnDelete.Enabled = true; txtVendorCode.Text = VendorView.GetRowCellValue(index, VendorManager.VendorDetails.VendorCode.ToString()).ToString(); Vendor c = vendor.Get(int.Parse(txtVendorCode.Text)); txtVendorName.Text = c.Vendor_Name; txtAddress.Text = c.Address; City.EditValue = c.City_Code; txtMobile1.Text = c.Mobile1; txtMobile2.Text = c.Mobile2; txtEmail.Text = c.EMail; Group.EditValue = c.GroupCode; txtNotes.Text = c.Notes; } }
private void VendorView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (e.FocusedRowHandle < 0) { return; } int iVendorId = Convert.ToInt32(VendorView.GetRowCellValue(e.FocusedRowHandle, "VendorId").ToString()); lblVendor.Text = VendorView.GetRowCellValue(e.FocusedRowHandle, "VendorName").ToString(); VendorName = VendorView.GetFocusedRowCellValue("VendorName").ToString(); PopulateRegDetails(iVendorId); GetGradeDetails(); GetValidToDate(); PopulateVendorGeneral(iVendorId); BsfGlobal.ClearUserUsage("Vendor-Master-Edit", iVendorId, BsfGlobal.g_sVendorDBName); //GetGradeDetails(); //if (m_tSupplyGrade == null) txtGSupplier.Text = ""; //if (m_tContractGrade == null) txtGContractor.Text = ""; //if (m_tServiceGrade == null) txtGService.Text = ""; }
private void btnNext_Click(object sender, EventArgs e) { m_iVendorId = Convert.ToInt32(VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorId").ToString()); lblVendor.Text = VendorView.GetRowCellValue(VendorView.FocusedRowHandle, "VendorName").ToString(); EditVendor(); }