コード例 #1
0
ファイル: ClsMetaDataDbChanges.cs プロジェクト: sammmk/ERP
        public ClsAssetData getSingleAssetData(int assetId)
        {
            ClsAssetData asset = new ClsAssetData();
            DataTable    dt    = new DataTable();

            try
            {
                string querry = "SELECT * FROM tbl_assets WHERE assetId = '" + assetId + "';";
                dt = CONN.getDataTable(querry);

                if (dt.Rows.Count > 0)
                {
                    asset._assetId    = Convert.ToInt32(dt.Rows[0]["assetId"]);
                    asset._assetName  = dt.Rows[0]["assetName"].ToString();
                    asset._value      = Convert.ToDouble(dt.Rows[0]["value"].ToString());
                    asset._descrption = dt.Rows[0]["description"].ToString();
                    asset._quantity   = Convert.ToDouble(dt.Rows[0]["quantity"].ToString());
                    asset._totalValue = Convert.ToDouble(dt.Rows[0]["totalValue"].ToString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(asset);
        }
コード例 #2
0
ファイル: ClsMetaDataDbChanges.cs プロジェクト: sammmk/ERP
        public bool insertData_asset(ClsAssetData asset)
        {
            bool   isOK   = false;
            string querry = string.Empty;

            try
            {
                querry += @"INSERT INTO tbl_assets 
                             (assetId, assetName, value, description, quantity, totalValue) VALUES (";
                querry += "'" + asset._assetId + "',";
                querry += "'" + asset._assetName + "',";
                querry += "'" + asset._value + "',";
                querry += "'" + asset._descrption + "',";
                querry += "'" + asset._quantity + "',";
                querry += "'" + asset._totalValue + "'";
                querry += ");";

                isOK = CONN.update(querry);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isOK);
        }
コード例 #3
0
ファイル: ClsMetaDataDbChanges.cs プロジェクト: sammmk/ERP
        public bool updateData_asset(ClsAssetData asset)
        {
            bool   isOK   = false;
            string querry = string.Empty;

            try
            {
                querry += "UPDATE tbl_assets SET ";
                querry += "assetName = '" + asset._assetName + "', ";
                querry += "value = '" + asset._value + "', ";
                querry += "description = '" + asset._descrption + "',";
                querry += "quantity ='" + asset._quantity + "', ";
                querry += "totalValue ='" + asset._totalValue + "' ";
                querry += "WHERE assetId = '" + asset._assetId + "';";

                isOK = CONN.update(querry);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isOK);
        }