Ejemplo n.º 1
0
        private static DebitLine PopulateFromDBDetailsObject(DebitLineDetails obj)
        {
            DebitLine objNew = new DebitLine();

            objNew.DebitLineId         = obj.DebitLineId;
            objNew.DebitNo             = obj.DebitNo;
            objNew.FullPart            = obj.FullPart;
            objNew.Part                = obj.Part;
            objNew.ManufacturerNo      = obj.ManufacturerNo;
            objNew.DateCode            = obj.DateCode;
            objNew.PackageNo           = obj.PackageNo;
            objNew.ProductNo           = obj.ProductNo;
            objNew.Quantity            = obj.Quantity;
            objNew.Price               = obj.Price;
            objNew.Taxable             = obj.Taxable;
            objNew.SupplierPart        = obj.SupplierPart;
            objNew.LandedCost          = obj.LandedCost;
            objNew.PurchaseOrderLineNo = obj.PurchaseOrderLineNo;
            objNew.SupplierRMALineNo   = obj.SupplierRMALineNo;
            objNew.StockNo             = obj.StockNo;
            objNew.ROHS                = obj.ROHS;
            objNew.UpdatedBy           = obj.UpdatedBy;
            objNew.DLUP                = obj.DLUP;
            objNew.ServiceNo           = obj.ServiceNo;
            objNew.Notes               = obj.Notes;
            objNew.FullSupplierPart    = obj.FullSupplierPart;
            objNew.DebitId             = obj.DebitId;
            objNew.DebitNumber         = obj.DebitNumber;
            objNew.DebitDate           = obj.DebitDate;
            objNew.CompanyName         = obj.CompanyName;
            objNew.CompanyNo           = obj.CompanyNo;
            objNew.SupplierRMANumber   = obj.SupplierRMANumber;
            objNew.SupplierRMANo       = obj.SupplierRMANo;
            objNew.SupplierInvoice     = obj.SupplierInvoice;
            objNew.PurchaseOrderNumber = obj.PurchaseOrderNumber;
            objNew.PurchaseOrderNo     = obj.PurchaseOrderNo;
            objNew.ContactName         = obj.ContactName;
            objNew.ContactNo           = obj.ContactNo;
            objNew.ManufacturerCode    = obj.ManufacturerCode;
            objNew.RowNum              = obj.RowNum;
            objNew.RowCnt              = obj.RowCnt;
            objNew.DivisionNo          = obj.DivisionNo;
            objNew.ManufacturerName    = obj.ManufacturerName;
            objNew.PackageName         = obj.PackageName;
            objNew.PackageDescription  = obj.PackageDescription;
            objNew.ProductName         = obj.ProductName;
            objNew.ProductDescription  = obj.ProductDescription;
            objNew.CurrencyNo          = obj.CurrencyNo;
            objNew.CurrencyCode        = obj.CurrencyCode;
            objNew.LineNotes           = obj.LineNotes;
            return(objNew);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// GetListForSupplierRMALine
        /// Calls [usp_selectAll_DebitLine_for_SupplierRMALine]
        /// </summary>
        public override List <DebitLineDetails> GetListForSupplierRMALine(System.Int32?supplierRmaLineId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_DebitLine_for_SupplierRMALine", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@SupplierRMALineId", SqlDbType.Int).Value = supplierRmaLineId;
                cn.Open();
                DbDataReader            reader = ExecuteReader(cmd);
                List <DebitLineDetails> lst    = new List <DebitLineDetails>();
                while (reader.Read())
                {
                    DebitLineDetails obj = new DebitLineDetails();
                    obj.DebitLineId         = GetReaderValue_Int32(reader, "DebitLineId", 0);
                    obj.DebitNo             = GetReaderValue_Int32(reader, "DebitNo", 0);
                    obj.FullPart            = GetReaderValue_String(reader, "FullPart", "");
                    obj.Part                = GetReaderValue_String(reader, "Part", "");
                    obj.ManufacturerNo      = GetReaderValue_NullableInt32(reader, "ManufacturerNo", null);
                    obj.DateCode            = GetReaderValue_String(reader, "DateCode", "");
                    obj.PackageNo           = GetReaderValue_NullableInt32(reader, "PackageNo", null);
                    obj.ProductNo           = GetReaderValue_NullableInt32(reader, "ProductNo", null);
                    obj.Quantity            = GetReaderValue_Int32(reader, "Quantity", 0);
                    obj.Price               = GetReaderValue_Double(reader, "Price", 0);
                    obj.Taxable             = GetReaderValue_Boolean(reader, "Taxable", false);
                    obj.SupplierPart        = GetReaderValue_String(reader, "SupplierPart", "");
                    obj.LandedCost          = GetReaderValue_NullableDouble(reader, "LandedCost", null);
                    obj.PurchaseOrderLineNo = GetReaderValue_NullableInt32(reader, "PurchaseOrderLineNo", null);
                    obj.SupplierRMALineNo   = GetReaderValue_NullableInt32(reader, "SupplierRMALineNo", null);
                    obj.StockNo             = GetReaderValue_NullableInt32(reader, "StockNo", null);
                    obj.ROHS                = GetReaderValue_Byte(reader, "ROHS", (byte)0);
                    obj.UpdatedBy           = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP                = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    obj.ServiceNo           = GetReaderValue_NullableInt32(reader, "ServiceNo", null);
                    obj.DebitNumber         = GetReaderValue_Int32(reader, "DebitNumber", 0);
                    obj.DebitDate           = GetReaderValue_DateTime(reader, "DebitDate", DateTime.MinValue);
                    obj.ManufacturerCode    = GetReaderValue_String(reader, "ManufacturerCode", "");
                    obj.DivisionNo          = GetReaderValue_Int32(reader, "DivisionNo", 0);
                    obj.ManufacturerName    = GetReaderValue_String(reader, "ManufacturerName", "");
                    obj.PackageName         = GetReaderValue_String(reader, "PackageName", "");
                    obj.PackageDescription  = GetReaderValue_String(reader, "PackageDescription", "");
                    obj.ProductName         = GetReaderValue_String(reader, "ProductName", "");
                    obj.ProductDescription  = GetReaderValue_String(reader, "ProductDescription", "");
                    obj.CurrencyNo          = GetReaderValue_Int32(reader, "CurrencyNo", 0);
                    obj.CurrencyCode        = GetReaderValue_String(reader, "CurrencyCode", "");
                    obj.LineNotes           = GetReaderValue_String(reader, "LineNotes", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get DebitLines", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// DataListNugget
        /// Calls [usp_datalistnugget_DebitLine]
        /// </summary>
        public override List <DebitLineDetails> DataListNugget(System.Int32?clientId, System.Int32?teamId, System.Int32?divisionId, System.Int32?loginId, System.Int32?orderBy, System.Int32?sortDir, System.Int32?pageIndex, System.Int32?pageSize, System.String partSearch, System.String contactSearch, System.String cmSearch, System.Int32?buyerSearch, System.String debitNotesSearch, System.String supplierInvoiceSearch, System.Int32?debitNoLo, System.Int32?debitNoHi, System.Int32?purchaseOrderNoLo, System.Int32?purchaseOrderNoHi, System.Int32?supplierRmaNoLo, System.Int32?supplierRmaNoHi, System.DateTime?debitDateFrom, System.DateTime?debitDateTo, System.Boolean?PohubOnly, Boolean IsGlobalLogin, System.Int32?clientSearchId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_datalistnugget_DebitLine", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 60;
                cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value                   = clientId;
                cmd.Parameters.Add("@TeamId", SqlDbType.Int).Value                     = teamId;
                cmd.Parameters.Add("@DivisionId", SqlDbType.Int).Value                 = divisionId;
                cmd.Parameters.Add("@LoginId", SqlDbType.Int).Value                    = loginId;
                cmd.Parameters.Add("@OrderBy", SqlDbType.Int).Value                    = orderBy;
                cmd.Parameters.Add("@SortDir", SqlDbType.Int).Value                    = sortDir;
                cmd.Parameters.Add("@PageIndex", SqlDbType.Int).Value                  = pageIndex;
                cmd.Parameters.Add("@PageSize", SqlDbType.Int).Value                   = pageSize;
                cmd.Parameters.Add("@PartSearch", SqlDbType.NVarChar).Value            = partSearch;
                cmd.Parameters.Add("@ContactSearch", SqlDbType.NVarChar).Value         = contactSearch;
                cmd.Parameters.Add("@CMSearch", SqlDbType.NVarChar).Value              = cmSearch;
                cmd.Parameters.Add("@BuyerSearch", SqlDbType.Int).Value                = buyerSearch;
                cmd.Parameters.Add("@DebitNotesSearch", SqlDbType.NVarChar).Value      = debitNotesSearch;
                cmd.Parameters.Add("@SupplierInvoiceSearch", SqlDbType.NVarChar).Value = supplierInvoiceSearch;
                cmd.Parameters.Add("@DebitNoLo", SqlDbType.Int).Value                  = debitNoLo;
                cmd.Parameters.Add("@DebitNoHi", SqlDbType.Int).Value                  = debitNoHi;
                cmd.Parameters.Add("@PurchaseOrderNoLo", SqlDbType.Int).Value          = purchaseOrderNoLo;
                cmd.Parameters.Add("@PurchaseOrderNoHi", SqlDbType.Int).Value          = purchaseOrderNoHi;
                cmd.Parameters.Add("@SupplierRMANoLo", SqlDbType.Int).Value            = supplierRmaNoLo;
                cmd.Parameters.Add("@SupplierRMANoHi", SqlDbType.Int).Value            = supplierRmaNoHi;
                cmd.Parameters.Add("@DebitDateFrom", SqlDbType.DateTime).Value         = debitDateFrom;
                cmd.Parameters.Add("@DebitDateTo", SqlDbType.DateTime).Value           = debitDateTo;
                cmd.Parameters.Add("@PoHubOnly", SqlDbType.Bit).Value                  = PohubOnly;
                cmd.Parameters.Add("@IsGlobalLogin", SqlDbType.Bit).Value              = IsGlobalLogin;
                cmd.Parameters.Add("@ClientSearchId", SqlDbType.Int).Value             = clientSearchId;

                cn.Open();
                DbDataReader            reader = ExecuteReader(cmd);
                List <DebitLineDetails> lst    = new List <DebitLineDetails>();
                while (reader.Read())
                {
                    DebitLineDetails obj = new DebitLineDetails();
                    obj.Part                    = GetReaderValue_String(reader, "Part", "");
                    obj.ManufacturerNo          = GetReaderValue_NullableInt32(reader, "ManufacturerNo", null);
                    obj.ROHS                    = GetReaderValue_Byte(reader, "ROHS", (byte)0);
                    obj.DebitId                 = GetReaderValue_Int32(reader, "DebitId", 0);
                    obj.DebitNumber             = GetReaderValue_Int32(reader, "DebitNumber", 0);
                    obj.DebitDate               = GetReaderValue_DateTime(reader, "DebitDate", DateTime.MinValue);
                    obj.CompanyName             = GetReaderValue_String(reader, "CompanyName", "");
                    obj.CompanyNo               = GetReaderValue_Int32(reader, "CompanyNo", 0);
                    obj.SupplierRMANumber       = GetReaderValue_Int32(reader, "SupplierRMANumber", 0);
                    obj.SupplierRMANo           = GetReaderValue_NullableInt32(reader, "SupplierRMANo", null);
                    obj.SupplierInvoice         = GetReaderValue_String(reader, "SupplierInvoice", "");
                    obj.PurchaseOrderNumber     = GetReaderValue_Int32(reader, "PurchaseOrderNumber", 0);
                    obj.PurchaseOrderNo         = GetReaderValue_NullableInt32(reader, "PurchaseOrderNo", null);
                    obj.ContactName             = GetReaderValue_String(reader, "ContactName", "");
                    obj.ContactNo               = GetReaderValue_Int32(reader, "ContactNo", 0);
                    obj.ManufacturerCode        = GetReaderValue_String(reader, "ManufacturerCode", "");
                    obj.RowCnt                  = GetReaderValue_NullableInt32(reader, "RowCnt", null);
                    obj.IPOCompanyNo            = GetReaderValue_NullableInt32(reader, "IPOCompanyNo", 0);
                    obj.IPOCompanyName          = GetReaderValue_String(reader, "IPOCompanyName", "");
                    obj.InternalPurchaseOrderId = GetReaderValue_NullableInt32(reader, "InternalPurchaseOrderId", null);
                    obj.ClientName              = GetReaderValue_String(reader, "ClientName", "");

                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get DebitLines", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }