Beispiel #1
0
        private static Excess PopulateFromDBDetailsObject(ExcessDetails obj)
        {
            Excess objNew = new Excess();

            objNew.ExcessId                      = obj.ExcessId;
            objNew.ExcessName                    = obj.ExcessName;
            objNew.FullPart                      = obj.FullPart;
            objNew.Part                          = obj.Part;
            objNew.ManufacturerNo                = obj.ManufacturerNo;
            objNew.DateCode                      = obj.DateCode;
            objNew.ProductNo                     = obj.ProductNo;
            objNew.PackageNo                     = obj.PackageNo;
            objNew.Quantity                      = obj.Quantity;
            objNew.Price                         = obj.Price;
            objNew.CurrencyNo                    = obj.CurrencyNo;
            objNew.OriginalEntryDate             = obj.OriginalEntryDate;
            objNew.Salesman                      = obj.Salesman;
            objNew.CompanyNo                     = obj.CompanyNo;
            objNew.ROHS                          = obj.ROHS;
            objNew.UpdatedBy                     = obj.UpdatedBy;
            objNew.DLUP                          = obj.DLUP;
            objNew.OfferStatusNo                 = obj.OfferStatusNo;
            objNew.OfferStatusChangeDate         = obj.OfferStatusChangeDate;
            objNew.OfferStatusChangeLoginNo      = obj.OfferStatusChangeLoginNo;
            objNew.CompanyName                   = obj.CompanyName;
            objNew.Notes                         = obj.Notes;
            objNew.ManufacturerName              = obj.ManufacturerName;
            objNew.ProductName                   = obj.ProductName;
            objNew.PackageName                   = obj.PackageName;
            objNew.ClientNo                      = obj.ClientNo;
            objNew.SupplierName                  = obj.SupplierName;
            objNew.SupplierEmail                 = obj.SupplierEmail;
            objNew.ManufacturerCode              = obj.ManufacturerCode;
            objNew.CurrencyCode                  = obj.CurrencyCode;
            objNew.SalesmanName                  = obj.SalesmanName;
            objNew.OfferStatusChangeEmployeeName = obj.OfferStatusChangeEmployeeName;
            objNew.ClientName                    = obj.ClientName;
            objNew.ClientDataVisibleToOthers     = obj.ClientDataVisibleToOthers;
            return(objNew);
        }
