public void Insert(System.Web.UI.WebControls.SqlDataSource dataSource, string table)
        {
            string sqlCount;
            string sqlInsert;

            System.Data.DataView selectTable = new System.Data.DataView();
            int count;

            sqlCount = "SELECT * FROM " + table;

            dataSource.SelectCommand = sqlCount;
            selectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            //find out how many records are in the table in order to set the primary key
            count = selectTable.Count;

            //Insert
            sqlInsert = "INSERT INTO " + table
                        + "(srAccID,partName,description,partNumber,color,usdPrice,cadPrice,status)"
                        + "VALUES"
                        + "(" + (count + 1) + ",'" + Sunrail300AccessoriesName + "','" + Sunrail300AccessoriesDescription + "','" + PartNumber + "','"
                        + Sunrail300AccessoriesColor + "',"
                        + Sunrail300AccessoriesUsdPrice + "," + Sunrail300AccessoriesCadPrice + "," + 1 + ")";


            dataSource.InsertCommand = sqlInsert;
            dataSource.Insert();
        }
Exemple #2
0
        public void Insert(System.Web.UI.WebControls.SqlDataSource dataSource, string table)
        {
            string sqlCount;
            string sqlInsert;

            System.Data.DataView selectTable = new System.Data.DataView();
            int count;

            sqlCount = "SELECT * FROM " + table;

            dataSource.SelectCommand = sqlCount;
            selectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            count = selectTable.Count;

            try
            {
                sqlInsert = "INSERT INTO " + table
                            + "(accId,partName,description,partNumber,color,packQuantity,width,widthUnits,length,lengthUnits,size,sizeUnits,usdPrice,cadPrice,status)"
                            + "VALUES"
                            + "(" + (count + 1) + ",'" + AccessoryName + "','" + AccessoryDescription + "','" + AccessoryNumber + "','" + AccessoryColor + "'," + AccessoryPackQuantity + ","
                            + AccessoryWidth + ",'" + AccessoryWidthUnits + "'," + AccessoryLength + ",'" + AccessoryLengthUnits + "'," + AccessorySize + ",'" + accessorySizeUnits + "',"
                            + AccessoryUsdPrice + "," + AccessoryCadPrice + "," + 1 + ")";

                dataSource.InsertCommand = sqlInsert;
                dataSource.Insert();
            }
            catch (Exception ex)
            {
                string troubleshoot = ex.Message;
            }
        }
        public void TransferDetailServiceTest()
        {
            string Username = "******";
            string PassWord = "******";
            var mockAuthenticationManager = new Mock<IAuthenticationManager>();
            mockAuthenticationManager.Setup(am => am.SignOut());
            mockAuthenticationManager.Setup(am => am.SignIn());
            IdentityHelper.AuthenticationManager = mockAuthenticationManager.Object;

            HttpContext.Current = FakeHttpContext();
            AppDomain.CurrentDomain.SetData(
                                    "DataDirectory", @"C:\Users\Priyank Kapadia\Documents\Visual Studio 2015\Projects\BnkApplication\BnkApplication\App_Data\");

            bool RememberME = true;
            LoginService servicetest = new LoginService(Username, PassWord, RememberME);
            servicetest.Login();
            // Role Authentication the user who is not admin should not be able to view all details

            // faking the object as in the UI
            System.Web.UI.WebControls.SqlDataSource sql = new System.Web.UI.WebControls.SqlDataSource();
            sql.SelectCommand = "SELECT * FROM [Table]";

            TransferDetailService testserv = new TransferDetailService(sql,Username);
            Assert.AreEqual("SELECT * FROM [Table] where PAYER_NAME ='" + Username + "'", sql.SelectCommand);
        }
        public void TransferDetailServiceTest()
        {
            string Username = "******";
            string PassWord = "******";
            var    mockAuthenticationManager = new Mock <IAuthenticationManager>();

            mockAuthenticationManager.Setup(am => am.SignOut());
            mockAuthenticationManager.Setup(am => am.SignIn());
            IdentityHelper.AuthenticationManager = mockAuthenticationManager.Object;

            HttpContext.Current = FakeHttpContext();
            AppDomain.CurrentDomain.SetData(
                "DataDirectory", @"C:\Users\Priyank Kapadia\Documents\Visual Studio 2015\Projects\BnkApplication\BnkApplication\App_Data\");

            bool         RememberME  = true;
            LoginService servicetest = new LoginService(Username, PassWord, RememberME);

            servicetest.Login();
            // Role Authentication the user who is not admin should not be able to view all details

            // faking the object as in the UI
            System.Web.UI.WebControls.SqlDataSource sql = new System.Web.UI.WebControls.SqlDataSource();
            sql.SelectCommand = "SELECT * FROM [Table]";

            TransferDetailService testserv = new TransferDetailService(sql, Username);

            Assert.AreEqual("SELECT * FROM [Table] where PAYER_NAME ='" + Username + "'", sql.SelectCommand);
        }
        public void Insert(System.Web.UI.WebControls.SqlDataSource dataSource, string table)
        {
            string sqlCount;
            string sqlInsert;

            System.Data.DataView selectTable = new System.Data.DataView();
            int count;

            sqlCount = "SELECT * FROM " + table;

            dataSource.SelectCommand = sqlCount;
            selectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            //find out how many records are in the table in order to set the primary key
            count = selectTable.Count;

            //Insert
            sqlInsert = "INSERT INTO " + table
                        + "(insulatedFloorID,partName,description,composition,partNumber,size,sizeUnits,maxWidth,widthUnits,maxLength,usdPrice,cadPrice,status)"
                        + "VALUES"
                        + "(" + (count + 1) + ",'" + InsulatedFloorName + "','" + InsulatedFloorDescription + "','" + InsulatedFloorComposition + "','" + PartNumber + "'," + InsulatedFloorSize + ",'"
                        + InsulatedFloorSizeUnits + "'," + InsulatedFloorMaxWidth + ",'" + InsulatedFloorMaxWidthUnits + "','" + InsulatedFloorMaxLength + "',"
                        + InsulatedFloorUsdPrice + "," + InsulatedFloorCadPrice + "," + 1 + ")";

            dataSource.InsertCommand = sqlInsert;
            dataSource.Insert();
        }
Exemple #6
0
        public void Insert(System.Web.UI.WebControls.SqlDataSource dataSource, string table)
        {
            string sqlCount;
            string sqlInsert;

            System.Data.DataView selectTable = new System.Data.DataView();
            int count;

            sqlCount = "SELECT * FROM " + table;

            dataSource.SelectCommand = sqlCount;
            selectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            //find out how many records are in the table in order to set the primary key
            count = selectTable.Count;

            //Insert
            sqlInsert = "INSERT INTO " + table
                        + "(extrusionID,partName,description,partNumber,size,sizeUnits,color,extrusionAngleA,angleAUnits,extrusionAngleB,angleBUnits,extrusionAngleC,angleCUnits,maxLength,lengthUnits,usdPrice,cadPrice,status)"
                        + "VALUES"
                        + "(" + (count + 1) + ",'" + ExtrusionName + "','" + ExtrusionDescription + "','" + ExtrusionNumber + "'," + ExtrusionSize + ",'"
                        + SizeUnits + "','" + ExtrusionColor + "'," + AngleA + ",'" + AngleAUnits + "'," + AngleB + ",'" + AngleBUnits + "'," + AngleC + ",'" + AngleCUnits + "'," + ExtrusionMaxLength + ",'" + MaxLengthUnits + "',"
                        + UsdPrice + "," + CadPrice + "," + 1 + ")";

            dataSource.InsertCommand = sqlInsert;
            dataSource.Insert();
        }
Exemple #7
0
        public void Insert(System.Web.UI.WebControls.SqlDataSource dataSource, string table)
        {
            string sqlCount;
            string sqlInsert;

            System.Data.DataView selectTable = new System.Data.DataView();
            int count;

            sqlCount = "SELECT * FROM " + table;

            dataSource.SelectCommand = sqlCount;
            selectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            //find out how many records are in the table in order to set the primary key
            count = selectTable.Count;

            //Insert
            sqlInsert = "INSERT INTO " + table
                        + "(rollID,partName,partNumber,width,widthUnits,length,lengthUnits,usdPrice,cadPrice,status)"
                        + "VALUES"
                        + "(" + (count + 1) + ",'" + ScreenRollName + "','" + PartNumber + "'," + ScreenRollWidth + ",'" + ScreenRollWidthUnits + "',"
                        + ScreenRollLength + ",'" + ScreenRollLengthUnits + "',"
                        + UsdPrice + "," + CadPrice + "," + 1 + ")";


            dataSource.InsertCommand = sqlInsert;
            dataSource.Insert();
        }
Exemple #8
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string partNum)
        {
            dataSource.UpdateCommand = "UPDATE tblSchematicParts SET usdPrice=" + PartUsdPrice
                                       + ", cadPrice=" + PartCadPrice
                                       + " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
        public TransferDetailService(System.Web.UI.WebControls.SqlDataSource sql, string name)
        {
            //if (System.Web.HttpContext.Current.Session["AdminFlag"] == null) // This part is modified to see if that
            //{

            //sql.SelectCommand = "SELECT * FROM [Table] where PAYER_NAME ='" + name + "'";
            //}
        }
Exemple #10
0
        //Select all parts from the database
        public System.Data.DataView SelectAll(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            //set up a dataview object for object member data
            System.Data.DataView anObjectTable = new System.Data.DataView();

            //select row based on table name and part number
            dataSource.SelectCommand = "SELECT schematicNumber, description, partName, usdPrice, cadPrice, status FROM " + table + " WHERE schematicNumber='" + partNum + "'";

            //assign the row to the dataview object
            anObjectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            //return the DataView object
            return(anObjectTable);
        }
Exemple #11
0
        public DataView getUserListData()
        {
            System.Web.UI.WebControls.SqlDataSource sds = new System.Web.UI.WebControls.SqlDataSource();
            sds.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            String SQLStr = "SELECT username,name,dep,mail,note FROM AspNetLinkUserData";

            sds.SelectParameters.Clear();
            //sds.SelectParameters.Add("group_name", "%" + group_name + "%");
            sds.SelectCommand = SQLStr;

            DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);

            return(dv);
        }
Exemple #12
0
        //刪除使用者
        public bool DeleteUser(string username)
        {
            var Db   = new ApplicationDbContext();
            var user = Db.Users.First(u => u.UserName == username);

            Db.Users.Remove(user);
            Db.SaveChanges();

            System.Web.UI.WebControls.SqlDataSource sds = new System.Web.UI.WebControls.SqlDataSource();
            sds.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            String SQLStr = "DELETE AspNetLinkUserData Where username = @username";

            sds.DeleteParameters.Add("username", username);
            sds.DeleteCommand = SQLStr;
            sds.Delete();

            return(true);
        }
Exemple #13
0
        //Database select all
        public System.Data.DataView SelectAll(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            //set up a dataview object for object member data
            System.Data.DataView anObjectTable = new System.Data.DataView();

            //select row based on table name and part number
            dataSource.SelectCommand = "SELECT partName, description, partNumber, color, size, sizeUnits, extrusionAngleA,"
                                       + " angleAUnits, extrusionAngleB, angleBUnits, extrusionAngleC, angleCUnits, maxLength, lengthUnits, usdPrice, cadPrice, status FROM "
                                       + table
                                       + " WHERE partNumber = '"
                                       + partNum + "'";

            //assign the row to the dataview object
            anObjectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            //return the DataView object
            return(anObjectTable);
        }
Exemple #14
0
        //Select all parts from the database
        public System.Data.DataView SelectAll(System.Web.UI.WebControls.SqlDataSource dataSource, string partNum, string schematicNum)
        {
            //set up a dataview object for object member data
            System.Data.DataView anObjectTable = new System.Data.DataView();

            //select row based on table name and part number
            dataSource.SelectCommand = "SELECT tblParts.partNumber,tblParts.partName,tblSchematicParts.SchematicNumber, tblSchematicParts.usdPrice, tblSchematicParts.cadPrice, " +
                                       "tblSchematicParts.keyNumber " +
                                       "FROM tblParts " +
                                       "INNER JOIN tblSchematicParts " +
                                       "ON tblParts.partNumber = tblSchematicParts.partNumber " +
                                       "WHERE tblParts.partNumber = '" + partNum + "' AND tblSchematicParts.schematicNumber= '" + schematicNum + "'";

            //assign the row to the dataview object
            anObjectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            //return the DataView object
            return(anObjectTable);
        }
Exemple #15
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string partNum)
        {
            int bitStatus;

            if (SchematicStatus)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE tblSchematics SET description ='" + SchematicDescription + "', usdPrice=" + SchematicUsdPrice
                                       + ", cadPrice=" + SchematicCadPrice + ", status=" + bitStatus +
                                       " WHERE schematicNumber = '" + partNum + "'";

            dataSource.Update();
        }
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Sunrail300AccessoriesStatus)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
                                       + " SET description ='" + Sunrail300AccessoriesDescription + "', usdPrice=" + Sunrail300AccessoriesUsdPrice + ", cadPrice=" + Sunrail300AccessoriesCadPrice + ", status=" + bitStatus +
                                       " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Exemple #17
0
        public void Insert(System.Web.UI.WebControls.SqlDataSource dataSource, string table)
        {
            string sqlCount;
            string sqlInsert;

            System.Data.DataView selectTable = new System.Data.DataView();
            int count;


            sqlCount = "SELECT * FROM " + table;

            dataSource.SelectCommand = sqlCount;
            selectTable = (System.Data.DataView)dataSource.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            //find out how many records are in the table in order to set the primary key
            count = selectTable.Count;



            //Insert
            sqlInsert = "INSERT INTO " + table
                        + "(sr400ID,partName,description,partNumber,color,maxLengthFeet,lengthFeetUnits,maxLengthInches,lengthInchesUnits,usdPrice,cadPrice,status)"
                        + "VALUES(" + (count + 1) + ",'" + Sunrail400Name + "','" + Sunrail400Description + "','" + PartNumber + "','" + Sunrail400Color + "'," + Sunrail400MaxLengthFeet + ",'"
                        + Sunrail400MaxLengthFeetUnits + "'," + Sunrail400MaxLengthInches + ",'" + Sunrail400MaxLengthInchesUnits + "',"
                        + Sunrail400UsdPrice + "," + Sunrail400CadPrice + "," + 1 + ")";

            if (Sunrail400MaxLengthInches == null)
            {
                sqlInsert = "INSERT INTO " + table
                            + "(sr400ID,partName,description,partNumber,color,maxLengthFeet,lengthFeetUnits,maxLengthInches,lengthInchesUnits,usdPrice,cadPrice,status)"
                            + "VALUES(" + (count + 1) + ",'" + Sunrail400Name + "','" + Sunrail400Description + "','" + PartNumber + "','" + Sunrail400Color + "'," + Sunrail400MaxLengthFeet + ",'"
                            + Sunrail400MaxLengthFeetUnits + "',null,null,"
                            + Sunrail400UsdPrice + "," + Sunrail400CadPrice + "," + 1 + ")";
            }


            //Null Insert


            dataSource.InsertCommand = sqlInsert;
            dataSource.Insert();
        }
