/// <summary> /// Get /// Calls [usp_select_StockLog] /// </summary> public override StockLogDetails Get(System.Int32?stockLogId) { SqlConnection cn = null; SqlCommand cmd = null; try { cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand("usp_select_StockLog", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@StockLogId", SqlDbType.Int).Value = stockLogId; cn.Open(); DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow); if (reader.Read()) { //return GetStockLogFromReader(reader); StockLogDetails obj = new StockLogDetails(); obj.StockLogId = GetReaderValue_Int32(reader, "StockLogId", 0); obj.StockLogTypeNo = GetReaderValue_Int32(reader, "StockLogTypeNo", 0); obj.StockNo = GetReaderValue_Int32(reader, "StockNo", 0); obj.QuantityInStock = GetReaderValue_Int32(reader, "QuantityInStock", 0); obj.QuantityOnOrder = GetReaderValue_Int32(reader, "QuantityOnOrder", 0); obj.InvoiceNo = GetReaderValue_NullableInt32(reader, "InvoiceNo", null); obj.PurchaseOrderNo = GetReaderValue_NullableInt32(reader, "PurchaseOrderNo", null); obj.RelatedStockNo = GetReaderValue_NullableInt32(reader, "RelatedStockNo", null); obj.ActionQuantity = GetReaderValue_NullableInt32(reader, "ActionQuantity", null); obj.GoodsInNo = GetReaderValue_NullableInt32(reader, "GoodsInNo", null); obj.GoodsInLineNo = GetReaderValue_NullableInt32(reader, "GoodsInLineNo", null); obj.CRMALineNo = GetReaderValue_NullableInt32(reader, "CRMALineNo", null); obj.SalesOrderNo = GetReaderValue_NullableInt32(reader, "SalesOrderNo", null); obj.SalesOrderLineNo = GetReaderValue_NullableInt32(reader, "SalesOrderLineNo", null); obj.SRMALineNo = GetReaderValue_NullableInt32(reader, "SRMALineNo", null); obj.UpdatedBy = GetReaderValue_NullableInt32(reader, "UpdatedBy", null); obj.DLUP = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue); obj.Detail = GetReaderValue_String(reader, "Detail", ""); obj.ChangeNotes = GetReaderValue_String(reader, "ChangeNotes", ""); obj.StockLogReasonNo = GetReaderValue_NullableInt32(reader, "StockLogReasonNo", null); obj.DebitNo = GetReaderValue_NullableInt32(reader, "DebitNo", null); return(obj); } else { return(null); } } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get StockLog", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }
private static StockLog PopulateFromDBDetailsObject(StockLogDetails obj) { StockLog objNew = new StockLog(); objNew.StockLogId = obj.StockLogId; objNew.StockLogTypeNo = obj.StockLogTypeNo; objNew.StockNo = obj.StockNo; objNew.QuantityInStock = obj.QuantityInStock; objNew.QuantityOnOrder = obj.QuantityOnOrder; objNew.InvoiceNo = obj.InvoiceNo; objNew.PurchaseOrderNo = obj.PurchaseOrderNo; objNew.RelatedStockNo = obj.RelatedStockNo; objNew.ActionQuantity = obj.ActionQuantity; objNew.GoodsInNo = obj.GoodsInNo; objNew.GoodsInLineNo = obj.GoodsInLineNo; objNew.CRMALineNo = obj.CRMALineNo; objNew.SalesOrderNo = obj.SalesOrderNo; objNew.SalesOrderLineNo = obj.SalesOrderLineNo; objNew.SRMALineNo = obj.SRMALineNo; objNew.UpdatedBy = obj.UpdatedBy; objNew.DLUP = obj.DLUP; objNew.Detail = obj.Detail; objNew.ChangeNotes = obj.ChangeNotes; objNew.StockLogReasonNo = obj.StockLogReasonNo; objNew.DebitNo = obj.DebitNo; objNew.StockLogReasonName = obj.StockLogReasonName; objNew.InvoiceNumber = obj.InvoiceNumber; objNew.PurchaseOrderNumber = obj.PurchaseOrderNumber; objNew.RelatedStockPart = obj.RelatedStockPart; objNew.UpdatedByName = obj.UpdatedByName; objNew.GoodsInNumber = obj.GoodsInNumber; objNew.SalesOrderNumber = obj.SalesOrderNumber; objNew.CustomerRMANo = obj.CustomerRMANo; objNew.CustomerRMANumber = obj.CustomerRMANumber; objNew.SupplierRMANo = obj.SupplierRMANo; objNew.SupplierRMANumber = obj.SupplierRMANumber; objNew.DebitNumber = obj.DebitNumber; objNew.GoodsInCurrencyCode = obj.GoodsInCurrencyCode; return(objNew); }
/// <summary> /// GetListForStock /// Calls [usp_selectAll_StockLog_for_Stock] /// </summary> public override List <StockLogDetails> GetListForStock(System.Int32?stockId) { SqlConnection cn = null; SqlCommand cmd = null; try { cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand("usp_selectAll_StockLog_for_Stock", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@StockId", SqlDbType.Int).Value = stockId; cn.Open(); DbDataReader reader = ExecuteReader(cmd); List <StockLogDetails> lst = new List <StockLogDetails>(); while (reader.Read()) { StockLogDetails obj = new StockLogDetails(); obj.StockLogId = GetReaderValue_Int32(reader, "StockLogId", 0); obj.StockLogTypeNo = GetReaderValue_Int32(reader, "StockLogTypeNo", 0); obj.StockNo = GetReaderValue_Int32(reader, "StockNo", 0); obj.QuantityInStock = GetReaderValue_Int32(reader, "QuantityInStock", 0); obj.QuantityOnOrder = GetReaderValue_Int32(reader, "QuantityOnOrder", 0); obj.InvoiceNo = GetReaderValue_NullableInt32(reader, "InvoiceNo", null); obj.PurchaseOrderNo = GetReaderValue_NullableInt32(reader, "PurchaseOrderNo", null); obj.RelatedStockNo = GetReaderValue_NullableInt32(reader, "RelatedStockNo", null); obj.ActionQuantity = GetReaderValue_NullableInt32(reader, "ActionQuantity", null); obj.GoodsInNo = GetReaderValue_NullableInt32(reader, "GoodsInNo", null); obj.GoodsInLineNo = GetReaderValue_NullableInt32(reader, "GoodsInLineNo", null); obj.CRMALineNo = GetReaderValue_NullableInt32(reader, "CRMALineNo", null); obj.SalesOrderNo = GetReaderValue_NullableInt32(reader, "SalesOrderNo", null); obj.SalesOrderLineNo = GetReaderValue_NullableInt32(reader, "SalesOrderLineNo", null); obj.SRMALineNo = GetReaderValue_NullableInt32(reader, "SRMALineNo", null); obj.UpdatedBy = GetReaderValue_NullableInt32(reader, "UpdatedBy", null); obj.DLUP = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue); obj.Detail = GetReaderValue_String(reader, "Detail", ""); obj.ChangeNotes = GetReaderValue_String(reader, "ChangeNotes", ""); obj.StockLogReasonNo = GetReaderValue_NullableInt32(reader, "StockLogReasonNo", null); obj.DebitNo = GetReaderValue_NullableInt32(reader, "DebitNo", null); obj.StockLogReasonName = GetReaderValue_String(reader, "StockLogReasonName", ""); obj.InvoiceNumber = GetReaderValue_NullableInt32(reader, "InvoiceNumber", null); obj.PurchaseOrderNumber = GetReaderValue_NullableInt32(reader, "PurchaseOrderNumber", null); obj.RelatedStockPart = GetReaderValue_String(reader, "RelatedStockPart", ""); obj.UpdatedByName = GetReaderValue_String(reader, "UpdatedByName", ""); obj.GoodsInNumber = GetReaderValue_NullableInt32(reader, "GoodsInNumber", null); obj.SalesOrderNumber = GetReaderValue_NullableInt32(reader, "SalesOrderNumber", null); obj.CustomerRMANo = GetReaderValue_NullableInt32(reader, "CustomerRMANo", null); obj.CustomerRMANumber = GetReaderValue_NullableInt32(reader, "CustomerRMANumber", null); obj.SupplierRMANo = GetReaderValue_NullableInt32(reader, "SupplierRMANo", null); obj.SupplierRMANumber = GetReaderValue_NullableInt32(reader, "SupplierRMANumber", null); obj.DebitNumber = GetReaderValue_NullableInt32(reader, "DebitNumber", null); obj.GoodsInCurrencyCode = GetReaderValue_String(reader, "GoodsInCurrencyCode", ""); lst.Add(obj); obj = null; } return(lst); } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get StockLogs", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }