public bool save(dapper.product product)
        {
            var isbarcodeexists = checkisbarcodeexists(product);

            if (isbarcodeexists)
            {
                return(false);
            }
            else
            {
                using (var connection = new MySqlConnection(conn))
                {
                    var res = connection.Insert <dapper.product>(product);
                    return(true);
                }
            }
        }
        public bool update(dapper.product product)
        {
            var isbarcodeexists = checkisbarcodeexists(product);

            if (isbarcodeexists)
            {
                return(false);
            }
            else
            {
                using (var connection = new MySqlConnection(conn))
                {
                    var identity = connection.Update <dapper.product>(product);
                    return(true);
                }
            }
        }
        public bool checkisbarcodeexists(dapper.product product)
        {
            if (product.barcode == "")
            {
                product.barcode = null;
            }

            if (product.barcode == null)
            {
                return(false);
            }
            else
            {
                var sql = "select * from product where barcode=" + product.barcode + ";";

                using (var connection = new MySqlConnection(conn))
                {
                    var res = connection.Query <dapper.product>(sql).FirstOrDefault();
                    if (res == null)
                    {
                        return(false);
                    }
                    else
                    {
                        if (product.id == res.id)
                        {
                            return(false);
                        }
                        else
                        {
                            otherutils.notify("Alert", "Barcode already exists", 5000);
                            return(true);
                        }
                    }
                }
            }
        }