Beispiel #1
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            entity.Properties.Settings _setting = new entity.Properties.Settings();

            sales_packingViewSource = FindResource("sales_packingViewSource") as CollectionViewSource;
            dbContext.sales_packing.Where(a => a.id_company == _setting.company_ID).Include("sales_packing_detail").Load();
            sales_packingViewSource.Source = dbContext.sales_packing.Local;
            sales_packingsales_packinglist_detailViewSource = FindResource("sales_packingsales_packing_detailViewSource") as CollectionViewSource;

            CollectionViewSource app_branchViewSource = FindResource("app_branchViewSource") as CollectionViewSource;

            app_branchViewSource.Source = dbContext.app_branch.Where(a => a.is_active == true && a.id_company == _setting.company_ID).OrderBy(a => a.name).ToList();

            CollectionViewSource app_terminalViewSource = FindResource("app_terminalViewSource") as CollectionViewSource;

            app_terminalViewSource.Source = dbContext.app_terminal.Where(a => a.is_active == true && a.id_company == _setting.company_ID).OrderBy(a => a.name).ToList();

            sales_orderViewSource        = FindResource("sales_orderViewSource") as CollectionViewSource;
            sales_orderViewSource.Source = dbContext.sales_order.Where(a => a.id_company == _setting.company_ID && a.status == Status.Documents_General.Approved).Include(a => a.sales_order_detail).ToList();

            Dispatcher.InvokeAsync(new Action(() =>
            {
                cbxDocument.ItemsSource    = entity.Brillo.Logic.Range.List_Range(dbContext, entity.App.Names.PackingList, _setting.branch_ID, _setting.terminal_ID);
                cbxPackingType.ItemsSource = Enum.GetValues(typeof(Status.PackingTypes));
            }));
        }
Beispiel #2
0
 private void CurrencyBox_Loaded(object sender, RoutedEventArgs e)
 {
     if (!DesignerProperties.GetIsInDesignMode(this))
     {
         using (db db = new db())
         {
             entity.Properties.Settings _setting = new entity.Properties.Settings();
             app_currencyList       = db.app_currency.Where(x => x.id_company == _setting.company_ID && x.is_active == true).ToList();
             cbCurrency.ItemsSource = app_currencyList;
         }
     }
 }
Beispiel #3
0
        private void auth_Login(string u, string p)
        {
            Dispatcher.BeginInvoke((Action)(() => { this.Cursor = Cursors.AppStarting; }));
            Dispatcher.BeginInvoke((Action)(() => { progBar.IsIndeterminate = true; }));

            try
            {
                entity.Properties.Settings Settings = new entity.Properties.Settings();
                if (Settings.company_ID == 0)
                {
                    using (db db = new db())
                    {
                        Settings.company_ID = db.app_company.FirstOrDefault().id_company;
                        Settings.Save();
                    }
                }


                Cognitivo.Properties.Settings ViewSettings = new Properties.Settings();
                CurrentSession.ConnectionString = ViewSettings.MySQLconnString;
                CurrentSession.Start(u, p);

                if (CurrentSession.User != null)
                {
                    Dispatcher.BeginInvoke((Action)(() =>
                    {
                        if (chbxRemember.IsChecked == true)
                        {
                            Settings.user_UserName = tbxUser.Text;
                            Settings.Save();
                        }
                    }));

                    myWindow.is_LoggedIn = true;
                    Dispatcher.BeginInvoke((Action)(() => myFrame.Navigate(new mainMenu_Corporate())));
                }
                else
                {
                    Dispatcher.BeginInvoke((Action)(() => { tbxUser.Focus(); }));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.InnerException.ToString(), "Cognitivo ERP", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                Dispatcher.BeginInvoke((Action)(() => { this.Cursor = Cursors.Arrow; }));
                Dispatcher.BeginInvoke((Action)(() => { progBar.IsIndeterminate = false; }));
                taskAuth = null;
            }
        }
Beispiel #4
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            entity.Properties.Settings _settings = new entity.Properties.Settings();

            template_designerViewSource = FindResource("template_designerViewSource") as CollectionViewSource;
            ProjectTemplateDB.project_event_template.Where(a => a.is_active == true && a.id_company == _settings.company_ID).Load();
            template_designerViewSource.Source            = ProjectTemplateDB.project_event_template.Local;
            template_designerservices_per_eventViewSource = FindResource("template_designerservices_per_eventViewSource") as CollectionViewSource;
            template_designerproject_event_template_variableViewSource = FindResource("template_designerproject_event_template_variableViewSource") as CollectionViewSource;

            List <item_tag> item_tag = new List <item_tag>();

            item_tag = ProjectTemplateDB.item_tag.Where(a => a.id_company == _settings.company_ID && a.is_active == true).ToList();
            CollectionViewSource item_tagViewSource = FindResource("item_tagViewSource") as CollectionViewSource;

            item_tagViewSource.Source = item_tag;
            CollectionViewSource item_tagViewSourceForEvents = FindResource("item_tagViewSourceForEvents") as CollectionViewSource;

            item_tagViewSourceForEvents.Source = item_tag;
            CollectionViewSource item_tagViewSourceForPerson = FindResource("item_tagViewSourceForPerson") as CollectionViewSource;

            item_tagViewSourceForPerson.Source = item_tag;
        }
