コード例 #1
0
ファイル: changeCode.cs プロジェクト: oghenez/trade-software
 private bool SelectOldCodeList()
 {
     string SQLCmd = "",condStr="";
     string code = oldCodeEd.Text.Trim();
     string desc = oldDescEd.Text.Trim();
     
     code = code.Trim();
     if (code != "") condStr += (condStr == "" ? "" : " AND ") + "(a.customerCode LIKE '" + code + Consts.SQL_CMD_ALL_MARKER + "')";
     desc = desc.Trim();
     if (desc != "") condStr += (condStr == "" ? "" : " AND ") + "(a.name LIKE N'" + desc + Consts.SQL_CMD_ALL_MARKER + desc + Consts.SQL_CMD_ALL_MARKER + "')";
     SQLCmd += " SELECT * FROM customer";
     if (condStr != "") SQLCmd += " WHERE " + condStr;
     try
     {
         DataSet reportDataSet = new DataSet();
         SqlDataAdapter dataAdapter = new SqlDataAdapter(SQLCmd, data.dataLibs.GetMasterConnectionString());
         dataAdapter.Fill(reportDataSet);
         common.myComboBoxItem item;
         for (int idx = 0; idx < reportDataSet.Tables[0].Rows.Count; idx++)
         {
             item = new common.myComboBoxItem(reportDataSet.Tables[0].Rows[idx].ItemArray[0].ToString(),
                                              reportDataSet.Tables[0].Rows[idx].ItemArray[1].ToString());
             oldCodeLb.Items.Add(item);   
         }
         reportDataSet.Dispose(); dataAdapter.Dispose();
     }
     catch (Exception er)
     {
         common.sysLibs.ShowErrorMessage(er.Message.ToString());
         return false;
     }
     return true;
 }
コード例 #2
0
 private string GetStrategyDescription(string code)
 {
     for (int idx = 0; idx < strategyCb.Items.Count; idx++)
     {
         common.myComboBoxItem item = (common.myComboBoxItem)strategyCb.Items[idx];
         if (item.Value == code)
         {
             return(item.Text);
         }
     }
     return(null);
 }
コード例 #3
0
ファイル: changeCode.cs プロジェクト: oghenez/trade-software
        private bool SelectOldCodeList()
        {
            string SQLCmd = "", condStr = "";
            string code = oldCodeEd.Text.Trim();
            string desc = oldDescEd.Text.Trim();

            code = code.Trim();
            if (code != "")
            {
                condStr += (condStr == "" ? "" : " AND ") + "(a.customerCode LIKE '" + code + Consts.SQL_CMD_ALL_MARKER + "')";
            }
            desc = desc.Trim();
            if (desc != "")
            {
                condStr += (condStr == "" ? "" : " AND ") + "(a.name LIKE N'" + desc + Consts.SQL_CMD_ALL_MARKER + desc + Consts.SQL_CMD_ALL_MARKER + "')";
            }
            SQLCmd += " SELECT * FROM customer";
            if (condStr != "")
            {
                SQLCmd += " WHERE " + condStr;
            }
            try
            {
                DataSet        reportDataSet = new DataSet();
                SqlDataAdapter dataAdapter   = new SqlDataAdapter(SQLCmd, data.dataLibs.GetMasterConnectionString());
                dataAdapter.Fill(reportDataSet);
                common.myComboBoxItem item;
                for (int idx = 0; idx < reportDataSet.Tables[0].Rows.Count; idx++)
                {
                    item = new common.myComboBoxItem(reportDataSet.Tables[0].Rows[idx].ItemArray[0].ToString(),
                                                     reportDataSet.Tables[0].Rows[idx].ItemArray[1].ToString());
                    oldCodeLb.Items.Add(item);
                }
                reportDataSet.Dispose(); dataAdapter.Dispose();
            }
            catch (Exception er)
            {
                common.sysLibs.ShowErrorMessage(er.Message.ToString());
                return(false);
            }
            return(true);
        }
コード例 #4
0
        private void addAllBtn_Click(object sender, EventArgs e)
        {
            try
            {
                ClearNotifyError();
                if (strategyCb.myValue == "")
                {
                    NotifyError(strategyLbl);
                    return;
                }
                if (timeScaleClb.myItemString.Trim() == "")
                {
                    NotifyError(timeScaleLbl);
                    return;
                }
                databases.baseDS.portfolioDetailRow row;

                for (int idx = 0; idx < this.myDataTbl.Count; idx++)
                {
                    this.myDataTbl[idx].Delete();
                }
                for (int idx = 0; idx < strategyCb.Items.Count; idx++)
                {
                    common.myComboBoxItem item = (common.myComboBoxItem)strategyCb.Items[idx];
                    row = this.myDataTbl.NewportfolioDetailRow();
                    databases.AppLibs.InitData(row);
                    row.portfolio = this.myPorfolioCode;
                    row.code      = this.myStockCode;
                    row.subCode   = item.Value;
                    row.data      = timeScaleClb.myItemString;
                    this.myDataTbl.AddportfolioDetailRow(row);
                }
                Refresh();
            }
            catch (Exception er)
            {
                ErrorHandler(this, er);;
            }
        }
コード例 #5
0
ファイル: baseControl.cs プロジェクト: oghenez/trade-software
 public override void SetLanguage()
 {
     common.myComboBoxItem[] newItems = new common.myComboBoxItem[this.Items.Count];
     for (int idx = 0; idx < this.Items.Count; idx++)
     {
         common.myComboBoxItem item = (this.Items[idx] as common.myComboBoxItem);
         if (item.Value == Settings.sysString_All_Code)
         {
             newItems[idx] = new common.myComboBoxItem(Settings.sysString_All_Description, Settings.sysString_All_Code);
             continue;
         }
         commonClass.DataCategory cat = application.Strategy.StrategyData.myCatList.Find((item.Value));
         if (cat == null) continue;
         newItems[idx] =  new common.myComboBoxItem(cat.Description,cat.Code);
     }
     this.Items.Clear();
     this.Items.AddRange(newItems);
 }
コード例 #6
0
ファイル: language.cs プロジェクト: oghenez/trade-software
        //Swicth language. Note that the order of items must be preserved
        public static void SetLanguage(ComboBox.ObjectCollection items, Type type)
        {
            StringCollection saveKeys = new StringCollection();

            for (int idx = 0; idx < items.Count; idx++)
            {
                common.myComboBoxItem item = (common.myComboBoxItem)items[idx];
                saveKeys.Add(item.Value);
            }
            if (type == typeof(AppTypes.TimeScale))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindTimeScaleByCode(saveKeys[idx]);
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.TimeScale item = (AppTypes.TimeScale)obj;
                    items.Add(new common.myComboBoxItem(item.Description, item.Code));
                }
                return;
            }

            if (type == typeof(AppTypes.TradeActions))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.TradeActions));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.TradeActions item = (AppTypes.TradeActions)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }


            if (type == typeof(AppTypes.TimeRanges))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.TimeRanges));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.TimeRanges item = (AppTypes.TimeRanges)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.StrategyTypes))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.StrategyTypes));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.StrategyTypes item = (AppTypes.StrategyTypes)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.Sex))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.Sex));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.Sex item = (AppTypes.Sex)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.CommonStatus))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.CommonStatus));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.CommonStatus item = (AppTypes.CommonStatus)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.ChartTypes))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.ChartTypes));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.ChartTypes item = (AppTypes.ChartTypes)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.BizSectorTypes))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.BizSectorTypes));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.BizSectorTypes item = (AppTypes.BizSectorTypes)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
        }