示例#1
0
        internal override bool UpdateRecord(DataRow _row)
        {
            var cmd = new MySqlCommand();

            cmd.CommandText = "UPDATE vendors " +
                              "SET ven_Code=?Code,ven_Name=?Name,ven_Address=?Add,ven_Address2=?Add2,ven_City=?City," +
                              "ven_State=?State,ven_Zip=?Zip,ven_Phone=?Phone,ven_Email=?Email,ven_Inactive=?Inactive,ven_Timestamp=?Timestamp " +
                              "WHERE ven_Id = ?Id";

            if (!_row.ItemArray[0].Equals(System.DBNull.Value))
            {
                cmd.Parameters.AddWithValue("?Id", Convert.ToUInt32(_row.ItemArray[0]));
            }
            else
            {
                throw new Exception();
            }

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?Add", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Add2", _row.ItemArray[4].ToString());
            cmd.Parameters.AddWithValue("?City", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?State", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Zip", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Phone", _row.ItemArray[8].ToString());
            cmd.Parameters.AddWithValue("?Email", _row.ItemArray[9].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[10]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var result = Serv.ExecuteMySQLNonQuery(cmd);

            return((Convert.ToInt32(result) > 0) ? true : false);
        }
示例#2
0
        internal override bool UpdateRecord(DataRow _row)
        {
            var cmd = new MySqlCommand();

            cmd.CommandText = "UPDATE vendProducts " +
                              "SET vProd_Code=?Code,vProd_Name=?Name,vProd_VendCode==VendCode,vProd_Price=?Price,vProd_Quant=?Quant," +
                              "vProd_Units=?Units,vProd_Inactive=?Inactive,vProd_Timestamp=?Timestamp " +
                              "WHERE vProd_Id = ?Id";

            if (!_row.ItemArray[0].Equals(System.DBNull.Value))
            {
                cmd.Parameters.AddWithValue("?Id", Convert.ToUInt32(_row.ItemArray[0]));
            }
            else
            {
                throw new Exception();
            }

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?VendCode", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Price", Convert.ToDecimal(_row.ItemArray[4]));
            cmd.Parameters.AddWithValue("?Quant", Convert.ToDecimal(_row.ItemArray[5]));
            cmd.Parameters.AddWithValue("?Units", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[7]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var result = Serv.ExecuteMySQLNonQuery(cmd);

            return((Convert.ToInt32(result) > 0) ? true : false);
        }
示例#3
0
        internal override UInt32 InsertRecord(DataRow _row)
        {
            var cmd = new MySqlCommand();

            cmd.CommandText = "INSERT INTO vendors " +
                              "(ven_Code,ven_Name,ven_Address,ven_Address2,ven_City,ven_State,ven_Zip,ven_Phone,ven_Email,ven_Inactive,ven_Timestamp)" +
                              "Values(?Code,?Name,?Add,?Add2,?City,?State,?Zip,?Phone,?Email,?Inactive,?Timestamp)";

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?Add", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Add2", _row.ItemArray[4].ToString());
            cmd.Parameters.AddWithValue("?City", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?State", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Zip", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Phone", _row.ItemArray[8].ToString());
            cmd.Parameters.AddWithValue("?Email", _row.ItemArray[9].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[10]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var    result  = Serv.ExecuteMySQLNonQuery(cmd);
            UInt32 mySqlId = Convert.ToUInt32(cmd.LastInsertedId);

            return(mySqlId);
        }
示例#4
0
        internal override bool UpdateRecord(DataRow _row)
        {
            var cmd = new MySqlCommand
            {
                CommandText = "UPDATE vendProducts " +
                              "SET vProd_Code=?Code,vProd_Description=?Desc,vProd_Price=?Price,vProd_Quant=?Quant,vProd_Units=?Units," +
                              "vProd_Id=?VenId,vProd_VenCatNum=VendCat,vProd_Inactive=?Inactive,vProd_Timestamp=?Timestamp " +
                              "WHERE vProd_Id = ?Id"
            };

            cmd.Parameters.AddWithValue("?Id", Convert.ToUInt32(_row.ItemArray[0]));
            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Desc", _row.ItemArray[2].ToString());
            cmd.Parameters.AddWithValue("?Price", Convert.ToDecimal(_row.ItemArray[3]));
            cmd.Parameters.AddWithValue("?Quant", Convert.ToDecimal(_row.ItemArray[4]));
            cmd.Parameters.AddWithValue("?Units", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?VenId", Convert.ToUInt32(_row.ItemArray[6]));
            cmd.Parameters.AddWithValue("?VenCat", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[8]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var result = Serv.ExecuteMySQLNonQuery(cmd);

            return((Convert.ToInt32(result) > 0) ? true : false);
        }
示例#5
0
        internal override UInt32 InsertRecord(DataRow _row)
        {
            var cmd = new MySqlCommand
            {
                CommandText = "INSERT INTO vendProducts " +
                              "(vProd_Code,vProd_Description,vProd_Price,vProd_Quant,vProd_Units,VProd_VenId,vProd_CatNum,vProd_Inactive,vPRod_Timestamp)" +
                              "Values(?Code,?Desc,?Price,?Quant,?Units,?VenId,?VendCat,?Inactive,?Timestamp)"
            };

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Desc", _row.ItemArray[2].ToString());
            cmd.Parameters.AddWithValue("?Price", Convert.ToDecimal(_row.ItemArray[3]));
            cmd.Parameters.AddWithValue("?Quant", Convert.ToDecimal(_row.ItemArray[4]));
            cmd.Parameters.AddWithValue("?Units", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?VenId", Convert.ToUInt32(_row.ItemArray[6]));
            cmd.Parameters.AddWithValue("?VenCat", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[8]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));


            var    result  = Serv.ExecuteMySQLNonQuery(cmd);
            UInt32 mySqlId = Convert.ToUInt32(cmd.LastInsertedId);

            return(mySqlId);
        }
示例#6
0
        internal override UInt32 InsertRecord(DataRow _row)
        {
            var cmd = new MySqlCommand
            {
                CommandText = "INSERT INTO locations " +
                              "(loc_Code,loc_Name,loc_Address,loc_Address2,loc_City,loc_State,loc_Zip,loc_Phone,loc_Email,loc_Inactive,loc_Timestamp)" +
                              "Values(?Code,?Name,?Add,?Add2,?City,?State,?Zip,?Phone,?Email,?Inactive,?Timestamp)"
            };

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?Add", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Add2", _row.ItemArray[4].ToString());
            cmd.Parameters.AddWithValue("?City", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?State", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Zip", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Phone", _row.ItemArray[8].ToString());
            cmd.Parameters.AddWithValue("?Email", _row.ItemArray[9].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[10]));
            var dt = DateTime.Now.AddSeconds(GV.ServTimeDiff);

            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var    result  = Serv.ExecuteMySQLNonQuery(cmd);
            UInt32 mySqlId = Convert.ToUInt32(cmd.LastInsertedId);

            return(mySqlId);

            //todo add insert record to change table
        }
示例#7
0
        internal override bool UpdateRecord(DataRow _row)
        {
            // if code has been changed it must cascade to all child records

            var cmd = new MySqlCommand
            {
                CommandText = "UPDATE locations " +
                              "SET loc_Code=?Code,loc_Name=?Name,loc_Address=?Add,loc_Address2=?Add2,loc_City=?City," +
                              "loc_State=?State,loc_Zip=?Zip,loc_Phone=?Phone,loc_Email=?Email,loc_Inactive=?Inactive,loc_Timestamp=?Timestamp " +
                              "WHERE loc_Id = ?Id"
            };

            if (!_row.ItemArray[0].Equals(System.DBNull.Value))
            {
                cmd.Parameters.AddWithValue("?Id", Convert.ToUInt32(_row.ItemArray[0]));
            }
            else
            {
                throw new Exception();
            }

            cmd.Parameters.AddWithValue("?Code", _row.ItemArray[1].ToString());
            cmd.Parameters.AddWithValue("?Name", _row[2].ToString());
            cmd.Parameters.AddWithValue("?Add", _row.ItemArray[3].ToString());
            cmd.Parameters.AddWithValue("?Add2", _row.ItemArray[4].ToString());
            cmd.Parameters.AddWithValue("?City", _row.ItemArray[5].ToString());
            cmd.Parameters.AddWithValue("?State", _row.ItemArray[6].ToString());
            cmd.Parameters.AddWithValue("?Zip", _row.ItemArray[7].ToString());
            cmd.Parameters.AddWithValue("?Phone", _row.ItemArray[8].ToString());
            cmd.Parameters.AddWithValue("?Email", _row.ItemArray[9].ToString());
            cmd.Parameters.AddWithValue("?Inactive", Convert.ToBoolean(_row.ItemArray[10]));
            cmd.Parameters.AddWithValue("?Timestamp", DateTime.Now.AddSeconds(GV.ServTimeDiff));

            var result = Serv.ExecuteMySQLNonQuery(cmd);

            return((Convert.ToInt32(result) > 0) ? true : false);
            //todo add update record to change table
        }