Beispiel #5
0
        public mainLogIn()
        {
            InitializeComponent();

            try
            {
                lblVersion.Content = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
            }
            catch
            {
                var obj = Assembly.GetExecutingAssembly().GetName().Version;
                lblVersion.Content = string.Format("Application Version {0}.{1}.{2}.{3}", obj.Major, obj.Minor, obj.Build, obj.Revision);
            }

            myFrame = myWindow.mainFrame;

            //string imgSource = "http://images2.fanpop.com/image/photos/12900000/Tony-Stark-tony-stark-12952919-387-528.jpg";
            //BitmapImage bitmap = new BitmapImage();
            //bitmap.BeginInit();
            //bitmap.UriSource = new Uri(imgSource, UriKind.Absolute);
            //bitmap.EndInit();
            //imgAvatar.ImageSource = bitmap;

            Task taskdb = Task.Factory.StartNew(() => check_createdb());

            entity.Properties.Settings Settings = new entity.Properties.Settings();
            if (Settings.user_Name != null && Settings.user_UserName != "")
            {
                tbxUser.Text = Settings.user_UserName;
                tbxPassword.Focus();
                chbxRemember.IsChecked = true;
            }
            else
            {
                tbxUser.Focus();
            }
        }
Beispiel #6
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            entity.Properties.Settings _setting = new entity.Properties.Settings();

            employeeViewSource = (CollectionViewSource)FindResource("contactViewSource");
            await dbContext.contacts.Where(i => i.is_employee && i.is_active && i.id_company == _setting.company_ID).OrderBy(i => i.name).ToListAsync();

            employeeViewSource.Source         = dbContext.contacts.Local;
            contacthr_contractViewSource      = (CollectionViewSource)FindResource("contacthr_contractViewSource");
            contacthr_familyViewSource        = (CollectionViewSource)FindResource("contacthr_familyViewSource");
            contacthr_talent_detailViewSource = (CollectionViewSource)FindResource("contacthr_talent_detailViewSource");
            contacthr_educationViewSource     = (CollectionViewSource)FindResource("contacthr_educationViewSource");
            hr_positionViewSource             = (CollectionViewSource)FindResource("hr_positionViewSource");
            await dbContext.hr_position.ToListAsync();

            hr_positionViewSource.Source = dbContext.hr_position.Local;

            app_departmentViewSource = (CollectionViewSource)FindResource("app_departmentViewSource");
            await dbContext.app_department.ToListAsync();

            app_departmentViewSource.Source = dbContext.app_department.Local;

            hr_talentViewSource = (CollectionViewSource)FindResource("hr_talentViewSource");
            await dbContext.hr_talent.ToListAsync();

            hr_talentViewSource.Source = dbContext.hr_talent.Local;

            app_locationViewSource = (CollectionViewSource)FindResource("app_locationViewSource");
            await dbContext.app_location.ToListAsync();

            app_locationViewSource.Source = dbContext.app_location.Local;

            cbxBloodtype.ItemsSource      = Enum.GetValues(typeof(contact.BloodTypes));
            cbxmaritialstatus.ItemsSource = Enum.GetValues(typeof(contact.CivilStatus));
            cbxGender.ItemsSource         = Enum.GetValues(typeof(contact.Genders));
            cbxRelation.ItemsSource       = Enum.GetValues(typeof(hr_family.Relationship));
        }
Beispiel #7
0
        private void check_createdb()
        {
            using (var db = new db())
            {
                bool db_exists = db.Database.Exists();

                if (!db_exists)
                {
                    Dispatcher.BeginInvoke((Action)(() => { myFrame.Navigate(new StartUp()); }));
                }
                else
                {
                    string      company_Alias = string.Empty;
                    app_company app_company   = db.app_company.Where(x => x.id_company == entity.CurrentSession.Id_Company).FirstOrDefault();

                    if (app_company != null)
                    {
                        if (!string.IsNullOrEmpty(app_company.alias))
                        {
                            company_Alias = app_company.alias;
                        }
                        else
                        {
                            company_Alias = app_company.name;
                        }
                    }

                    entity.Properties.Settings Settings = new entity.Properties.Settings();
                    Settings.company_Name = company_Alias;
                    Dispatcher.BeginInvoke((Action)(() =>
                    {
                        Settings.Save();
                    }));
                }
            }
        }