Exemple #18
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Status)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
                                       + " SET width =" + VinylRollWidth + ", widthUnits='" + VinylRollWidthUnits + "', weight=" + VinylRollWeight + ", weightUnits='" + VinylRollWeightUnits
                                       + "', usdPrice=" + UsdPrice + ", cadPrice=" + CadPrice + ", status=" + bitStatus +
                                       " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Exemple #19
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Sunrail400Status)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
                                       + " SET description ='" + Sunrail400Description + "', maxLengthFeet=" + Sunrail400MaxLengthFeet + ", maxLengthInches="
                                       + Sunrail400MaxLengthInches + ", usdPrice=" + Sunrail400UsdPrice + ", cadPrice=" + Sunrail400CadPrice + ", status=" + bitStatus +
                                       " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Exemple #20
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Status)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
                                       + " SET description ='" + wallExtrusionDescription + "', maxLength=" + wallExtrusionMaxLength + ", lengthUnits='" + LengthUnits + "', usdPrice=" + UsdPrice
                                       + ", cadPrice=" + CadPrice + ", status=" + bitStatus +
                                       " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Exemple #21
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Status)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
                                       + " SET description ='" + PanelDescription + "', composition='" + PanelComposition + "', standard='" + PanelStandard + "', color='" + PanelColor + "', size=" + PanelSize
                                       + ", sizeUnits='" + PanelSizeUnits
                                       + "', maxWidth=" + PanelMaxWidth + ", widthUnits='" + MaxWidthUnits + "', maxLength='" + PanelMaxLength + "', usdPrice=" + UsdPrice
                                       + ", cadPrice=" + CadPrice + ", status=" + bitStatus +
                                       " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Exemple #22
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (accessoryStatus)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
                                       + " SET description ='" + AccessoryDescription + "', packQuantity=" + AccessoryPackQuantity + ", width=" + AccessoryWidth
                                       + ", widthUnits='" + AccessoryWidthUnits + "', length=" + AccessoryLength + ", lengthUnits='" + AccessoryLengthUnits
                                       + "', size=" + AccessorySize + ", sizeUnits='" + AccessorySizeUnits
                                       + "', usdPrice=" + AccessoryUsdPrice + ", cadPrice=" + AccessoryCadPrice
                                       + ", status=" + bitStatus +
                                       " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Exemple #23
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (InsulatedFloorStatus)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
                                       + " SET description ='" + InsulatedFloorDescription + "', composition='" + InsulatedFloorComposition
                                       + "', size=" + InsulatedFloorSize + ", sizeUnits='" + InsulatedFloorSizeUnits
                                       + "', maxWidth=" + InsulatedFloorMaxWidth + ", widthUnits='" + InsulatedFloorMaxWidthUnits
                                       + "', maxLength='" + InsulatedFloorMaxLength + "', usdPrice=" + InsulatedFloorUsdPrice
                                       + ", cadPrice=" + InsulatedFloorCadPrice + ", status=" + bitStatus +
                                       " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
        public CascadingDropDownNameValue[] GetSubCategories(string knownCategoryValues, string category)
        {
            StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
            List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();

            int ParentCategoryID = 0;
            foreach (string s in kv.Keys)
                ParentCategoryID = Convert.ToInt32(kv[s]);

            using (var DS = new System.Web.UI.WebControls.SqlDataSource())
            {
                DS.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["AdventureWorksConnectionString"].ConnectionString;
                DS.SelectCommand = "select ProductCategoryID, Name from ProductCategory where ParentProductCategoryID = " + ParentCategoryID + " order by Name";
                using (var result = (DS.Select(System.Web.UI.DataSourceSelectArguments.Empty) as System.Data.DataView).Table)
                {
                    foreach (DataRow row in result.Rows)
                    {
                        values.Add(new CascadingDropDownNameValue(row["Name"].ToString(), row["ProductCategoryID"].ToString()));
                    }
                }
            }

            return values.ToArray();
        }
