Exemple #1
0
        /// <summary>
        /// GetListForSalesOrderLine
        /// Calls [usp_selectAll_Allocation_for_SalesOrderLine]
        /// </summary>
        public override List <AllocationDetails> GetListForSalesOrderLine(System.Int32?salesOrderLineId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_Allocation_for_SalesOrderLine", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@SalesOrderLineId", SqlDbType.Int).Value = salesOrderLineId;
                cn.Open();
                DbDataReader             reader = ExecuteReader(cmd);
                List <AllocationDetails> lst    = new List <AllocationDetails>();
                while (reader.Read())
                {
                    AllocationDetails obj = new AllocationDetails();
                    obj.AllocationId      = GetReaderValue_Int32(reader, "AllocationId", 0);
                    obj.StockNo           = GetReaderValue_NullableInt32(reader, "StockNo", null);
                    obj.QuantityAllocated = GetReaderValue_Int32(reader, "QuantityAllocated", 0);
                    obj.Part                    = GetReaderValue_String(reader, "Part", "");
                    obj.ROHS                    = GetReaderValue_Byte(reader, "ROHS", (byte)0);
                    obj.LandedCost              = GetReaderValue_NullableDouble(reader, "LandedCost", null);
                    obj.QuantityInStock         = GetReaderValue_Int32(reader, "QuantityInStock", 0);
                    obj.PurchaseOrderNo         = GetReaderValue_NullableInt32(reader, "PurchaseOrderNo", null);
                    obj.PurchaseOrderNumber     = GetReaderValue_NullableInt32(reader, "PurchaseOrderNumber", null);
                    obj.SupplierPart            = GetReaderValue_String(reader, "SupplierPart", "");
                    obj.PurchaseOrderLineNo     = GetReaderValue_NullableInt32(reader, "PurchaseOrderLineNo", null);
                    obj.ReturnDate              = GetReaderValue_NullableDateTime(reader, "ReturnDate", null);
                    obj.CompanyNo               = GetReaderValue_Int32(reader, "CompanyNo", 0);
                    obj.CompanyName             = GetReaderValue_String(reader, "CompanyName", "");
                    obj.Price                   = GetReaderValue_NullableDouble(reader, "Price", null);
                    obj.ExpediteDate            = GetReaderValue_NullableDateTime(reader, "ExpediteDate", null);
                    obj.CustomerRMANo           = GetReaderValue_NullableInt32(reader, "CustomerRMANo", null);
                    obj.CustomerRMANumber       = GetReaderValue_NullableInt32(reader, "CustomerRMANumber", null);
                    obj.QuantityOnOrder         = GetReaderValue_NullableInt32(reader, "QuantityOnOrder", null);
                    obj.POSerialNo              = GetReaderValue_Int16(reader, "POSerialNo", 0);
                    obj.InternalPurchaseOrderId = GetReaderValue_NullableInt32(reader, "InternalPurchaseOrderId", null);
                    obj.InternalPurchaseOrderNo = GetReaderValue_NullableInt32(reader, "InternalPurchaseOrderNumber", null);
                    obj.IPOSupplier             = GetReaderValue_NullableInt32(reader, "IPOSupplier", null);
                    obj.IPOSupplierName         = GetReaderValue_String(reader, "IPOSupplierName", "");
                    obj.ClientLandedCost        = GetReaderValue_NullableDouble(reader, "ClientLandedCost", null);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Allocations", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Exemple #2
0
        /// <summary>
        /// Get
        /// Calls [usp_select_Allocation]
        /// </summary>
        public override AllocationDetails Get(System.Int32?allocationId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_Allocation", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@AllocationId", SqlDbType.Int).Value = allocationId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetAllocationFromReader(reader);
                    AllocationDetails obj = new AllocationDetails();
                    obj.AllocationId      = GetReaderValue_Int32(reader, "AllocationId", 0);
                    obj.StockNo           = GetReaderValue_NullableInt32(reader, "StockNo", null);
                    obj.SalesOrderLineNo  = GetReaderValue_NullableInt32(reader, "SalesOrderLineNo", null);
                    obj.QuantityAllocated = GetReaderValue_Int32(reader, "QuantityAllocated", 0);
                    obj.SupplierRMALineNo = GetReaderValue_NullableInt32(reader, "SupplierRMALineNo", null);
                    obj.UpdatedBy         = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Allocation", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
        public JsonResult SaveAllocationList(TeamAllocationPresenter presenter)
        {
            var result = 0;
            if (presenter != null)
            {
                int previousDaysCount = ApplicationSettings.Instance.PastAllocationAllowedDays;
                var allowedDays = DateTimeHelper.RetrieveCurrentDate().AddDays(-previousDaysCount);
                var teamEngagementDetail = new AllocationDetails();
                foreach (var allocation in presenter.TeamAllocationList)
                {
                    if ((allocation.Date <= allocation.EndDate && allocation.Date >= allowedDays) && (allocation.ProjectID != null && allocation.ProjectID > 0))
                    {
                        if (!string.IsNullOrEmpty(allocation.SelectedDeveloperIds))
                        {
                            allocation.SelectedDeveloperIds += "," + presenter.DeveloperId;
                        }
                        else
                        {
                            allocation.SelectedDeveloperIds = presenter.DeveloperId.ToString();
                        }

                        teamEngagementDetail.Add(new Allocation()
                        {
                            AllocationID = allocation.AllocationID,
                            ProjectID = allocation.ProjectID,
                            DeveloperIDs = allocation.SelectedDeveloperIds,
                            FromDate = allocation.Date,
                            ToDate = allocation.EndDate,
                            Hours = allocation.ProjectAllocatedHours
                        });
                    }
                }

                if (teamEngagementDetail.Count > 0)
                {
                    presenter.ValidationErrors.Append(this.teamEngagementService.SaveTeamEngagementList(teamEngagementDetail, SessionData.Instance.UserInfo.Developer.DeveloperID, presenter.IsHoliday, true, false));
                }

                result = presenter.ValidationErrors.Count;
                if (result > 0)
                {
                    return this.Json(presenter);
                }
            }

            return this.Json("success");
        }
Exemple #4
0
        private static Allocation PopulateFromDBDetailsObject(AllocationDetails obj)
        {
            Allocation objNew = new Allocation();

            objNew.AllocationId      = obj.AllocationId;
            objNew.StockNo           = obj.StockNo;
            objNew.SalesOrderLineNo  = obj.SalesOrderLineNo;
            objNew.QuantityAllocated = obj.QuantityAllocated;
            objNew.SupplierRMALineNo = obj.SupplierRMALineNo;
            objNew.UpdatedBy         = obj.UpdatedBy;
            objNew.DLUP                = obj.DLUP;
            objNew.SalesmanName        = obj.SalesmanName;
            objNew.SupplierRMANo       = obj.SupplierRMANo;
            objNew.SupplierRMANumber   = obj.SupplierRMANumber;
            objNew.Part                = obj.Part;
            objNew.ProductNo           = obj.ProductNo;
            objNew.ProductName         = obj.ProductName;
            objNew.ProductDescription  = obj.ProductDescription;
            objNew.ManufacturerNo      = obj.ManufacturerNo;
            objNew.ManufacturerCode    = obj.ManufacturerCode;
            objNew.ManufacturerName    = obj.ManufacturerName;
            objNew.PackageNo           = obj.PackageNo;
            objNew.PackageName         = obj.PackageName;
            objNew.PackageDescription  = obj.PackageDescription;
            objNew.DateCode            = obj.DateCode;
            objNew.ROHS                = obj.ROHS;
            objNew.LandedCost          = obj.LandedCost;
            objNew.QuantityInStock     = obj.QuantityInStock;
            objNew.WarehouseNo         = obj.WarehouseNo;
            objNew.WarehouseName       = obj.WarehouseName;
            objNew.PurchaseOrderNo     = obj.PurchaseOrderNo;
            objNew.PurchaseOrderNumber = obj.PurchaseOrderNumber;
            objNew.PurchaseOrderLineId = obj.PurchaseOrderLineId;
            objNew.BuyPrice            = obj.BuyPrice;
            objNew.DeliveryDate        = obj.DeliveryDate;
            objNew.BuyCurrencyNo       = obj.BuyCurrencyNo;
            objNew.BuyCurrencyCode     = obj.BuyCurrencyCode;
            objNew.SupplierCompanyNo   = obj.SupplierCompanyNo;
            objNew.SupplierCompanyName = obj.SupplierCompanyName;
            objNew.CustomerCompanyNo   = obj.CustomerCompanyNo;
            objNew.CustomerCompanyName = obj.CustomerCompanyName;
            objNew.Salesman            = obj.Salesman;
            objNew.SalesOrderNo        = obj.SalesOrderNo;
            objNew.SalesOrderNumber    = obj.SalesOrderNumber;
            objNew.CustomerPO          = obj.CustomerPO;
            objNew.SellPrice           = obj.SellPrice;
            objNew.SellCurrencyNo      = obj.SellCurrencyNo;
            objNew.SellCurrencyCode    = obj.SellCurrencyCode;
            objNew.DatePromised        = obj.DatePromised;
            objNew.CustomerPart        = obj.CustomerPart;
            objNew.GoodsInLineNo       = obj.GoodsInLineNo;
            objNew.Shipped             = obj.Shipped;
            objNew.Location            = obj.Location;
            objNew.SupplierPart        = obj.SupplierPart;
            objNew.CustomerRMALineNo   = obj.CustomerRMALineNo;
            objNew.PurchaseOrderLineNo = obj.PurchaseOrderLineNo;
            objNew.ReturnDate          = obj.ReturnDate;
            objNew.SupplierRMADate     = obj.SupplierRMADate;
            objNew.CompanyNo           = obj.CompanyNo;
            objNew.CompanyName         = obj.CompanyName;
            objNew.CurrencyNo          = obj.CurrencyNo;
            objNew.CurrencyCode        = obj.CurrencyCode;
            objNew.Price               = obj.Price;
            objNew.ExpediteDate        = obj.ExpediteDate;
            objNew.CustomerRMANo       = obj.CustomerRMANo;
            objNew.CustomerRMANumber   = obj.CustomerRMANumber;
            objNew.QuantityOnOrder     = obj.QuantityOnOrder;
            return(objNew);
        }
 /// <summary>
 /// Function to save team engagement list.
 /// </summary>
 /// <param name="teamEngagementDetail">The team engagement detail.</param>
 /// <param name="modifiedByDeveloperId">The modified by developer id.</param>
 /// <param name="includeOffDays">Value indicating whether to include off days or not</param>
 /// <param name="isOverride">Value indicating whether to override or not</param>
 /// <param name="isUnderHierarchy">if set to <c>true</c> [is under hierarchy].</param>
 /// <returns>
 /// List of team engagement list error.
 /// </returns>
 public IList<ErrorListItem> SaveTeamEngagementList(AllocationDetails teamEngagementDetail, int modifiedByDeveloperId, bool includeOffDays, bool isOverride, bool isUnderHierarchy)
 {
     return this.teamEngagementRepository.SaveTeamEngagementList(SerializeExtensions.XmlSerializerMethod(teamEngagementDetail), modifiedByDeveloperId, includeOffDays, isOverride, isUnderHierarchy);
 }
Exemple #6
0
        /// <summary>
        /// GetListForStock
        /// Calls [usp_selectAll_Allocation_for_Stock]
        /// </summary>
        public override List <AllocationDetails> GetListForStock(System.Int32?stockId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_Allocation_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 <AllocationDetails> lst    = new List <AllocationDetails>();
                while (reader.Read())
                {
                    AllocationDetails obj = new AllocationDetails();
                    obj.AllocationId      = GetReaderValue_Int32(reader, "AllocationId", 0);
                    obj.StockNo           = GetReaderValue_NullableInt32(reader, "StockNo", null);
                    obj.QuantityAllocated = GetReaderValue_Int32(reader, "QuantityAllocated", 0);
                    obj.SalesmanName      = GetReaderValue_String(reader, "SalesmanName", "");
                    obj.SupplierRMANo     = GetReaderValue_NullableInt32(reader, "SupplierRMANo", null);
                    obj.SupplierRMANumber = GetReaderValue_NullableInt32(reader, "SupplierRMANumber", null);
                    obj.Part                = GetReaderValue_String(reader, "Part", "");
                    obj.ProductNo           = GetReaderValue_NullableInt32(reader, "ProductNo", null);
                    obj.ProductName         = GetReaderValue_String(reader, "ProductName", "");
                    obj.ManufacturerNo      = GetReaderValue_NullableInt32(reader, "ManufacturerNo", null);
                    obj.ManufacturerCode    = GetReaderValue_String(reader, "ManufacturerCode", "");
                    obj.ManufacturerName    = GetReaderValue_String(reader, "ManufacturerName", "");
                    obj.PackageNo           = GetReaderValue_NullableInt32(reader, "PackageNo", null);
                    obj.PackageName         = GetReaderValue_String(reader, "PackageName", "");
                    obj.ROHS                = GetReaderValue_Byte(reader, "ROHS", (byte)0);
                    obj.Salesman            = GetReaderValue_NullableInt32(reader, "Salesman", null);
                    obj.SalesOrderNo        = GetReaderValue_NullableInt32(reader, "SalesOrderNo", null);
                    obj.SalesOrderNumber    = GetReaderValue_NullableInt32(reader, "SalesOrderNumber", null);
                    obj.CustomerPO          = GetReaderValue_String(reader, "CustomerPO", "");
                    obj.DatePromised        = GetReaderValue_NullableDateTime(reader, "DatePromised", null);
                    obj.CustomerPart        = GetReaderValue_String(reader, "CustomerPart", "");
                    obj.GoodsInLineNo       = GetReaderValue_NullableInt32(reader, "GoodsInLineNo", null);
                    obj.CustomerRMALineNo   = GetReaderValue_NullableInt32(reader, "CustomerRMALineNo", null);
                    obj.PurchaseOrderLineNo = GetReaderValue_NullableInt32(reader, "PurchaseOrderLineNo", null);
                    obj.ReturnDate          = GetReaderValue_NullableDateTime(reader, "ReturnDate", null);
                    obj.SupplierRMADate     = GetReaderValue_NullableDateTime(reader, "SupplierRMADate", null);
                    obj.CompanyNo           = GetReaderValue_Int32(reader, "CompanyNo", 0);
                    obj.CompanyName         = GetReaderValue_String(reader, "CompanyName", "");
                    obj.CurrencyNo          = GetReaderValue_NullableInt32(reader, "CurrencyNo", null);
                    obj.CurrencyCode        = GetReaderValue_String(reader, "CurrencyCode", "");
                    obj.Price               = GetReaderValue_NullableDouble(reader, "Price", null);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Allocations", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Exemple #7
0
        /// <summary>
        /// GetList
        /// Calls [usp_selectAll_Allocation]
        /// </summary>
        public override List <AllocationDetails> GetList()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_Allocation", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader             reader = ExecuteReader(cmd);
                List <AllocationDetails> lst    = new List <AllocationDetails>();
                while (reader.Read())
                {
                    AllocationDetails obj = new AllocationDetails();
                    obj.AllocationId      = GetReaderValue_Int32(reader, "AllocationId", 0);
                    obj.StockNo           = GetReaderValue_NullableInt32(reader, "StockNo", null);
                    obj.SalesOrderLineNo  = GetReaderValue_NullableInt32(reader, "SalesOrderLineNo", null);
                    obj.QuantityAllocated = GetReaderValue_Int32(reader, "QuantityAllocated", 0);
                    obj.SupplierRMALineNo = GetReaderValue_NullableInt32(reader, "SupplierRMALineNo", null);
                    obj.UpdatedBy         = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP                = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    obj.SalesmanName        = GetReaderValue_String(reader, "SalesmanName", "");
                    obj.SupplierRMANo       = GetReaderValue_NullableInt32(reader, "SupplierRMANo", null);
                    obj.SupplierRMANumber   = GetReaderValue_NullableInt32(reader, "SupplierRMANumber", null);
                    obj.Part                = GetReaderValue_String(reader, "Part", "");
                    obj.ProductNo           = GetReaderValue_NullableInt32(reader, "ProductNo", null);
                    obj.ProductName         = GetReaderValue_String(reader, "ProductName", "");
                    obj.ProductDescription  = GetReaderValue_String(reader, "ProductDescription", "");
                    obj.ManufacturerNo      = GetReaderValue_NullableInt32(reader, "ManufacturerNo", null);
                    obj.ManufacturerCode    = GetReaderValue_String(reader, "ManufacturerCode", "");
                    obj.ManufacturerName    = GetReaderValue_String(reader, "ManufacturerName", "");
                    obj.PackageNo           = GetReaderValue_NullableInt32(reader, "PackageNo", null);
                    obj.PackageName         = GetReaderValue_String(reader, "PackageName", "");
                    obj.PackageDescription  = GetReaderValue_String(reader, "PackageDescription", "");
                    obj.DateCode            = GetReaderValue_String(reader, "DateCode", "");
                    obj.ROHS                = GetReaderValue_Byte(reader, "ROHS", (byte)0);
                    obj.LandedCost          = GetReaderValue_NullableDouble(reader, "LandedCost", null);
                    obj.QuantityInStock     = GetReaderValue_Int32(reader, "QuantityInStock", 0);
                    obj.WarehouseNo         = GetReaderValue_NullableInt32(reader, "WarehouseNo", null);
                    obj.WarehouseName       = GetReaderValue_String(reader, "WarehouseName", "");
                    obj.PurchaseOrderNo     = GetReaderValue_NullableInt32(reader, "PurchaseOrderNo", null);
                    obj.PurchaseOrderNumber = GetReaderValue_NullableInt32(reader, "PurchaseOrderNumber", null);
                    obj.PurchaseOrderLineId = GetReaderValue_NullableInt32(reader, "PurchaseOrderLineId", null);
                    obj.BuyPrice            = GetReaderValue_NullableDouble(reader, "BuyPrice", null);
                    obj.DeliveryDate        = GetReaderValue_NullableDateTime(reader, "DeliveryDate", null);
                    obj.BuyCurrencyNo       = GetReaderValue_NullableInt32(reader, "BuyCurrencyNo", null);
                    obj.BuyCurrencyCode     = GetReaderValue_String(reader, "BuyCurrencyCode", "");
                    obj.SupplierCompanyNo   = GetReaderValue_NullableInt32(reader, "SupplierCompanyNo", null);
                    obj.SupplierCompanyName = GetReaderValue_String(reader, "SupplierCompanyName", "");
                    obj.CustomerCompanyNo   = GetReaderValue_NullableInt32(reader, "CustomerCompanyNo", null);
                    obj.CustomerCompanyName = GetReaderValue_String(reader, "CustomerCompanyName", "");
                    obj.Salesman            = GetReaderValue_NullableInt32(reader, "Salesman", null);
                    obj.SalesOrderNo        = GetReaderValue_NullableInt32(reader, "SalesOrderNo", null);
                    obj.SalesOrderNumber    = GetReaderValue_NullableInt32(reader, "SalesOrderNumber", null);
                    obj.CustomerPO          = GetReaderValue_String(reader, "CustomerPO", "");
                    obj.SellPrice           = GetReaderValue_NullableDouble(reader, "SellPrice", null);
                    obj.SellCurrencyNo      = GetReaderValue_NullableInt32(reader, "SellCurrencyNo", null);
                    obj.SellCurrencyCode    = GetReaderValue_String(reader, "SellCurrencyCode", "");
                    obj.DatePromised        = GetReaderValue_NullableDateTime(reader, "DatePromised", null);
                    obj.CustomerPart        = GetReaderValue_String(reader, "CustomerPart", "");
                    obj.GoodsInLineNo       = GetReaderValue_NullableInt32(reader, "GoodsInLineNo", null);
                    obj.Shipped             = GetReaderValue_NullableBoolean(reader, "Shipped", null);
                    obj.Location            = GetReaderValue_String(reader, "Location", "");
                    obj.SupplierPart        = GetReaderValue_String(reader, "SupplierPart", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Allocations", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }