Example #1
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();
        }
Example #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);

            //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();
        }
        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();
        }
Example #4
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
                        + "(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();
        }
Example #5
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;
            }
        }
Example #6
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);
        }
Example #7
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);
        }
Example #8
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);
        }
Example #9
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);
        }
Example #10
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();
        }
        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();
        }