public void BindLocationComboBox(CisDbContext dbContext, ComboBox cbLocation, Constant.LocationType locationType, string parentId = "") { var uow = new UnitOfWork <Location>(dbContext); var locations = uow.Repository.GetAll(); if (string.IsNullOrEmpty(parentId)) { locations = locations .Where(l => l.LocationType == locationType) .OrderBy(l => l.Name); } else { locations = locations .Where(l => l.LocationType == locationType && l.ParentId == parentId) .OrderBy(l => l.Name); } AutoCompleteStringCollection autoCompleteCollection = new AutoCompleteStringCollection(); Dictionary <string, string> dsLocations = new Dictionary <string, string>(); dsLocations.Add("0", "--Pilih--"); foreach (var loc in locations) { dsLocations.Add(loc.Id, loc.Name); autoCompleteCollection.Add(loc.Name); } cbLocation.DataSource = new BindingSource(dsLocations, null); cbLocation.DisplayMember = "Value"; cbLocation.ValueMember = "Key"; cbLocation.AutoCompleteCustomSource = autoCompleteCollection; }
public FrmSalesOrder() { InitializeComponent(); dbContext = new CisDbContext(); isAdd = true; SetDataGridViewUI(); }
private void backupDatabaseToolStripMenuItem_Click(object sender, EventArgs e) { // Only Super Admin can do the backup using (var context = new CisDbContext()) { var userRole = new UnitOfWork <UserRole>(context).Repository.GetAll() .Where(u => u.UserId == Properties.Settings.Default.CurrentUserId).FirstOrDefault(); var isSuperAdmin = new UnitOfWork <Role>(context).Repository.GetAll() .Where(r => r.Id == userRole.RoleId && r.RoleCode == "SUPER").FirstOrDefault() != null; if (!isSuperAdmin) { CommonMessageHelper.NoAccess(); return; } FrmBackupDatabase frmBackupDatabase = new FrmBackupDatabase(); frmBackupDatabase.ShowDialog(); } }
public bool ValidateAccess(int permissionCode) { using (var context = new CisDbContext()) { var userRole = new UnitOfWork <UserRole>(context).Repository.GetAll() .Where(u => u.UserId == Properties.Settings.Default.CurrentUserId); var permission = new UnitOfWork <Permission>(context).Repository.GetAll() .Where(p => p.PermissionCode == permissionCode.ToString()); var permissionRole = new UnitOfWork <PermissionRole>(context).Repository.GetAll().Select(pr => pr); var userDetail = userRole.Join(permissionRole, ur => ur.RoleId, pr => pr.RoleId, (ur, pr) => new { ur, pr }) .Join(permission, urpr => urpr.pr.PermisionId, p => p.Id, (urpr, p) => new { urpr, p }) .Select(res => res).ToList(); if (userDetail.Count > 0) { return(true); } } return(false); }
public FrmInvoiceRecap() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmRepresentative() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmBatch() { InitializeComponent(); dbContext = new CisDbContext(); }
public GenericRepository(CisDbContext context) { Context = context; DbSet = context.Set <TEntity>(); }
public UnitOfWork(CisDbContext context) { _context = context; }
public FrmLocation() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmSalesArea() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmOutletType() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmMedicineCategoy() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmUser() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmCustomerRecap() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmTermOfPayment() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmCompanyInfo() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmPrincipal() { InitializeComponent(); dbContext = new CisDbContext(); }
public FrmProduct() { InitializeComponent(); dbContext = new CisDbContext(); }