/*******************************************************************************************************/ #region CONSTRUCTORS public POItem(Guid id) { ID = id; DataTable dt = getRow(ID); POID = (Guid)dt.Rows[0][COL_DB_POID]; LineNo = Convert.ToInt16(dt.Rows[0][COL_DB_LINENO]); ProductDescription = dt.Rows[0][COL_DB_PRODUCTDESCRIPTION].ToString(); Qty = Convert.ToInt16(dt.Rows[0][COL_DB_QTY]); UnitName = dt.Rows[0][COL_DB_UNITNAME].ToString(); Notes = dt.Rows[0][COL_DB_NOTES].ToString(); PricePerUnit = Convert.ToDecimal(dt.Rows[0][COL_DB_PRICEPERUNIT]); if (dt.Rows[0][COL_DB_REFERENCEDINVENTORYID] != DBNull.Value) { ReferencedInventoryID = (Guid)dt.Rows[0][COL_DB_REFERENCEDINVENTORYID]; } Timestamp = DBUtil.parseData <DateTime>(dt.Rows[0], COL_TIMESTAMP); ExpectedDeliveryDate = DBUtil.parseData <DateTime?>(dt.Rows[0], COL_DB_ExpectedDeliveryDate); ExpectedDeliveryDayCount = DBUtil.parseData <int?>(dt.Rows[0], COL_DB_ExpectedDeliveryDayCount); Status = Tools.parseEnum <POItemStatus>(DBUtil.parseData <Int16>(dt.Rows[0], COL_DB_STATUSENUMID)); PONo = DBUtil.parseData <string>(dt.Rows[0], COL_PONO); PendingQty = DBUtil.parseData <decimal>(dt.Rows[0], COL_PENDINGQTY); PendingQtyValue = DBUtil.parseData <decimal>(dt.Rows[0], COL_PENDINGQTYVALUE); PriorityNo = DBUtil.parseData <int>(dt.Rows[0], COL_DB_PriorityNo); PriorityQty = DBUtil.parseData <int>(dt.Rows[0], COL_DB_PriorityQty); }
/*******************************************************************************************************/ #region CLASS METHODS public static void updateStatus(Guid id, POItemStatus statusEnumID) { try { using (SqlCommand cmd = new SqlCommand("poitem_update_status", DBConnection.ActiveSqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@" + COL_DB_ID, SqlDbType.UniqueIdentifier).Value = id; cmd.Parameters.Add("@" + COL_DB_STATUSENUMID, SqlDbType.TinyInt).Value = statusEnumID; cmd.ExecuteNonQuery(); ActivityLog.submit(id, "Status changed to: " + statusEnumID.ToString()); } } catch (Exception ex) { Tools.showError(ex.Message); } }