Beispiel #8
0
        private void item_request_detailMovementDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            entity.Properties.Settings setting = new entity.Properties.Settings();
            int id_branch = setting.branch_ID;
            CollectionViewSource item_requestitem_request_detailViewSource = ((CollectionViewSource)(FindResource("item_requestitem_request_detailViewSource")));
            item_request_detail  item_request_detail = (item_request_detail)item_requestitem_request_detailViewSource.View.CurrentItem;

            if (item_request_detail != null)
            {
                item _item    = dbContext.items.Where(x => x.id_item == item_request_detail.id_item).FirstOrDefault();
                var  movement =
                    (from items in dbContext.item_movement
                     where items.status == Status.Stock.InStock &&
                     items.item_product.id_item == item_request_detail.id_item &&
                     items.app_location.id_branch == id_branch
                     group items by new { items.app_location }
                     into last
                     select new
                {
                    id_location = last.Key.app_location.id_location,
                    location = last.Key.app_location.name,
                    quntitiy = last.Sum(x => x.credit != null ? x.credit : 0) - last.Sum(x => x.debit != null ? x.debit : 0),
                }).ToList();


                List <desion> list_desion = new List <desion>();
                foreach (dynamic item in movement)
                {
                    // int id_location = (int)item.location;
                    desion desion = new desion();
                    desion.id_item       = _item.id_item;
                    desion.id_location   = item.id_location;
                    desion.location      = item.location;
                    desion.name          = _item.name;
                    desion.avlqty        = item.quntitiy;
                    desion.decisionqty   = 0;
                    desion.decisionState = state.added;
                    list_desion.Add(desion);
                }
                item_request_decisionmovementDataGrid.ItemsSource = list_desion;


                var transfer =
                    //(from items in dbContext.item_transfer_detail
                    // where items.item_product.id_item == item_request_detail.id_item
                    // group items by new { items.item_transfer.app_branch_destination }
                    //     into last
                    //     select new
                    //     {
                    //         id_location = last.Key.app_branch_destination.app_location.Where(x => x.is_default).FirstOrDefault().id_location,
                    //         branch = last.Key.app_branch_destination.name,
                    //         quntitiy = last.Sum(x => x.quantity_destination != null ? x.quantity_destination : 0),

                    //     }).ToList();

                    (from items in dbContext.item_movement
                     where items.status == Status.Stock.InStock &&
                     items.item_product.id_item == item_request_detail.id_item

                     group items by new { items.app_location.app_branch }
                     into last
                     select new
                {
                    id_location = last.Key.app_branch.app_location.Where(x => x.is_default).FirstOrDefault().id_location,
                    branch = last.Key.app_branch.name,
                    quntitiy = last.Sum(x => x.credit != null ? x.credit : 0) - last.Sum(x => x.debit != null ? x.debit : 0),
                }).ToList();
                List <desion> list_desion_transfer = new List <desion>();
                foreach (dynamic item in transfer)
                {
                    desion desion = new desion();
                    desion.branch        = item.branch;
                    desion.id_location   = item.id_location;
                    desion.id_item       = _item.id_item;
                    desion.name          = _item.name;
                    desion.avlqty        = item.quntitiy;
                    desion.decisionqty   = 0;
                    desion.decisionState = state.added;
                    list_desion_transfer.Add(desion);
                }
                item_request_decisiontransferDataGrid.ItemsSource = list_desion_transfer;

                List <desion> list_desion_purchase = new List <desion>();
                desion        purchasedesion       = new desion();
                purchasedesion.decisionState = state.added;
                purchasedesion.decisionqty   = 0;
                list_desion_purchase.Add(purchasedesion);
                item_request_decisionpurchaseDataGrid.ItemsSource = list_desion_purchase;


                List <desion> list_desion_production = new List <desion>();
                desion        productiondesion       = new desion();
                productiondesion.name = item_request_detail.item.name;
                productiondesion.RaisePropertyChanged("name");
                productiondesion.decisionqty   = 0;
                productiondesion.decisionState = state.added;
                list_desion_production.Add(productiondesion);
                item_request_decisionproductionDataGrid.ItemsSource = list_desion_production;
            }
        }