Exemple #25
0
        public static void CombineSQL(System.Web.UI.DataSourceControl _dataSource, string _columnName, Object _value, string _paramName, EnumSQLOperator _op)
        {
            StringBuilder _sb = new StringBuilder(256);
            string        _parameterName, _parameterName1, _whereSQL, _originalSelectCommand = "";
            int           _where_pos;

            //int _parameterCount = 0;

            if ((_columnName == null) || (_columnName.Trim() == ""))
            {
                return;
            }
            if (!(_op == EnumSQLOperator.IsNull || _op == EnumSQLOperator.IsNotNull))
            {
                if (_value == null || _value.ToString() == "")
                {
                    return;
                }
            }

            //if (_dataSource is System.Web.UI.WebControls.SqlDataSource)
            //{
            //    _parameterCount = ((System.Web.UI.WebControls.SqlDataSource)_dataSource).SelectParameters.Count;
            //}
            //else
            //{
            //    return;
            //}

            if (!(_dataSource is System.Web.UI.WebControls.SqlDataSource))
            {
                return;
            }

            _parameterName  = "@" + _paramName;
            _parameterName1 = _paramName;
            _whereSQL       = CombineSQL(_columnName, _parameterName, _op);

            if (_dataSource is System.Web.UI.WebControls.SqlDataSource)
            {
                _originalSelectCommand = ((System.Web.UI.WebControls.SqlDataSource)_dataSource).SelectCommand;
            }


            _sb.Append(_originalSelectCommand);
            _sb.Replace("\r\n", "  ");
            _where_pos = _sb.ToString().ToUpper().IndexOf(" WHERE ");
            if (_where_pos >= 0)
            {
                _sb.Insert(_where_pos + 7, _whereSQL + " AND ");
            }
            else
            {
                int _group_pos = _sb.ToString().ToUpper().IndexOf(" GROUP ");
                if (_group_pos >= 0)
                {
                    _sb.Insert(_group_pos, " WHERE " + _whereSQL + " ");
                }
                else
                {
                    int _order_pos = _sb.ToString().ToUpper().IndexOf(" ORDER ");
                    if (_order_pos >= 0)
                    {
                        _sb.Insert(_order_pos, " WHERE " + _whereSQL + " ");
                    }
                    else
                    {
                        _sb.Append(" WHERE " + _whereSQL + " ");
                    }
                }
            }

            if (_dataSource is System.Web.UI.WebControls.SqlDataSource)
            {
                ((System.Web.UI.WebControls.SqlDataSource)_dataSource).SelectCommand = _sb.ToString();

                if (_op == EnumSQLOperator.IsNull || _op == EnumSQLOperator.IsNotNull)
                {
                    return;
                }

                string _data = "";
                if (_op == EnumSQLOperator.Like || _op == EnumSQLOperator.NotLike)
                {
                    _data = "%" + _value.ToString() + "%";
                }
                else
                {
                    _data = _value.ToString();
                }


                System.Web.UI.WebControls.SqlDataSource _ds = (System.Web.UI.WebControls.SqlDataSource)_dataSource;
                bool _flag  = false;
                int  _index = 0;
                while (_index < _ds.SelectParameters.Count && _flag == false)
                {
                    if (_ds.SelectParameters[_index].Name.Trim().Contains(_parameterName1))
                    {
                        _flag = true;
                    }
                    _index++;
                }

                if (!_flag)
                {
                    _ds.SelectParameters.Add(_parameterName1, _data);
                }
                else
                {
                    _ds.SelectParameters[_parameterName1].DefaultValue = _data;
                }
            }
        }