Пример #1
0
        //ALANDIAS-----------------------------------------------------------------------

        private void cbPendingFilter_CheckedChanged(object sender, EventArgs e)
        {
            if (cbPendingFilter.Checked)
            {
                var Pendings          = Display.Where(x => x.Status == DtcMessageStatusEnum.Pending).ToList();
                var MadeAfterPendings = Display.Where(x => x.Status == DtcMessageStatusEnum.MadeAfterPend).ToList();


                DisplayWOUnecessaryPendings.Load(Display);

                foreach (var P in Pendings)
                {
                    foreach (var MAP in MadeAfterPendings)
                    {
                        if (P.Cusip == MAP.Cusip && P.CounterParty == MAP.CounterParty && P.ShareQuantity == MAP.ShareQuantity && P.DelivererAccountNum == MAP.DelivererAccountNum)
                        {
                            DisplayWOUnecessaryPendings.Remove(P);
                            break;
                        }
                    }
                }
                dgvDeliveryOrders.DataSource = DisplayWOUnecessaryPendings;
                ColorRows();
                DGVDel.SetColumns();
            }
            else
            {
                dgvDeliveryOrders.DataSource = Display;
                ColorRows();
                DGVDel.SetColumns();
            }
        }
Пример #2
0
        void DoAction(object state)
        {
            MainForm.Current.LoadingCircle = true;
            var ws = new WebServiceClient();

            ws.Url = MainForm.Current.OptionsPanel.InternetDatabaseUrlComboBox.Text;
            var gamesToDelete = data.Where(x => x.Action == CloudAction.Delete).Select(x => (Game)x.Item).ToList();

            try
            {
                var result = ws.SetGames(CloudAction.Delete, gamesToDelete);
                // If update was successful then.
                if (string.IsNullOrEmpty(result))
                {
                    var gamesToUpdate = data.Where(x => x.Action == CloudAction.Update).Select(x => (Game)x.Item).ToList();
                    result = ws.SetGames(CloudAction.Update, gamesToDelete);
                }
                if (!string.IsNullOrEmpty(result))
                {
                    MainForm.Current.SetHeaderBody(MessageBoxIcon.Error, result);
                }
            }
            catch (Exception ex)
            {
                var error = ex.Message;
                if (ex.InnerException != null)
                {
                    error += "\r\n" + ex.InnerException.Message;
                }
                MainForm.Current.SetHeaderBody(MessageBoxIcon.Error, error);
            }
        }
Пример #3
0
        private void GridView_Command_UpdateRelatedDataGridHandler(UpdateDirection direction, int rowIndex, int columnIndex)
        {
            if (rowIndex < 0 || rowIndex >= _dataSource.Count)
            {
                return;
            }

            CommandManagementItem cmdMngItem = _dataSource[rowIndex];

            switch (direction)
            {
            case UpdateDirection.Select:
            {
                LoadCommandSecurities(cmdMngItem);

                var firstCmdItem = _dataSource.First(p => p.Selection);
                if (firstCmdItem != null)
                {
                    LoadCommandSummary(firstCmdItem);
                }
            }
            break;

            case UpdateDirection.UnSelect:
            {
                var secuItems = _secuDataSource.Where(p => p.CommandId == cmdMngItem.CommandId).ToList();
                foreach (var secuItem in secuItems)
                {
                    _secuDataSource.Remove(secuItem);
                }

                var entrustItems = _entrustDataSource.Where(p => p.CommandId == cmdMngItem.CommandId).ToList();
                foreach (var entrustItem in entrustItems)
                {
                    _entrustDataSource.Remove(entrustItem);
                }

                var dealItems = _dealDataSource.Where(p => p.CommandId == cmdMngItem.CommandId).ToList();
                foreach (var dealItem in dealItems)
                {
                    _dealDataSource.Remove(dealItem);
                }

                var selectedItems = _dataSource.Where(p => p.Selection).ToList();
                if (selectedItems != null && selectedItems.Count > 0)
                {
                    LoadCommandSummary(selectedItems[0]);
                }
                else
                {
                    LoadCommandSummary(_dataSource[0]);
                }
            }
            break;

            default:
                break;
            }
        }
