/// <summary>
        /// 绑定具体筛选条件
        /// </summary>
        /// <param name="item"></param>
        private void BindFilterConditions(AllFilterData item)
        {
            cmbsttype.SelectedIndex = (item.FilterType - 1);
            txtstname.Text          = item.StrategyName;
            if (item.IsValid == "1")
            {
                rdbValid.IsChecked = true;
            }
            else
            {
                rdbInValid.IsChecked = true;
            }
            try
            {
                DateTime dtstart = Convert.ToDateTime(item.DateStart.Insert(12, ":").Insert(10, ":").Insert(8, " ").Insert(6, "-").Insert(4, "-"));
                DateStart.Text = dtstart.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
                DateTime dtend = Convert.ToDateTime(item.DateEnd.Insert(12, ":").Insert(10, ":").Insert(8, " ").Insert(6, "-").Insert(4, "-"));
                DateEnd.Text = dtend.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
                txtdes.Text  = item.Remarks;
            }
            catch { }
            SPAllParameters.Children.Clear();
            int count = item.listFilterCondition.Count;

            for (int i = 0; i < count; i++)
            {
                CreateUC(item.listFilterCondition[i]);
            }
        }
        void LvStrategy_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AllFilterData item = LvStrategy.SelectedItem as AllFilterData;

            if (item != null)
            {
                mCurrentSelFilter = item;
                BindFilterConditions(item);
            }
        }
        /// <summary>
        ///  删除筛选策略
        /// </summary>
        private void DeleteFilterStrategy()
        {
            AllFilterData item = LvStrategy.SelectedItem as AllFilterData;

            if (item != null)
            {
                string           messageBoxText = App.GetLanguageInfo("2101T00031", "Confirm Remove?");
                MessageBoxButton button         = MessageBoxButton.OKCancel;
                MessageBoxImage  icon           = MessageBoxImage.Warning;
                MessageBoxResult result         = MessageBox.Show(messageBoxText, App.AppName, button, icon);
                switch (result)
                {
                case MessageBoxResult.Cancel:
                    return;
                }

                try
                {
                    WebRequest webRequest = new WebRequest();
                    webRequest.Session = App.Session;
                    webRequest.Code    = (int)S2101Codes.DeleteStrategy;
                    webRequest.ListData.Add(item.StrategyCode.ToString());//筛选策略编码
                    //Service21011Client client = new Service21011Client();
                    Service21011Client client = new Service21011Client(WebHelper.CreateBasicHttpBinding(App.Session), WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service21011"));
                    //WebHelper.SetServiceClient(client);
                    WebReturn webReturn = client.DoOperation(webRequest);
                    client.Close();
                    if (!webReturn.Result)
                    {
                        App.ShowExceptionMessage(string.Format("{0}\t{1}", App.GetLanguageInfo("2101T00027", "Operation Field."), webReturn.Message));
                        return;
                    }
                    else
                    {
                        string strLog = string.Format("{0}{1}{2}", App.Session.UserInfo.UserName, Utils.FormatOptLogString(string.Format("FO2101003")), item.StrategyName);
                        App.WriteOperationLog("2101", ConstValue.OPT_RESULT_SUCCESS, strLog);
                        //操作成功 刷新数据
                        InitFilters();
                        App.ShowInfoMessage(App.GetLanguageInfo("2101T00026", "Operation Succeed."));
                    }
                }
                catch (Exception ex)
                { App.ShowExceptionMessage(string.Format("{0}\t{1}", App.GetLanguageInfo("2101T00027", "Operation Field."), ex.Message)); }
            }
            else
            {
                App.ShowInfoMessage(App.GetLanguageInfo("2101T00029", "Please select at least one Strategy."));
            }
        }
 private void InitFilters()
 {
     try
     {
         try
         {
             mListGetAllFilter.Clear();
         }
         catch { }
         WebRequest webRequest = new WebRequest();
         webRequest.Code    = (int)S2101Codes.GetFilterWithCreator;
         webRequest.Session = App.Session;
         //Service21011Client client = new Service21011Client();
         Service21011Client client = new Service21011Client(WebHelper.CreateBasicHttpBinding(App.Session), WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service21011"));
         //WebHelper.SetServiceClient(client);
         WebReturn webReturn = client.DoOperation(webRequest);
         client.Close();
         if (!webReturn.Result)
         {
             App.ShowExceptionMessage(string.Format("{0}\t{1}", App.GetLanguageInfo("2101T00027", "Operation Field."), webReturn.Message));
             return;
         }
         if (webReturn.ListData.Count > 0)
         {
             for (int i = 0; i < webReturn.ListData.Count; i++)
             {
                 OperationReturn optReturn = XMLHelper.DeserializeObject <AllFilterData>(webReturn.ListData[i]);
                 if (!optReturn.Result)
                 {
                     App.ShowExceptionMessage(string.Format("{0}\t{1}", App.GetLanguageInfo("2101T00027", "Operation Field."), webReturn.Message));
                     return;
                 }
                 AllFilterData fdata = optReturn.Data as AllFilterData;
                 if (fdata != null)
                 {
                     fdata.StrategyName = App.DecryptString(fdata.StrategyName);
                     fdata.StrIsValid   = fdata.IsValid == "1" ? App.GetLanguageInfo("2101T00020", "Valid") : App.GetLanguageInfo("2101T00021", "InValid");
                     mListGetAllFilter.Add(fdata);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         App.ShowExceptionMessage(ex.Message);
     }
 }
Exemple #5
0
        private OperationReturn GetFilterWithCreator(SessionInfo session, List <string> listParams)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                DataSet objDataSet;
                switch (session.DBType)
                {
                case 2:
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, "SELECT T202.*,T005.C002 USERCOUNT,T005.C003 USERNAME FROM T_00_202 T202 LEFT JOIN T_11_005_00000 T005 ON T202.C007=T005.C001 WHERE T202.C006<>'1'");
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                case 3:
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, "SELECT T202.*,T005.C002 USERCOUNT,T005.C003 USERNAME FROM T_00_202 T202 LEFT JOIN T_11_005_00000 T005 ON T202.C007=T005.C001 WHERE T202.C006<>'1'");
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType);
                    return(optReturn);
                }
                if (objDataSet == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DataSet is null");
                    return(optReturn);
                }
                List <string> listReturn = new List <string>();
                for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                {
                    DataRow       dr    = objDataSet.Tables[0].Rows[i];
                    AllFilterData allfd = new AllFilterData();
                    allfd.FilterType   = Convert.ToInt32(dr["C001"]);
                    allfd.StrategyType = dr["C002"].ToString();
                    allfd.StrategyCode = Convert.ToInt64(dr["C003"].ToString());
                    allfd.StrategyName = DecryptFromDB(dr["C004"].ToString());
                    allfd.IsValid      = dr["C005"].ToString();
                    allfd.IsDelete     = dr["C006"].ToString();
                    allfd.Creator      = Convert.ToInt64(dr["C007"].ToString());
                    allfd.CreateTime   = dr["C008"].ToString();
                    allfd.FilterNumber = Convert.ToInt32(dr["C009"]);
                    allfd.DateStart    = dr["C010"].ToString();
                    allfd.DateEnd      = dr["C011"].ToString();
                    allfd.Remarks      = dr["C012"].ToString();
                    allfd.CreatorName  = DecryptFNames(dr["USERCOUNT"]);


                    #region 获取筛选条件
                    List <CFilterCondition> lstcf = new List <CFilterCondition>();
                    if (objDataSet.Tables[0].Rows.Count > 0)
                    {
                        DataSet objDataSetFc = new DataSet();
                        switch (session.DBType)
                        {
                        case 2:
                            optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, string.Format("SELECT * FROM T_00_204 WHERE C001={0}", allfd.StrategyCode));
                            if (!optReturn.Result)
                            {
                                return(optReturn);
                            }
                            objDataSetFc = optReturn.Data as DataSet;
                            break;

                        case 3:
                            optReturn = OracleOperation.GetDataSet(session.DBConnectionString, string.Format("SELECT * FROM T_00_204 WHERE C001={0}", allfd.StrategyCode));
                            if (!optReturn.Result)
                            {
                                return(optReturn);
                            }
                            objDataSetFc = optReturn.Data as DataSet;
                            break;
                        }
                        if (objDataSetFc != null && objDataSetFc.Tables[0].Rows.Count > 0)
                        {
                            for (int j = 0; j < objDataSetFc.Tables[0].Rows.Count; j++)
                            {
                                DataRow          drj    = objDataSetFc.Tables[0].Rows[j];
                                CFilterCondition tempfc = new CFilterCondition();
                                tempfc.FilterTarget  = Convert.ToInt32(drj["C002"].ToString());
                                tempfc.ID            = Convert.ToInt32(drj["C003"].ToString());
                                tempfc.ConditionName = StringPress(drj["C005"]);
                                tempfc.Operator      = StringPress(drj["C006"]);
                                tempfc.isEnum        = StringPress(drj["C007"]);
                                tempfc.Value         = StringPress(drj["C008"]);
                                tempfc.Logical       = StringPress(drj["C009"]);
                                lstcf.Add(tempfc);
                            }
                        }
                    }
                    #endregion


                    allfd.listFilterCondition = lstcf;
                    optReturn = XMLHelper.SeriallizeObject(allfd);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    listReturn.Add(optReturn.Data.ToString());
                }
                optReturn.Data = listReturn;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
                return(optReturn);
            }
            return(optReturn);
        }
