Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        public FrmSalesOrder()
        {
            InitializeComponent();
            dbContext = new CisDbContext();

            isAdd = true;
            SetDataGridViewUI();
        }
Esempio n. 3
0
        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();
            }
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public FrmInvoiceRecap()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 6
0
 public FrmRepresentative()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 7
0
 public FrmBatch()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 8
0
 public GenericRepository(CisDbContext context)
 {
     Context = context;
     DbSet   = context.Set <TEntity>();
 }
Esempio n. 9
0
 public UnitOfWork(CisDbContext context)
 {
     _context = context;
 }
Esempio n. 10
0
 public FrmLocation()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 11
0
 public FrmSalesArea()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 12
0
 public FrmOutletType()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 13
0
 public FrmMedicineCategoy()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 14
0
 public FrmUser()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 15
0
 public FrmCustomerRecap()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 16
0
 public FrmTermOfPayment()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 17
0
 public FrmCompanyInfo()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 18
0
 public FrmPrincipal()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }
Esempio n. 19
0
 public FrmProduct()
 {
     InitializeComponent();
     dbContext = new CisDbContext();
 }