Пример #4
0
        private void CalcEntrustAmount(OpenPositionItem monitorItem, int copies)
        {
            var secuItems = _securityDataSource.Where(p => p.MonitorId == monitorItem.MonitorId);

            foreach (var secuItem in secuItems)
            {
                secuItem.EntrustAmount = copies * secuItem.WeightAmount;
            }
        }
Пример #5
0
        private void NameTB_TextChanged(object sender, EventArgs e)
        {
            List <WareView> viewList = new List <WareView>();

            viewList = view.Where(a => (a.Name.ToUpper().Contains(NameTB.Text.ToUpper()) == true) || a.CategoryName.ToUpper().Contains(NameTB.Text.ToUpper())).ToList();
            SortableBindingList <WareView> filteredView = new SortableBindingList <WareView>(viewList);

            WareLUE.Properties.DataSource = filteredView;
            if (filteredView.Count > 0)
            {
                WareLUE.ItemIndex = 0;
            }
        }
Пример #6
0
        /// <summary>
        /// Remove filter
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// Things get a tad complicated here in regards to keeping the current row
        /// as we need to make sure the row still exists
        /// </remarks>
        private void cmdRemoveFilter_Click(object sender, EventArgs e)
        {
            Customer tempCustomer = null;

            if (bsCustomers.CurrentRowIsValid())
            {
                tempCustomer = bsCustomers.Customer();
            }

            Customers customers = new Customers(true);

            blCustomers = new SortableBindingList <Customer>(customers.DataSource);

            bsCustomers.DataSource   = blCustomers;
            dataGridView1.DataSource = bsCustomers;

            if (tempCustomer.IsValid())
            {
                currentCustomer = blCustomers.Where(cust => cust.CustomerIdentifier == tempCustomer.CustomerIdentifier).FirstOrDefault();
                if (currentCustomer.IsValid())
                {
                    bsCustomers.Position = blCustomers.IndexOf(currentCustomer);
                }
            }
        }
Пример #7
0
        bool GamesAction <T>(CloudAction action)
        {
            var ws = new WebServiceClient();

            ws.Url = MainForm.Current.OptionsPanel.InternetDatabaseUrlComboBox.Text;
            var items = data
                        .Where(x => x.Action == action)
                        .Select(x => x.Item)
                        .OfType <T>()
                        .ToList();
            var success = true;

            // If there is data to submit.
            if (items.Count > 0)
            {
                string result = null;
                if (typeof(T) == typeof(Game))
                {
                    result = ws.SetGames(action, items.Cast <Game>().ToList());
                }
                success = string.IsNullOrEmpty(result);
                if (!success)
                {
                    MainForm.Current.SetHeaderBody(MessageBoxIcon.Error, result);
                }
            }
            ws.Dispose();
            return(success);
        }
Пример #8
0
        private void LootCoins(CampaignData.Coins coins)
        {
            Dictionary <string, int> rolled = new Dictionary <string, int>();

            rolled.Add("cp", Dice.RollLoot(coins.cp));
            rolled.Add("sp", Dice.RollLoot(coins.sp));
            rolled.Add("ep", Dice.RollLoot(coins.ep));
            rolled.Add("gp", Dice.RollLoot(coins.gp));
            rolled.Add("pp", Dice.RollLoot(coins.pp));

            foreach (var entry in rolled)
            {
                if (entry.Value > 0)
                {
                    //Check if we have this already
                    var existing = lootdrops.Where(x => x.type == LootType.Money && x.item == entry.Key).ToArray();
                    if (existing.Length > 0)
                    {
                        existing[0].count += entry.Value;
                    }
                    else
                    {
                        lootdrops.Add(new LootItem {
                            count = entry.Value, item = entry.Key, type = LootType.Money
                        });
                    }
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Code for obtaining checked rows in the DataGridView
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CheckedProductsButton_Click(object sender, EventArgs e)
        {
            if (_productView == null)
            {
                return;
            }

            var checkedProducts = _productView.Where(product => product.Process).ToList();

            if (checkedProducts.Count > 0)
            {
                var f = new CheckProductsForm(checkedProducts, CategoryComboBox.Text);
                try
                {
                    f.ShowDialog();
                }
                finally
                {
                    f.Dispose();
                }
            }
            else
            {
                MessageBox.Show("No checked products");
            }
        }
Пример #10
0
        public void InitialScreen(string strSearch)
        {
            try
            {
                gvDetail.SetOISStyle();
                gvDetail.MappingEnum(typeof(eCol));

                dataList = vmMas.GetToolPick();

                SortableBindingList <sp_MAS308_GetToolPick_Result> result = new SortableBindingList <sp_MAS308_GetToolPick_Result>();
                result.AddRange(dataList);

                gvDetail.DataSource = result;

                txtSearch.Text = strSearch;

                if (id > 0)
                {
                    SelectedData = result.Where(x => x.ID == id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #11
0
        private void CompanyNameStartsWithTextBox_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(CompanyNameStartsWithTextBox.Text))
            {
                _customerBindingSource.DataSource = _customerView;
                _filtered = false;
            }
            else
            {
                try
                {
                    var filter = CompanyNameStartsWithTextBox.Text.Trim();
                    _customerViewFilter = new SortableBindingList <CustomerEntity>(_customerView.Where(customerEntity =>
                                                                                                       customerEntity.CompanyName.ToLower().StartsWith(filter)).ToList());

                    _customerBindingSource.DataSource = _customerViewFilter;

                    _filtered = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
        private void Filter()
        {
            SortableBindingList <Session> temp = new SortableBindingList <Session>(SessionList.Where(oo => oo.SessionOpen.Date >= dtpFrom.Value.Date &&
                                                                                                     oo.SessionOpen.Date <= dtpTo.Value.Date).ToList());

            SetupData(temp);
        }
        private void SaveSettingsToConfig()
        {
            // Find all files set as hotfix now. This keeps our file list clean if we get deletes we don't keep track of
            var hotlistRightNow = _borderlands3FilesList.Where(a => a.HotKeyEnabled).Select(a => a.FileName);

            string sortedIndex = "";
            string sortedOrder = "";

            if (dataGridView1.SortedColumn != null)
            {
                sortedIndex = dataGridView1.SortedColumn.Index.ToString();
                sortedOrder = dataGridView1.SortOrder.ToString();
            }

            Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);

            config.AppSettings.Settings.Remove("sortedColumnIndex");
            config.AppSettings.Settings.Remove("sortedColumnOrder");
            config.AppSettings.Settings.Remove("folderPath");
            config.AppSettings.Settings.Remove("userName");
            config.AppSettings.Settings.Remove("hideSettingInMainForm");
            config.AppSettings.Settings.Remove("HotkeyList");

            config.AppSettings.Settings.Add("sortedColumnIndex", sortedIndex);
            config.AppSettings.Settings.Add("sortedColumnOrder", sortedOrder);
            config.AppSettings.Settings.Add("folderPath", _directory);
            config.AppSettings.Settings.Add("userName", _ntAccountName);
            config.AppSettings.Settings.Add("hideSettingInMainForm", _hideInfo.ToString());
            config.AppSettings.Settings.Add("HotkeyList", string.Join("|", hotlistRightNow)); // Save list of files currently macro. 1.sav|2.sav|3.sav
            config.Save(ConfigurationSaveMode.Modified);
        }
Пример #14
0
        private void ToolStripTextBox1_TextChanged(object sender, EventArgs e)
        {
            var l = companyList.Where(c => c.CompanyName.ToUpper().Contains(tbSearchCompany.Text.ToUpper()) | c.CompanyCode.ToUpper().Contains(tbSearchCompany.Text.ToUpper()) | c.Website.ToUpper().Contains(tbSearchCompany.Text.ToUpper()) | c.CategoryName.ToUpper().Contains(tbSearchCompany.Text.ToUpper()) | c.Email.ToUpper().Contains(tbSearchCompany.Text.ToUpper())).ToList();

            VWCompanyBindingSource.DataSource = l;
            activateOrDeactivateButtons();
        }
Пример #15
0
        public void InitialScreen(string strSearch)
        {
            try
            {
                gvDetail.SetOISStyle();
                gvDetail.MappingEnum(typeof(eCol));

                gvDetail.SetColumnNumeric((int)eCol.STANDARD);

                stdList = vmMas.GetSTDLight(new MAS302_STDLight_Criteria());

                SortableBindingList <sp_MAS302_GetSTDLight_Result> result = new SortableBindingList <sp_MAS302_GetSTDLight_Result>();
                result.AddRange(stdList);

                gvDetail.DataSource = result;

                txtSearch.Text = strSearch;

                if (id > 0)
                {
                    SelectedData = result.Where(x => x.ID == id).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 /// Determines whether a counter has already been added to the Seleted List.
 /// </summary>
 /// <param name="searchItem"></param>
 /// <returns></returns>
 private bool CanAdd(PerfMonCounterData searchItem)
 {
     return(_selectedCounters.Where(c => c.TargetHost == searchItem.TargetHost &&
                                    c.Category == searchItem.Category &&
                                    c.InstanceName == searchItem.InstanceName &&
                                    c.Counter == searchItem.Counter).FirstOrDefault() == null);
 }
Пример #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            dataFolder         = new DirectoryInfo(Path.Combine(Settings.Default.DataFolder, @"ProjectExplorer\"));
            sprintXMLFilePath  = Path.Combine(dataFolder.FullName, "sprints.xml");
            todoXMLFilePath    = Path.Combine(dataFolder.FullName, "todos.xml");
            projectXMLFilePath = Path.Combine(dataFolder.FullName, "projects.xml");

            SortableBindingList <Sprint>  allSprints  = SortableBindingListHelper.GetBindingListFromXmlFile <Sprint>(sprintXMLFilePath);
            SortableBindingList <Todo>    allTodos    = SortableBindingListHelper.GetBindingListFromXmlFile <Todo>(todoXMLFilePath);
            SortableBindingList <Project> allProjects = SortableBindingListHelper.GetBindingListFromXmlFile <Project>(projectXMLFilePath);


            string sprintFilter  = null;
            string projectFilter = null;

            if (Page.RouteData.Values.ContainsKey("sprint") && Page.RouteData.Values.ContainsKey("project"))
            {
                sprintFilter  = Page.RouteData.Values["sprint"].ToString();
                projectFilter = Page.RouteData.Values["project"].ToString();
                Guid projectId = allProjects.Where(p => p.Id == projectFilter).Single().pId;
                RenderTasks(allSprints, allTodos, sprintFilter, projectId);
            }
            else
            {
                RenderSiteMap(allSprints, allTodos, allProjects);
            }
        }
        /// <summary>
        /// Processes queues that are in the database but don't show up on the server anymore.
        /// The user is prompted to remove these queues if they choose, but if the queues
        /// are still referenced within an activity then they can't be deleted.
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="queuesOnServer">The queues on server.</param>
        /// <returns></returns>
        private bool FindMissingServerQueues(FrameworkServer server, Collection <string> queuesOnServer)
        {
            bool changesExist = false;

            // There are queues that no longer exist on the server, ask the user what they want
            // to do.  Should they keep the information around, but inactive, or should they
            // remove the queue entry from the database?
            Collection <RemotePrintQueue> queuesMissingOnServer = new Collection <RemotePrintQueue>();

            foreach (var item in _controller.Context.RemotePrintQueues.Where(n => n.PrintServerId == server.FrameworkServerId))
            {
                if (!queuesOnServer.Contains(item.Name))
                {
                    queuesMissingOnServer.Add(item);
                }
            }

            SortableBindingList <PrintQueueInUse> queuesInUse        = _controller.SelectQueuesInUse(server);
            Collection <Tuple <string, string> >  queuesAndScenarios = new Collection <Tuple <string, string> >();

            foreach (string queueName in queuesMissingOnServer.Select(q => q.Name))
            {
                PrintQueueInUse queue = queuesInUse.Where(q => q.QueueName == queueName).FirstOrDefault();

                if (queue != null)
                {
                    queuesAndScenarios.Add(new Tuple <string, string>(queueName, queue.ScenarioName));
                }
                else
                {
                    queuesAndScenarios.Add(new Tuple <string, string>(queueName, string.Empty));
                }
            }

            if (queuesMissingOnServer.Count > 0)
            {
                changesExist = true;

                // If there are queues missing on the server, the user selects which queues to forcefully remove from the database, EVEN IF THEY ARE BEING USED IN A SCENARIO
                using (PrintQueueRefreshForm form = new PrintQueueRefreshForm(queuesAndScenarios, Properties.Resources.RemoveQueues.FormatWith('\n'), "Remove", "Remove Missing Queues From Database", "Force Remove"))
                {
                    DialogResult result = form.ShowDialog(this);
                    if (result == DialogResult.OK)
                    {
                        foreach (string queue in form.SelectedQueues)
                        {
                            RemotePrintQueue remoteQueue = queuesMissingOnServer.Where(q => q.Name == queue).FirstOrDefault();
                            _controller.Context.RemotePrintQueues.Remove(remoteQueue);
                        }

                        SaveChanges();
                        RefreshQueueDisplay(server);
                    }
                }
            }

            return(changesExist);
        }
        private GlobalSettingsEditForm CreateSettingsEditForm(SystemSetting setting)
        {
            if (_settingType == SettingType.PluginSetting)
            {
                return(new GlobalSettingsEditForm(setting, _context, _settings.Where(s => s.Name.Equals(setting.Name) && s.Value.Equals(setting.Value)).ToList()));
            }

            return(new GlobalSettingsEditForm(setting, _context));
        }
Пример #20
0
        public static ScoreErrorType ValidateScores(SortableBindingList <Score> scoreList, Event currentEvent)
        {
            List <Score> scores = new List <Score>();

            //Eliminate disqualified rows from the validation
            foreach (Score score in scoreList.Where(x => x.IsDisqualified == false))
            {
                scores.Add(score);
            }

            //Incomplete row check
            foreach (Score s in scores)
            {
                ScoreErrorType err = s.HasAllRequiredAttributes();
                if (err != ScoreErrorType.None)
                {
                    return(err);
                }
            }

            //Duplicate competitor check
            List <int> matchIds = new List <int>();

            foreach (Score s in scores)
            {
                matchIds.Add(s.MatchId);
            }
            matchIds = matchIds.Distinct().ToList();

            foreach (int matchId in matchIds)
            {
                foreach (Score s in scores.Where(y => y.MatchId == matchId))
                {
                    if (scores.Count(x => x.MatchId == matchId && x.CompetitorId == s.CompetitorId) > 1)
                    {
                        return(ScoreErrorType.DuplicateCompetitorInMatch);
                    }
                }
            }

            //Duplicate rank check
            //Only look at first, second, third.
            //I expected if we do not rank below third place, default values of 0s will be left and therefore are not duplicates.
            foreach (int matchId in matchIds)
            {
                foreach (Score s in scores.Where(y => y.MatchId == matchId))
                {
                    if (scores.Count(x => x.MatchId == matchId && x.Ranked == s.Ranked) > 1)
                    {
                        return(ScoreErrorType.DuplicateRankInMatch);
                    }
                }
            }

            return(ScoreErrorType.None);
        }
Пример #21
0
        private SortableBindingList <Todo> SprintFilter(SortableBindingList <Todo> todoList, Sprint sprint)
        {
            // All Tasks in Sprint
            List <Guid> sprintTasks = new List <Guid>();

            sprint.Kanban.ForEach(p => sprintTasks.Add(p.TaskPid));

            //Filter Global List
            return(new SortableBindingList <Todo>(todoList.Where(t => sprintTasks.Contains(t.pId))));
        }
Пример #22
0
        private void NameTB_TextChanged(object sender, EventArgs e)
        {
            List <WareView> viewList = new List <WareView>();

            viewList = view.Where(a => (a.Name.ToUpper().Contains(NameTB.Text.ToUpper()) == true) || a.CategoryName.ToUpper().Contains(NameTB.Text.ToUpper())).ToList();
            SortableBindingList <WareView> filteredView = new SortableBindingList <WareView>(viewList);

            WareCB.DataSource = filteredView;
            WareCB.Update();
        }
Пример #23
0
        private void FillFilter()
        {
            List <PricesView> viewList = new List <PricesView>();

            viewList = view.Where(a => (universalFilter1.WareID == null || a.WareID == universalFilter1.WareID)).ToList();
            SortableBindingList <PricesView> filteredView = new SortableBindingList <PricesView>(viewList);

            DataGV.DataSource = filteredView;
            DataGV.Update();
        }
Пример #24
0
        /// <summary>
        ///  Submit changed data to the cloud.
        /// </summary>
        Exception Execute <T>(CloudAction action)
        {
            var ws = new WebServiceClient();

            ws.Url = SettingsManager.Options.InternetDatabaseUrl;
            CloudMessage result = null;

            try
            {
                var citems = data.Where(x => x.Action == action);
                var items  = citems.Select(x => x.Item).OfType <T>().ToList();
                if (items.Count > 0)
                {
                    // Add security.
                    var o       = SettingsManager.Options;
                    var command = CloudHelper.NewMessage(action, o.UserRsaPublicKey, o.CloudRsaPublicKey, o.Username, o.Password);
                    command.Values.Add(CloudKey.HashedDiskId, o.HashedDiskId, true);
                    //// Add secure credentials.
                    //var rsa = new JocysCom.ClassLibrary.Security.Encryption("Cloud");
                    //if (string.IsNullOrEmpty(rsa.RsaPublicKeyValue))
                    //{
                    //	var username = rsa.RsaEncrypt("username");
                    //	var password = rsa.RsaEncrypt("password");
                    //	ws.SetCredentials(username, password);
                    //}
                    // Add changes.
                    if (typeof(T) == typeof(UserGame))
                    {
                        command.UserGames = items as List <UserGame>;
                    }
                    else if (typeof(T) == typeof(UserDevice))
                    {
                        command.UserControllers = items as List <UserDevice>;
                    }
                    result = ws.Execute(command);
                    if (result.ErrorCode > 0)
                    {
                        queueTimer.ChangeSleepInterval(5 * 60 * 1000);
                        return(new Exception(result.ErrorMessage));
                    }
                    foreach (var item in citems)
                    {
                        data.Remove(item);
                    }
                }
            }
            catch (Exception ex)
            {
                // Sleep for 5 minutes;
                queueTimer.ChangeSleepInterval(5 * 60 * 1000);
                return(ex);
            }
            return(null);
        }
        private bool Form_LoadData(object sender, object data)
        {
            _monitorDataSource.Clear();
            _securityDataSource.Clear();

            //Load the data of open posoition
            List <OpenPositionItem> monitorList = _monitorUnitBLL.GetOpenItems();

            monitorList.ForEach(p => _monitorDataSource.Add(p));

            //Load the data for each template
            if (monitorList.Count > 0)
            {
                var selectedItems = _monitorDataSource.Where(p => p.Selection).ToList();
                if (selectedItems.Count > 0)
                {
                    LoadSecurityData(selectedItems);
                }
            }

            return(true);
        }
Пример #26
0
        private void UpdateAvailableLanguages()
        {
            LanguagesConfigFile.Clear();
            LanguagesConfigFile["Languages"] = string.Join(",", Languages.Where(x => x.Enabled).Select(x => x.Name));

            foreach (var lang in Languages)
            {
                LanguagesConfigFile.Add(lang.Key, lang.Name);
            }

            //TODO: Save (requires Admin rights to save in Program Files)
            //LanguagesConfigFile.Save(Path.Combine(LddAssetsPath, "Languages.loc"));
        }
Пример #27
0
        /// <summary>
        ///  Submit changed data to the cloud.
        /// </summary>
        Exception Execute <T>(CloudAction action)
        {
            var ws = new WebServiceClient();

            ws.Url = SettingsManager.Options.InternetDatabaseUrl;
            CloudResults result = null;

            try
            {
                var citems = data.Where(x => x.Action == action);
                var items  = citems.Select(x => x.Item).OfType <T>().ToList();
                if (items.Count > 0)
                {
                    var command = new CloudCommand();
                    command.Action = action;
                    if (typeof(T) == typeof(UserGame))
                    {
                        command.UserGames = items as List <UserGame>;
                    }
                    else if (typeof(T) == typeof(UserController))
                    {
                        command.UserControllers = items as List <UserController>;
                    }
                    // Add secure credentials.
                    var rsa = new JocysCom.ClassLibrary.Security.Encryption("Cloud");
                    if (string.IsNullOrEmpty(rsa.RsaPublicKeyValue))
                    {
                        var username = rsa.RsaEncrypt("username");
                        var password = rsa.RsaEncrypt("password");
                        ws.SetCredentials(username, password);
                    }
                    result = ws.Execute(command);
                    if (result.ErrorCode > 0)
                    {
                        queueTimer.SleepTimer.Interval = 5 * 60 * 1000;
                        return(new Exception(result.ErrorMessage));
                    }
                    foreach (var item in citems)
                    {
                        data.Remove(item);
                    }
                }
            }
            catch (Exception ex)
            {
                // Sleep for 5 minutes;
                queueTimer.SleepTimer.Interval = 5 * 60 * 1000;
                return(ex);
            }
            return(null);
        }
Пример #28
0
        private void ComputeTotalAmountDue()
        {
            if (poList != null)
            {
                totalDue = poList.Where(a => a.PurchaseId != null).Sum(a => a.Amount).GetValueOrDefault();

                decimal debit = poList.Where(a => a.ReturnId != null).Sum(a => a.Amount).GetValue();
                DebitTextbox.Text = debit.ToString("N2");

                decimal tax      = 0m;
                decimal discount = DiscountTextbox.Value;

                if (TaxCheckbox.Checked)
                {
                    tax = (totalDue - debit - discount) / 1.12m * 0.1m * 0.1m;
                }

                totalAmountDue             = Math.Round(totalDue - debit - tax - discount, 2);
                AmountDueTextbox.Text      = totalDue.ToString("N2");
                WitholdingTaxTextbox.Text  = tax.ToString("N2");
                TotalAmountDueTextbox.Text = totalAmountDue.ToString("N2");
            }
        }
Пример #29
0
        private void ComputeTotalAmountDue()
        {
            if (invoiceList != null)
            {
                totalDue = invoiceList.Where(a => a.PurchaseId != null).Sum(a => a.Amount).GetValue();

                decimal credit = invoiceList.Where(a => a.ReturnId != null).Sum(a => a.Amount).GetValue(); //CreditTextbox.Text.ToDecimal();
                CreditTextbox.Text = credit.ToString("N2");

                decimal tax      = 0m;
                decimal discount = DiscountTextbox.Value;

                if (TaxCheckbox.Checked)
                {
                    tax = (totalDue - credit - discount) / 1.12m * 0.1m * 0.1m;
                }

                totalAmountDue             = Math.Round(totalDue - credit - tax - discount, 2);
                AmountDueTextbox.Text      = totalDue.ToString("N2");
                WitholdingTaxTextbox.Text  = tax.ToString("N2");
                TotalAmountDueTextbox.Text = totalAmountDue.ToString("N2");
            }
        }
Пример #30
0
        private void RenderSiteMap(SortableBindingList <Sprint> allSprints, SortableBindingList <Todo> allTodos, SortableBindingList <Project> allProjects)
        {
            foreach (Sprint sprint in allSprints)
            {
                string sprintName    = sprint.ShortDescription;
                string sprintContent = "";//task.PublicText.Replace("\r\n", "<br />");


                StringBuilder sprintSubContentBuilder = new StringBuilder();

                List <Project> projectList = new List <Project>();
                Dictionary <Project, List <Status> > projectStatusList = new Dictionary <Project, List <Status> >();
                foreach (KanbanPosition kanbanPosition in sprint.Kanban)
                {
                    Todo    task    = allTodos.Where(t => t.pId == kanbanPosition.TaskPid).Single();
                    Project project = allProjects.Where(p => p.pId == task.ProjectPid).Single();
                    if (!projectList.Contains(project))
                    {
                        projectList.Add(project);
                        projectStatusList.Add(project, new List <Status>());
                        projectStatusList[project].Add(kanbanPosition.Status);
                    }
                }

                string currentUrl = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~/");

                foreach (Project project in projectList)
                {
                    string subContent     = "";
                    string level2Template = "";


                    foreach (Status statusItem in projectStatusList[project])
                    {
                        string link   = $"{currentUrl}status/{sprint.Id}/{project.Id}";
                        string status = statusItem.ToString();
                        subContent += $"<a href=\"{link}\">{status}</a><br/>";
                    }

                    level2Template = $"<ul class=\"cbp-ntsubaccordion\"><li><h4 class=\"cbp-nttrigger\">{project.ShortDescription}</h4><div class=\"cbp-ntcontent\"><p>{subContent}</p></div></li></ul>";
                    sprintSubContentBuilder.AppendLine(level2Template);
                }



                string sprintSubContent = sprintSubContentBuilder.ToString();
                string level1Template   = $"<li><h3 class=\"cbp-nttrigger\">{sprintName}</h3><div class=\"cbp-ntcontent\"><p>{sprintContent}</p>{sprintSubContent}</div></li>";
                TaskListPlanned.InnerHtml += level1Template;
            }
        }
Пример #31
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            gridDaily.DataSource = null;
            gridDaily.Rows.Clear();
            gridDaily.Refresh();

            try
            {
                var calcDate = dateTimePicker1.Value.Date;

                var users = db.Users.Where(x => x.DeptID == comboBox1.SelectedIndex).ToList();

                var t = db.DailyPayments.Where(x => users.Any(y => y.UserID == x.LocalUserID) && x.CalculationDate == calcDate);

                if (cbxOnlyZeroPayment.Checked)
                //gridDaily.DataSource = new SortableBindingList<DailyPayment>(db.DailyPayments.Where(x => x.CalculationDate == calcDate && x.DeptID == comboBox1.SelectedIndex && x.Payment <= 0).ToList());
                {
                    var lst = new List<DailyPayment>();
                    foreach (var user in users)
                    {
                        lst.AddRange(db.DailyPayments.Where(x => user.UserID == x.LocalUserID && x.CalculationDate == calcDate && x.Payment > 0 && x.IsOld).ToList());
                    }
                    gridDaily.DataSource = new SortableBindingList<DailyPayment>(lst);
                }
                else
                //gridDaily.DataSource = new SortableBindingList<DailyPayment>(db.DailyPayments.Where(x => x.CalculationDate == calcDate && x.DeptID == comboBox1.SelectedIndex).ToList());
                {
                    var lst = new List<DailyPayment>();
                    foreach (var user in users)
                    {
                        var dblist = db.DailyPayments.Where(x => user.UserID == x.LocalUserID && x.CalculationDate == calcDate).ToList();
                        dblist.ForEach(x => { db.Entry<DailyPayment>(x).Reload(); });
                        lst.AddRange(dblist);
                    }
                    gridDaily.DataSource = new SortableBindingList<DailyPayment>(lst);
                }

                ////

                SortableBindingList<Kunchik> expressPay = new SortableBindingList<Kunchik>();

                if (calcDate.Date.DayOfWeek == DayOfWeek.Monday || (calcDate.Date.DayOfWeek == DayOfWeek.Sunday && comboBox1.SelectedIndex == 4))
                    expressPay = DailyManagement.GetAccountsTest(calcDate.Date.AddDays(-1), calcDate.Date, new decimal[] { 2501 }, null);
                else
                    expressPay = DailyManagement.GetAccountsTest(calcDate.Date, calcDate.Date, new decimal[] { 2501 }, null);

                foreach (var row in (SortableBindingList<DailyPayment>)gridDaily.DataSource)
                {
                    var expay = expressPay.Where(x => x.Purpose.Contains(row.AgreementNumber));

                    if (expay.Count() > 0)
                        row.Payment += expay.Sum(x => x.DebitAmount.Value);
                }

                gridDaily.Refresh();
            }
            catch (Exception ex)
            {
                LoggingManagement.LogException(ex, User);
            }
        }