Beispiel #2
0
        /// <summary>
        /// Source
        /// Calls [usp_ipobom_source_Excess]
        /// </summary>
        public override List <ExcessDetails> IPOBOMSource(System.Int32?clientId, System.String partSearch, System.Int32?index, DateTime?startDate, DateTime?endDate, out DateTime?outDate, bool hasServerLocal, System.Boolean?isPOHub)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            outDate = null;

            try
            {
                if (!hasServerLocal)
                {
                    cn = new SqlConnection(this.GTConnectionString);
                }
                else
                {
                    cn = new SqlConnection(this.ConnectionString);
                }

                if (isPOHub.Value)
                {
                    cmd = new SqlCommand("usp_ipobom_source_ExcessPH", cn);
                }
                else
                {
                    cmd = new SqlCommand("usp_ipobom_source_Excess", cn);
                }
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value        = clientId;
                cmd.Parameters.Add("@PartSearch", SqlDbType.NVarChar).Value = partSearch;
                cmd.Parameters.Add("@Index", SqlDbType.Int).Value           = index;
                cmd.Parameters.Add("@StartDate", SqlDbType.DateTime).Value  = startDate;
                cmd.Parameters.Add("@FinishDate", SqlDbType.DateTime).Value = endDate;
                cmd.Parameters.Add("@IsPoHUB", SqlDbType.Bit).Value         = isPOHub;
                cn.Open();

                //DbDataReader reader = ExecuteReader(cmd);
                SqlDataReader        reader = cmd.ExecuteReader();
                List <ExcessDetails> lst    = new List <ExcessDetails>();

                while (reader.Read())
                {
                    ExcessDetails obj = new ExcessDetails();
                    obj.ExcessId                      = GetReaderValue_Int32(reader, "ExcessId", 0);
                    obj.ExcessName                    = GetReaderValue_String(reader, "ExcessName", "");
                    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.ProductNo                     = GetReaderValue_NullableInt32(reader, "ProductNo", null);
                    obj.PackageNo                     = GetReaderValue_NullableInt32(reader, "PackageNo", null);
                    obj.Quantity                      = GetReaderValue_Int32(reader, "Quantity", 0);
                    obj.Price                         = GetReaderValue_Double(reader, "Price", 0);
                    obj.CurrencyNo                    = GetReaderValue_NullableInt32(reader, "CurrencyNo", null);
                    obj.OriginalEntryDate             = GetReaderValue_NullableDateTime(reader, "OriginalEntryDate", null);
                    obj.Salesman                      = GetReaderValue_NullableInt32(reader, "Salesman", null);
                    obj.CompanyNo                     = GetReaderValue_Int32(reader, "CompanyNo", 0);
                    obj.ROHS                          = GetReaderValue_Byte(reader, "ROHS", (byte)0);
                    obj.UpdatedBy                     = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP                          = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    obj.OfferStatusNo                 = GetReaderValue_NullableInt32(reader, "OfferStatusNo", null);
                    obj.OfferStatusChangeDate         = GetReaderValue_NullableDateTime(reader, "OfferStatusChangeDate", null);
                    obj.OfferStatusChangeLoginNo      = GetReaderValue_NullableInt32(reader, "OfferStatusChangeLoginNo", null);
                    obj.CompanyName                   = GetReaderValue_String(reader, "CompanyName", "");
                    obj.Notes                         = GetReaderValue_String(reader, "Notes", "");
                    obj.ManufacturerName              = GetReaderValue_String(reader, "ManufacturerName", "");
                    obj.ProductName                   = GetReaderValue_String(reader, "ProductName", "");
                    obj.PackageName                   = GetReaderValue_String(reader, "PackageName", "");
                    obj.ClientNo                      = GetReaderValue_NullableInt32(reader, "ClientNo", null);
                    obj.SupplierName                  = GetReaderValue_String(reader, "SupplierName", "");
                    obj.SupplierEmail                 = GetReaderValue_String(reader, "SupplierEmail", "");
                    obj.ManufacturerCode              = GetReaderValue_String(reader, "ManufacturerCode", "");
                    obj.CurrencyCode                  = GetReaderValue_String(reader, "CurrencyCode", "");
                    obj.SalesmanName                  = GetReaderValue_String(reader, "SalesmanName", "");
                    obj.OfferStatusChangeEmployeeName = GetReaderValue_String(reader, "OfferStatusChangeEmployeeName", "");
                    obj.ClientName                    = GetReaderValue_String(reader, "ClientName", "");
                    obj.ClientDataVisibleToOthers     = GetReaderValue_NullableBoolean(reader, "ClientDataVisibleToOthers", null);
                    //[001] code start
                    obj.SupplierType = GetReaderValue_String(reader, "SupplierType", "");
                    //[001] code end
                    obj.ClientCode    = GetReaderValue_String(reader, "ClientCode", "");
                    obj.MSL           = GetReaderValue_String(reader, "MSL", "");
                    obj.SPQ           = GetReaderValue_String(reader, "SPQ", "");
                    obj.LeadTime      = GetReaderValue_String(reader, "LeadTime", "");
                    obj.RoHSStatus    = GetReaderValue_String(reader, "RoHSStatus", "");
                    obj.FactorySealed = GetReaderValue_String(reader, "FactorySealed", "");
                    //obj.IPOBOMNo = GetReaderValue_Int32(reader, "IPOBOMNo", 0);
                    obj.SupplierTotalQSA = GetReaderValue_String(reader, "SupplierTotalQSA", "");
                    obj.SupplierLTB      = GetReaderValue_String(reader, "SupplierLTB", "");
                    obj.SupplierMOQ      = GetReaderValue_String(reader, "SupplierMOQ", "");
                    lst.Add(obj);
                    obj = null;
                }
                reader.NextResult();
                while (reader.Read())
                {
                    outDate = GetReaderValue_NullableDateTime(reader, "OutPutDate", null);
                }

                return(lst);
            }
            catch (SqlException sqlex)
            {
                //LogException(sqlex);
                throw new Exception("Failed to get Excesss", sqlex);
            }
            finally
            {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Get
        /// Calls [usp_select_Excess]
        /// </summary>
        public override ExcessDetails Get(System.Int32?excessId, bool?isPoHub)
        {
            SqlConnection cn   = null;
            SqlCommand    cmd  = null;
            string        proc = "usp_select_Excess";

            try {
                // proc = isPoHub == true ? "usp_select_ExcessPH" : proc;
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand(proc, cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@ExcessId", SqlDbType.Int).Value = excessId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetExcessFromReader(reader);
                    ExcessDetails obj = new ExcessDetails();
                    obj.ExcessId                 = GetReaderValue_Int32(reader, "ExcessId", 0);
                    obj.ExcessName               = GetReaderValue_String(reader, "ExcessName", "");
                    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.ProductNo                = GetReaderValue_NullableInt32(reader, "ProductNo", null);
                    obj.PackageNo                = GetReaderValue_NullableInt32(reader, "PackageNo", null);
                    obj.Quantity                 = GetReaderValue_Int32(reader, "Quantity", 0);
                    obj.Price                    = GetReaderValue_Double(reader, "Price", 0);
                    obj.CurrencyNo               = GetReaderValue_NullableInt32(reader, "CurrencyNo", null);
                    obj.OriginalEntryDate        = GetReaderValue_NullableDateTime(reader, "OriginalEntryDate", null);
                    obj.Salesman                 = GetReaderValue_NullableInt32(reader, "Salesman", null);
                    obj.CompanyNo                = GetReaderValue_Int32(reader, "CompanyNo", 0);
                    obj.ROHS                     = GetReaderValue_NullableByte(reader, "ROHS", null);
                    obj.UpdatedBy                = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP                     = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue);
                    obj.OfferStatusNo            = GetReaderValue_NullableInt32(reader, "OfferStatusNo", null);
                    obj.OfferStatusChangeDate    = GetReaderValue_NullableDateTime(reader, "OfferStatusChangeDate", null);
                    obj.OfferStatusChangeLoginNo = GetReaderValue_NullableInt32(reader, "OfferStatusChangeLoginNo", null);
                    obj.CompanyName              = GetReaderValue_String(reader, "CompanyName", "");
                    obj.Notes                    = GetReaderValue_String(reader, "Notes", "");
                    obj.ManufacturerName         = GetReaderValue_String(reader, "ManufacturerName", "");
                    obj.ProductName              = GetReaderValue_String(reader, "ProductName", "");
                    obj.PackageName              = GetReaderValue_String(reader, "PackageName", "");

                    obj.SPQ                = GetReaderValue_String(reader, "SPQ", "");
                    obj.LeadTime           = GetReaderValue_String(reader, "LeadTime", "");
                    obj.RoHSStatus         = GetReaderValue_String(reader, "ROHSStatus", "");
                    obj.FactorySealed      = GetReaderValue_String(reader, "FactorySealed", "");
                    obj.MSL                = GetReaderValue_String(reader, "MSL", "");
                    obj.SupplierMOQ        = GetReaderValue_String(reader, "SupplierMOQ", "");
                    obj.SupplierTotalQSA   = GetReaderValue_String(reader, "SupplierTotalQSA", "");
                    obj.SupplierLTB        = GetReaderValue_String(reader, "SupplierLTB", "");
                    obj.ProductDescription = GetReaderValue_String(reader, "ProductDescription", "");
                    obj.ProductInactive    = GetReaderValue_NullableBoolean(reader, "ProductInactive", false);
                    obj.MSLLevelNo         = GetReaderValue_NullableInt32(reader, "MSLLevelNo", null);
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Excess", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }