コード例 #1
0
ファイル: UserFilterForm.cs プロジェクト: GDuggi/DemoTest
        private void SaveData()
        {
            Hashtable hs               = new Hashtable();
            ArrayList commoditList     = new ArrayList();
            ArrayList faxNoList        = new ArrayList();
            ArrayList ignoreFilterList = new ArrayList();
            ArrayList currencyList     = new ArrayList();
            ArrayList sempraCmpnyList  = new ArrayList();
            ArrayList addCptyList      = new ArrayList();
            ArrayList panelViewsList   = new ArrayList();


            for (int i = 0; i < cdtyList.Items.Count; ++i)
            {
                if (cdtyList.Items[i].CheckState == CheckState.Checked)
                {
                    commoditList.Add(cdtyList.Items[i].Value);
                }
            }

            for (int i = 0; i < chklistFaxNos.Items.Count; ++i)
            {
                if (chklistFaxNos.Items[i].CheckState == CheckState.Checked)
                {
                    faxNoList.Add(chklistFaxNos.Items[i].Value);
                }
            }

            if (chkExcludeIgnoredDocs.CheckState == CheckState.Checked)
            {
                ignoreFilterList.Add("EXCLUDED");
            }
            else
            {
                ignoreFilterList.Add("INCLUDED");
            }

            for (int i = 0; i < additionalCprtsList.Items.Count; ++i)
            {
                if (additionalCprtsList.Items[i].CheckState == CheckState.Checked)
                {
                    addCptyList.Add(additionalCprtsList.Items[i].Value);
                }
            }

            for (int i = 0; i < ccyList.Items.Count; ++i)
            {
                if (ccyList.Items[i].CheckState == CheckState.Checked)
                {
                    currencyList.Add(ccyList.Items[i].Value);
                }
            }

            for (int i = 0; i < cmpnyList.Items.Count; ++i)
            {
                if (cmpnyList.Items[i].CheckState == CheckState.Checked)
                {
                    sempraCmpnyList.Add(cmpnyList.Items[i].Value);
                }
            }
            panelViewsList.Add(cmboPanel1View.Text);
            panelViewsList.Add(cmboPanel2View.Text);
            panelViewsList.Add(cmboPanel3View.Text);
            panelViewsList.Add(cmboPanel4View.Text);

            hs["Commodity"]      = commoditList;
            hs["Currency"]       = currencyList;
            hs["BookingCompany"] = sempraCmpnyList;
            hs["CptyInclude"]    = addCptyList;
            hs["PanelViews"]     = panelViewsList;
            hs["FaxNos"]         = faxNoList;
            hs["Filters"]        = ignoreFilterList;


            Hashtable condition = new Hashtable();

            if (this.legalName.Checked)
            {
                condition["AppliesTo"] = this.legalName.Text;
            }
            else
            {
                condition["AppliesTo"] = this.shortName.Text;
            }

            if (!"Please select".Equals(cboStart.SelectedItem))
            {
                condition[cboStart.SelectedItem] = txtStart.Text;
            }
            if (!"Please select".Equals(cboEnd.SelectedItem))
            {
                condition[cboEnd.SelectedItem] = txtEnd.Text;
            }
            hs["Counterparty"] = condition;
            FilterUtil.SaveUserFilters(hs);
        }
コード例 #2
0
ファイル: UserFilterForm.cs プロジェクト: GDuggi/DemoTest
        private void LoadInitialValues()
        {
            Hashtable hs = FilterUtil.GetUserFilters();

            if (hs == null)
            {
                return;
            }

            ArrayList panelViewList = (ArrayList)hs["PanelViews"];

            if (panelViewList != null)
            {
                for (int i = 0; i < cmboPanel1View.Properties.Items.Count; i++)
                {
                    if ((string)cmboPanel1View.Properties.Items[i] == (string)panelViewList[0])
                    {
                        cmboPanel1View.SelectedIndex = i;
                    }
                }

                for (int i = 0; i < cmboPanel2View.Properties.Items.Count; i++)
                {
                    if ((string)cmboPanel2View.Properties.Items[i] == (string)panelViewList[1])
                    {
                        cmboPanel2View.SelectedIndex = i;
                    }
                }

                for (int i = 0; i < cmboPanel3View.Properties.Items.Count; i++)
                {
                    if ((string)cmboPanel3View.Properties.Items[i] == (string)panelViewList[2])
                    {
                        cmboPanel3View.SelectedIndex = i;
                    }
                }

                for (int i = 0; i < cmboPanel4View.Properties.Items.Count; i++)
                {
                    if ((string)cmboPanel4View.Properties.Items[i] == (string)panelViewList[3])
                    {
                        cmboPanel4View.SelectedIndex = i;
                    }
                }
            }

            int totalChecked = 0;

            if (hs != null)
            {
                ArrayList filterCdty = (ArrayList)hs["Commodity"];
                if (filterCdty != null)
                {
                    for (int i = 0; i < filterCdty.Count; ++i)
                    {
                        string code = (string)filterCdty[i];
                        for (int j = 0; j < cdtyList.Items.Count; ++j)
                        {
                            if (cdtyList.Items[j].Value.ToString().Equals(code))
                            {
                                cdtyList.Items[j].CheckState = CheckState.Checked;
                                totalChecked++;
                                break;
                            }
                        }
                    }
                }
                if (totalChecked == cdtyList.Items.Count)
                {
                    checkEdit1.CheckState = CheckState.Checked;
                }


                ArrayList filterFaxNos = (ArrayList)hs["FaxNos"];
                totalChecked = 0;
                if (filterFaxNos != null)
                {
                    for (int i = 0; i < filterFaxNos.Count; ++i)
                    {
                        string faxNo = (string)filterFaxNos[i];
                        for (int j = 0; j < chklistFaxNos.Items.Count; ++j)
                        {
                            if (chklistFaxNos.Items[j].Value.ToString().Equals(faxNo))
                            {
                                chklistFaxNos.Items[j].CheckState = CheckState.Checked;
                                totalChecked++;
                                break;
                            }
                        }
                    }
                }
                if (totalChecked == chklistFaxNos.Items.Count)
                {
                    checkEdit5.CheckState = CheckState.Checked;
                }

                ArrayList filterDocs = (ArrayList)hs["Filter"];
                if (filterDocs != null)
                {
                    for (int i = 0; i < filterDocs.Count; ++i)
                    {
                        chkExcludeIgnoredDocs.Checked = ((string)filterDocs[i]).Equals("EXCLUDED");
                    }
                }


                ArrayList filterCCY = (ArrayList)hs["Currency"];
                totalChecked = 0;
                if (filterCCY != null)
                {
                    for (int i = 0; i < filterCCY.Count; ++i)
                    {
                        string code = (string)filterCCY[i];
                        for (int j = 0; j < ccyList.Items.Count; ++j)
                        {
                            if (ccyList.Items[j].Value.ToString().Equals(code))
                            {
                                ccyList.Items[j].CheckState = CheckState.Checked;
                                totalChecked++;
                                break;
                            }
                        }
                    }
                }
                if (totalChecked == ccyList.Items.Count)
                {
                    checkEdit2.CheckState = CheckState.Checked;
                }


                ArrayList cptyAddList = (ArrayList)hs["CptyAdditional"];
                totalChecked = 0;
                if (filterCCY != null)
                {
                    for (int i = 0; i < cptyAddList.Count; ++i)
                    {
                        string code = (string)cptyAddList[i];
                        for (int j = 0; j < additionalCprtsList.Items.Count; ++j)
                        {
                            if (additionalCprtsList.Items[j].Value.ToString().Equals(code))
                            {
                                additionalCprtsList.Items[j].CheckState = CheckState.Checked;
                                totalChecked++;
                                break;
                            }
                        }
                    }
                }
                if (totalChecked == additionalCprtsList.Items.Count)
                {
                    checkEdit4.CheckState = CheckState.Checked;
                }

                ArrayList filterCompany = (ArrayList)hs["BookingCompany"];
                totalChecked = 0;
                if (filterCompany != null)
                {
                    for (int i = 0; i < filterCompany.Count; ++i)
                    {
                        string code = (string)filterCompany[i];
                        for (int j = 0; j < cmpnyList.Items.Count; ++j)
                        {
                            if (cmpnyList.Items[j].Value.ToString().Equals(code))
                            {
                                cmpnyList.Items[j].CheckState = CheckState.Checked;
                                totalChecked++;
                                break;
                            }
                        }
                    }
                }
                if (totalChecked == cmpnyList.Items.Count)
                {
                    checkEdit3.CheckState = CheckState.Checked;
                }

                Hashtable condition = (Hashtable)hs["Counterparty"];
                int       index     = 0;
                if (condition != null)
                {
                    IDictionaryEnumerator iterator = condition.GetEnumerator();
                    shortName.Checked = true;
                    while (iterator.MoveNext())
                    {
                        string key   = (string)iterator.Key;
                        string value = (string)iterator.Value;
                        if ("AppliesTo".Equals(key, StringComparison.CurrentCultureIgnoreCase))
                        {
                            if ("Legal Name".Equals(value, StringComparison.CurrentCultureIgnoreCase))
                            {
                                legalName.Checked = true;
                            }
                            continue;
                        }

                        if (index == 0)
                        {
                            cboStart.SelectedItem = key;
                            txtStart.Text         = value;
                        }
                        else
                        {
                            cboEnd.SelectedItem = key;
                            txtEnd.Text         = value;
                        }
                        index++;
                    }
                }
            }
        }