Exemple #6
0
        private OperationReturn SubmitStrategies(SessionInfo session, List <string> listParams, string strData)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;

            try
            {
                //ListParams
                //0 添加策略,1 修改策略
                if (listParams == null || listParams.Count < 1)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("Request param is null or count invalid");
                    return(optReturn);
                }
                bool mIsAdd = listParams[0] == "0" ? true : false;
                optReturn = XMLHelper.DeserializeObject <AllFilterData>(strData);
                if (!optReturn.Result)
                {
                    return(optReturn);
                }
                AllFilterData allfilter = optReturn.Data as AllFilterData;
                if (allfilter == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("AllFilterData Is Null");
                    return(optReturn);
                }
                string rentToken = session.RentInfo.Token;
                string strSql;


                #region 202Add
                IDbConnection    objConn, objConnFc;
                IDbDataAdapter   objAdapter, objAdapterFc;
                DbCommandBuilder objCmdBuilder, objCmdBuilderFc;
                switch (session.DBType)
                {
                case 2:
                    if (mIsAdd)
                    {
                        strSql = string.Format("SELECT * FROM T_00_202 WHERE C004 IN ('{0}','{1}') AND C006<>'1'",
                                               allfilter.StrategyName.ToUpper(),
                                               allfilter.StrategyName.ToLower());
                    }
                    else
                    {
                        strSql = string.Format("SELECT * FROM T_00_202 WHERE C003 = {0}",
                                               allfilter.StrategyCode);
                    }
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objConn       = MssqlOperation.GetConnection(session.DBConnectionString);
                    objAdapter    = MssqlOperation.GetDataAdapter(objConn, strSql);
                    objCmdBuilder = MssqlOperation.GetCommandBuilder(objAdapter);
                    break;

                case 3:
                    if (mIsAdd)
                    {
                        strSql = string.Format("SELECT * FROM T_00_202 WHERE C004 IN ('{0}','{1}') AND C006<>'1'",
                                               allfilter.StrategyName.ToUpper(),
                                               allfilter.StrategyName.ToLower());
                    }
                    else
                    {
                        strSql = string.Format("SELECT * FROM T_00_202 WHERE C003 = {0}",
                                               allfilter.StrategyCode);
                    }
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objConn       = OracleOperation.GetConnection(session.DBConnectionString);
                    objAdapter    = OracleOperation.GetDataAdapter(objConn, strSql);
                    objCmdBuilder = OracleOperation.GetCommandBuilder(objAdapter);
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType);
                    return(optReturn);
                }
                if (objConn == null || objAdapter == null || objCmdBuilder == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("Db object is null");
                    return(optReturn);
                }
                objCmdBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                objCmdBuilder.SetAllValues   = false;
                DataSet objDataSet = new DataSet();
                objAdapter.Fill(objDataSet);
                if (objDataSet.Tables[0].Rows.Count > 0 && mIsAdd)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_ALREADY_EXIST;
                    optReturn.Message = string.Format("Data already exists");
                    return(optReturn);
                }
                DataRow drAdd, drModify;
                string  tempStrCode = "-1";
                if (mIsAdd)//添加
                {
                    drAdd         = objDataSet.Tables[0].NewRow();
                    drAdd["C000"] = rentToken;
                    drAdd["C001"] = allfilter.FilterType;
                    drAdd["C002"] = allfilter.StrategyType;
                    drAdd["C003"] = allfilter.StrategyCode;
                    drAdd["C004"] = EncryptDecryptToDB(allfilter.StrategyName);
                    drAdd["C005"] = allfilter.IsValid;
                    drAdd["C006"] = allfilter.IsDelete;
                    drAdd["C007"] = allfilter.Creator;
                    drAdd["C008"] = allfilter.CreateTime;
                    drAdd["C009"] = allfilter.FilterNumber;
                    drAdd["C010"] = allfilter.DateStart;
                    drAdd["C011"] = allfilter.DateEnd;
                    drAdd["C012"] = allfilter.Remarks;
                    drAdd["C021"] = 0;
                    objDataSet.Tables[0].Rows.Add(drAdd);
                }
                else
                {
                    drModify    = objDataSet.Tables[0].Rows[0];
                    tempStrCode = drModify["C003"].ToString();
                    //drModify["C000"] = rentToken;
                    drModify["C001"] = allfilter.FilterType;
                    drModify["C002"] = allfilter.StrategyType;
                    //drModify["C003"] = allfilter.StrategyCode;
                    drModify["C004"] = EncryptDecryptToDB(allfilter.StrategyName);
                    drModify["C005"] = allfilter.IsValid;
                    drModify["C006"] = allfilter.IsDelete;
                    drModify["C007"] = allfilter.Creator;
                    drModify["C008"] = allfilter.CreateTime;
                    //drModify["C009"] = allfilter.FilterNumber;
                    drModify["C010"] = allfilter.DateStart;
                    drModify["C011"] = allfilter.DateEnd;
                    drModify["C012"] = allfilter.Remarks;
                }
                #endregion


                #region 204Add
                switch (session.DBType)
                {
                case 2:
                    strSql    = string.Format("SELECT * FROM T_00_204 WHERE C001={0}", tempStrCode);
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objConnFc       = MssqlOperation.GetConnection(session.DBConnectionString);
                    objAdapterFc    = MssqlOperation.GetDataAdapter(objConnFc, strSql);
                    objCmdBuilderFc = MssqlOperation.GetCommandBuilder(objAdapterFc);
                    break;

                case 3:
                    strSql    = string.Format("SELECT * FROM T_00_204 WHERE C001={0}", tempStrCode);
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objConnFc       = OracleOperation.GetConnection(session.DBConnectionString);
                    objAdapterFc    = OracleOperation.GetDataAdapter(objConnFc, strSql);
                    objCmdBuilderFc = OracleOperation.GetCommandBuilder(objAdapterFc);
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("Database type not surpport.\t{0}", session.DBType);
                    return(optReturn);
                }
                if (objConnFc == null || objAdapterFc == null || objCmdBuilderFc == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("Db object is null");
                    return(optReturn);
                }
                objCmdBuilderFc.ConflictOption = ConflictOption.OverwriteChanges;
                objCmdBuilderFc.SetAllValues   = false;
                DataSet objDataSetFc = new DataSet();
                objAdapterFc.Fill(objDataSetFc);
                int tempcount = objDataSetFc.Tables[0].Rows.Count;
                if (!mIsAdd)//修改
                {
                    //objDataSetFc.Tables[0].Rows.Clear();
                    try
                    {
                        switch (session.DBType)
                        {
                        //MSSQL
                        case 2:
                            strSql    = string.Format("DELETE FROM T_00_204 WHERE C001={0}", tempStrCode);
                            optReturn = MssqlOperation.ExecuteSql(session.DBConnectionString, strSql);
                            break;

                        //ORCL
                        case 3:
                            strSql    = string.Format("DELETE FROM T_00_204 WHERE C001={0}", tempStrCode);
                            optReturn = OracleOperation.ExecuteSql(session.DBConnectionString, strSql);
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        optReturn.Result  = false;
                        optReturn.Code    = Defines.RET_FAIL;
                        optReturn.Message = ex.Message;
                        return(optReturn);
                    }
                }
                foreach (CFilterCondition cfc in allfilter.listFilterCondition)
                {
                    DataRow drAddFc = objDataSetFc.Tables[0].NewRow();
                    drAddFc["C001"] = allfilter.StrategyCode;
                    drAddFc["C002"] = cfc.FilterTarget;
                    drAddFc["C003"] = cfc.ID;
                    drAddFc["C005"] = cfc.ConditionName;
                    drAddFc["C006"] = cfc.Operator;
                    drAddFc["C007"] = cfc.isEnum;
                    drAddFc["C008"] = cfc.Value;
                    drAddFc["C009"] = cfc.Logical;
                    objDataSetFc.Tables[0].Rows.Add(drAddFc);
                }
                #endregion


                try
                {
                    objAdapter.Update(objDataSet);
                    objDataSet.AcceptChanges();
                    objAdapterFc.Update(objDataSetFc);
                    objDataSetFc.AcceptChanges();
                }
                catch (Exception ex)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_DBACCESS_FAIL;
                    optReturn.Message = ex.Message;
                }
                finally
                {
                    if (objConn.State == ConnectionState.Open)
                    {
                        objConn.Close();
                    }
                    objConn.Dispose();
                    if (objConnFc.State == ConnectionState.Open)
                    {
                        objConnFc.Close();
                    }
                    objConnFc.Dispose();
                }
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = string.Format(ex.Message + "; " + ex.StackTrace + "; " + ex.Source);
            }
            return(optReturn);
        }
        /// <summary>
        ///  修改筛选策略
        /// </summary>
        private void UpdateFilterStrategy()
        {
            AllFilterData item = LvStrategy.SelectedItem as AllFilterData;

            if (item != null)
            {
                string           messageBoxText = App.GetLanguageInfo("2101T00030", "Confirm Update?");
                MessageBoxButton button         = MessageBoxButton.OKCancel;
                MessageBoxImage  icon           = MessageBoxImage.Warning;
                MessageBoxResult result         = MessageBox.Show(messageBoxText, App.AppName, button, icon);
                switch (result)
                {
                case MessageBoxResult.Cancel:
                    return;
                }
                try
                {
                    mlstcfoperator.Clear();
                    #region 条件
                    if (cmbsttype.SelectedItem == null || string.IsNullOrWhiteSpace(txtstname.Text) || !IsValidDate(DateStart.Text) || !IsValidDate(DateEnd.Text))
                    {
                        App.ShowInfoMessage(App.GetLanguageInfo("2101T00024", "Illegal Parameter"));
                        return;
                    }
                    foreach (var c in SPAllParameters.Children)
                    {
                        if (c is UC_ConditionTextbox)
                        {
                            UC_ConditionTextbox tb = (UC_ConditionTextbox)c;
                            if (tb.Name.Contains("uc"))
                            {
                                try
                                {
                                    ComboBox cmbcondition = tb.cmbcondition as ComboBox;
                                    ComboBox cmbope       = tb.cmbope as ComboBox;
                                    TextBox  txtval       = tb.txtval as TextBox;
                                    ComboBox cmblog       = tb.cmblog as ComboBox;
                                    if (!string.IsNullOrWhiteSpace(cmbcondition.Text) &&
                                        !string.IsNullOrWhiteSpace(cmbope.Text) &&
                                        !string.IsNullOrWhiteSpace(txtval.Text))
                                    {
                                        StrategyInfo selStrategy = (cmbcondition.SelectionBoxItem as StrategyInfo);
                                        if (selStrategy.ConditionName.ToUpper() == "C004" || selStrategy.ConditionName.ToUpper() == "C005")
                                        {
                                            //时间格式判断
                                            if (!IsDateTimeValue(txtval.Text))
                                            {
                                                App.ShowInfoMessage(App.GetLanguageInfo("2101T00028", "Invalid Format."));//+ "\t" + "2015-01-01 01:01:01"
                                                return;
                                            }
                                        }
                                        int id = int.Parse(tb.Name.Substring(2, tb.Name.Length - 2));
                                        CFilterCondition tempfc = new CFilterCondition();
                                        tempfc.FilterTarget  = 1;
                                        tempfc.ID            = id;
                                        tempfc.ConditionName = (cmbcondition.SelectionBoxItem as StrategyInfo).ConditionName;
                                        tempfc.Operator      = cmbope.Text;
                                        tempfc.isEnum        = txtval.Text.Length > 1024 ? "1" : "0";
                                        tempfc.Value         = txtval.Text;
                                        tempfc.Logical       = cmblog.Text;
                                        mlstcfoperator.Add(tempfc);
                                    }
                                }
                                catch
                                { }
                            }
                        }
                    }
                    if (mlstcfoperator.Count < 1)
                    {
                        App.ShowInfoMessage(App.GetLanguageInfo("2101T00024", "Illegal Parameter"));
                        return;
                    }
                    #endregion
                    AllFilterData allfd = new AllFilterData();
                    allfd.FilterType   = 1;
                    allfd.StrategyCode = item.StrategyCode;
                    allfd.StrategyType = cmbsttype.SelectedValue.ToString();
                    allfd.StrategyName = txtstname.Text;
                    allfd.IsValid      = rdbValid.IsChecked == true ? "1" : "0";
                    allfd.IsDelete     = "0";
                    allfd.Creator      = App.Session.UserID;
                    allfd.CreateTime   = DateTime.Now.ToUniversalTime().ToString("yyyyMMddHHmmss");
                    //allfd.FilterNumber = 0;
                    allfd.DateStart           = Convert.ToDateTime(DateStart.Text).ToUniversalTime().ToString("yyyyMMddHHmmss");
                    allfd.DateEnd             = Convert.ToDateTime(DateEnd.Text).ToUniversalTime().ToString("yyyyMMddHHmmss");
                    allfd.Remarks             = txtdes.Text;
                    allfd.listFilterCondition = mlstcfoperator;

                    WebRequest webRequest = new WebRequest();
                    webRequest.Session = App.Session;
                    webRequest.Code    = (int)S2101Codes.SubmitStrategies;
                    OperationReturn optReturn = XMLHelper.SeriallizeObject(allfd);
                    if (!optReturn.Result)
                    {
                        App.ShowExceptionMessage(string.Format("{0}\t{1}", App.GetLanguageInfo("2101T00027", "Operation Field."), optReturn.Message));
                        return;
                    }
                    webRequest.Data = optReturn.Data.ToString();
                    webRequest.ListData.Add("1");//1 修改策略
                    //Service21011Client client = new Service21011Client();
                    Service21011Client client = new Service21011Client(WebHelper.CreateBasicHttpBinding(App.Session), WebHelper.CreateEndpointAddress(App.Session.AppServerInfo, "Service21011"));
                    //WebHelper.SetServiceClient(client);
                    WebReturn webReturn = client.DoOperation(webRequest);
                    client.Close();
                    if (!webReturn.Result)
                    {
                        if (webReturn.Code == Defines.RET_ALREADY_EXIST)
                        {
                            App.ShowExceptionMessage(App.GetLanguageInfo("2101T00025", "Filter Strategy exists."));
                        }
                        else
                        {
                            App.ShowExceptionMessage(string.Format("{0}\t{1}", App.GetLanguageInfo("2101T00027", "Operation Field."), webReturn.Message));
                        }
                        return;
                    }
                    else
                    {
                        string strLog = string.Format("{0}{1}{2}", App.Session.UserInfo.UserName, Utils.FormatOptLogString(string.Format("FO2101002")), item.StrategyName + "->" + allfd.StrategyName);
                        App.WriteOperationLog("2101", ConstValue.OPT_RESULT_SUCCESS, strLog);
                        //操作成功 刷新数据
                        InitFilters();
                        App.ShowInfoMessage(App.GetLanguageInfo("2101T00026", "Operation Succeed."));
                    }
                }
                catch (Exception ex)
                { App.ShowExceptionMessage(string.Format("{0}\t{1}", App.GetLanguageInfo("2101T00027", "Operation Field."), ex.Message)); }
            }
            else
            {
                App.ShowInfoMessage(App.GetLanguageInfo("2101T00029", "Please select at least one Strategy."));
            }
        }