示例#1
0
        /// <summary>
        /// Get
        /// Calls [usp_select_History]
        /// </summary>
        public override HistoryDetails Get(System.Int32?historyNo)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_History", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@HistoryNo", SqlDbType.Int).Value = historyNo;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetHistoryFromReader(reader);
                    HistoryDetails obj = new HistoryDetails();
                    obj.HistoryId                = GetReaderValue_Int32(reader, "HistoryId", 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.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.OriginalEntryDate        = GetReaderValue_NullableDateTime(reader, "OriginalEntryDate", null);
                    obj.Salesman                 = GetReaderValue_NullableInt32(reader, "Salesman", null);
                    obj.SupplierNo               = GetReaderValue_NullableInt32(reader, "SupplierNo", null);
                    obj.CurrencyNo               = GetReaderValue_NullableInt32(reader, "CurrencyNo", null);
                    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.SupplierName             = GetReaderValue_String(reader, "SupplierName", "");
                    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.ProductDescription       = GetReaderValue_String(reader, "ProductDescription", "");
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get History", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
示例#2
0
        public ActionResult OpdHistory()
        {
            HistoryDetails        hd             = new HistoryDetails();
            PatientAllDetails     patientDETAILS = (PatientAllDetails)Session["patientDetails"];
            List <HistoryDetails> Ld             = new List <HistoryDetails>();

            Ld       = BM.GetHistory(patientDETAILS.WhatsAppNo, patientDETAILS.CasePapaerNo);
            hd.lstHD = Ld;
            ////WebHistory Ld = new WebHistory();
            ////Ld = BM.GetWEBHistory(patientDETAILS.CasePapaerNo);
            return(View("History", hd));
        }
示例#3
0
        public HistoryDetails GetDAL_HistoryDetails(bool withTransaction)
        {
            HistoryDetails ObjHistoryDetails = null;

            if (withTransaction)
            {
                ObjHistoryDetails = new HistoryDetails(_transaction);
            }
            else
            {
                ObjHistoryDetails = new HistoryDetails(_connectionString);
            }
            return(ObjHistoryDetails);
        }
示例#4
0
        private void GetDetailsHistoryDataGrid(int numberTTN)
        {
            List <HistoryDetails> liHistDetailsTTN = HistoryDetails.GetDetailsHistory(numberTTN);

            int i = 0;

            while (liHistDetailsTTN.Count > 0)
            {
                DetailsCreatedTTNDataGridView.Rows.Add(liHistDetailsTTN[i].ModulName, liHistDetailsTTN[i].ZavodInventNumber,
                                                       liHistDetailsTTN[i].Count, liHistDetailsTTN[i].EdIzmer, liHistDetailsTTN[i].Package,
                                                       liHistDetailsTTN[i].Weight, liHistDetailsTTN[i].WayToGetWeight);
                i++;
            }
        }
示例#5
0
        private static History PopulateFromDBDetailsObject(HistoryDetails obj)
        {
            History objNew = new History();

            objNew.HistoryId                     = obj.HistoryId;
            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.OriginalEntryDate             = obj.OriginalEntryDate;
            objNew.Salesman                      = obj.Salesman;
            objNew.SupplierNo                    = obj.SupplierNo;
            objNew.CurrencyNo                    = obj.CurrencyNo;
            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.SupplierName                  = obj.SupplierName;
            objNew.Notes                         = obj.Notes;
            objNew.ManufacturerName              = obj.ManufacturerName;
            objNew.ProductName                   = obj.ProductName;
            objNew.PackageName                   = obj.PackageName;
            objNew.ClientNo                      = obj.ClientNo;
            objNew.CurrencyCode                  = obj.CurrencyCode;
            objNew.ManufacturerCode              = obj.ManufacturerCode;
            objNew.SupplierEmail                 = obj.SupplierEmail;
            objNew.SalesmanName                  = obj.SalesmanName;
            objNew.OfferStatusChangeEmployeeName = obj.OfferStatusChangeEmployeeName;
            objNew.ClientName                    = obj.ClientName;
            objNew.ClientDataVisibleToOthers     = obj.ClientDataVisibleToOthers;
            return(objNew);
        }
示例#6
0
        public List <HistoryDetails> GetHistory(string mobileNumber, string CPno)
        {
            try
            {
                SqlParameter[] sqlparam;
                sqlparam    = new SqlParameter[2];
                sqlparam[0] = new SqlParameter("@mobileNumber", mobileNumber);
                sqlparam[1] = new SqlParameter("@CPno", CPno);
                DataSet ds = CommonFunction.GetDataSet("USP_Get_HistoryByMobile_App", sqlparam, "");

                List <HistoryDetails>     HD = new List <HistoryDetails>();
                List <ObservationDetails> OD = new List <ObservationDetails>();
                List <TestDetails>        TD = new List <TestDetails>();
                List <MedicinesDetails>   MD = new List <MedicinesDetails>();
                List <HistoryFile>        HF = new List <HistoryFile>();
                //History
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    DataTable dt1 = ds.Tables[0];
                    foreach (DataRow dr in dt1.Rows)
                    {
                        HistoryDetails histrydetails = new HistoryDetails();
                        // HistoryDetails lstHD = new HistoryDetails();
                        CommonFunction.ReflectSingleData(histrydetails, dr);
                        if (ds != null && ds.Tables[0].Rows.Count > 0)
                        {
                            DataTable dt0 = ds.Tables[0];
                            foreach (DataRow dr0 in dt0.Rows)
                            {
                                if (Convert.ToInt32(dr0["QueueId"]) == histrydetails.QueueId)
                                {
                                    HistoryDetails lstHD = new HistoryDetails();
                                    CommonFunction.ReflectSingleData(lstHD, dr0);
                                    histrydetails.lstHD.Add(lstHD);
                                }
                            }
                        }


                        //Observation
                        if (ds != null && ds.Tables[1].Rows.Count > 0)
                        {
                            DataTable dt2 = ds.Tables[1];
                            foreach (DataRow dr1 in dt2.Rows)
                            {
                                if (Convert.ToInt32(dr1["QueueId"]) == histrydetails.QueueId)
                                {
                                    ObservationDetails lstOD = new ObservationDetails();
                                    CommonFunction.ReflectSingleData(lstOD, dr1);
                                    histrydetails.lstOD.Add(lstOD);
                                }
                            }
                        }
                        //Test
                        if (ds != null && ds.Tables[2].Rows.Count > 0)
                        {
                            DataTable dt3 = ds.Tables[2];
                            foreach (DataRow dr2 in dt3.Rows)
                            {
                                if (Convert.ToInt32(dr2["QueueId"]) == histrydetails.QueueId)
                                {
                                    TestDetails lstOD = new TestDetails();
                                    CommonFunction.ReflectSingleData(lstOD, dr2);
                                    histrydetails.lstTD.Add(lstOD);
                                }
                            }
                        }
                        //Medicine
                        if (ds != null && ds.Tables[3].Rows.Count > 0)
                        {
                            DataTable dt4 = ds.Tables[3];
                            foreach (DataRow dr3 in dt4.Rows)
                            {
                                if (Convert.ToInt32(dr3["QueueId"]) == histrydetails.QueueId)
                                {
                                    MedicinesDetails lstMD = new MedicinesDetails();
                                    CommonFunction.ReflectSingleData(lstMD, dr3);
                                    histrydetails.lstMD.Add(lstMD);
                                }
                            }
                        }

                        //
                        if (ds != null && ds.Tables[4].Rows.Count > 0)
                        {
                            DataTable dt5 = ds.Tables[4];
                            foreach (DataRow dr4 in dt5.Rows)
                            {
                                if (Convert.ToInt32(dr4["QueueId"]) == histrydetails.QueueId)
                                {
                                    HistoryFile lstHF = new HistoryFile();
                                    CommonFunction.ReflectSingleData(lstHF, dr4);
                                    histrydetails.lstHF.Add(lstHF);
                                }
                            }
                        }
                        HD.Add(histrydetails);
                    }
                }
                // HD.lstOD = OD;
                //histrydetails.lstHD = HD;
                //histrydetails.lstOD = OD;
                //histrydetails.lstTD = TD;
                //histrydetails.lstMD = MD;
                return(HD);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
        public static void pushState <T>(
            this History h,
            T state,
            string url,
            bool exclusive,
            Action <HistoryScope <T> > yield
            )
        {
            // exclusive parent means a sub state will undo parent, so they wont exist at the same time
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2013/201312/20131222-form
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201405/20140517
            // X:\jsc.svn\examples\javascript\UIAutomationEvents\UIAutomationEvents\Application.cs
            // X:\jsc.svn\examples\javascript\CSS\Test\CSSHistoric\CSSHistoric\Application.cs
            // X:\jsc.svn\examples\javascript\Test\TestHistoryForwardEvent\TestHistoryForwardEvent\Application.cs
            // does the forward button work?

            var delay = Stopwatch.StartNew();

            Console.WriteLine("HistoryExtensions pushState before yield");

            // when is the yield called?
            HistoryExtensions.yield(
                delegate
            {
                //0:3083ms HistoryExtensions pushState before yield
                //0:3086ms HistoryExtensions pushState.yield { ElapsedMilliseconds = 3, state =  }
                //0:3087ms HistoryExtensions pushState.yield before: { exclusive = 0, length = 1, MethodToken = AgAABgY2dze_awFR4sqxY4A, data_invoke = { function = AgAABgY2dze_awFR4sqxY4A, arguments = { foo = foo } }, data = [object Object] }

                Console.WriteLine("HistoryExtensions pushState.yield " + new
                {
                    delay.ElapsedMilliseconds,
                    // whats the current state?
                    Native.window.history.state
                }
                                  );

                if (yield.Target != null)
                {
                    if (yield.Target != Native.self)
                    {
                        throw new InvalidOperationException(
                            "we can only continue with global methods for now... " + new { yield.Target }
                            );
                    }
                }



                var MethodToken = ((__MethodInfo)yield.Method).InternalMethodToken;

                //var data_invoke = new { function = MethodToken, arguments = new object[] { state } };
                var data_invoke = new { MethodToken, arguments = new object[] { state } };
                var data        = new HistoryDetails
                {
                    // is this the previous state?
                    state = Native.window.history.state,

                    hint = "ScriptCoreLib.JavaScript.DOM.HistoryExtensions.pushState",

                    exclusive = exclusive,
                    url       = url,

                    // arguments:

                    //invoke = new { function = MethodToken, arguments = new object[] { state } }
                    invoke = data_invoke
                };


                //0:22850ms HistoryExtensions pushState before: { exclusive = 0, length = 1 } view-source:38792
                //0:22851ms HistoryExtensions pushState after: { length = 2 }

                // X:\jsc.svn\examples\javascript\Test\TestHistoryForwardEvent\TestHistoryForwardEvent\Application.cs
                // http://stackoverflow.com/questions/6460377/html5-history-api-what-is-the-max-size-the-state-object-can-be
                Console.WriteLine("HistoryExtensions pushState.yield before: " + new
                {
                    MethodToken,

                    exclusive,
                    Native.window.history.length,
                    data_invoke,
                    data
                });


                var current = new { Native.document.location.href };

                // fck ie
                //   y("history.state ", x_history_state, (HistoryDetails)Native.window.history.state);
                Native.window.history.pushState(data, "", url);

                //0:137143ms HistoryExtensions pushState before yield view-source:38792
                //0:137145ms HistoryExtensions pushState.yield view-source:38792
                //0:137147ms HistoryExtensions pushState.yield before: { exclusive = 0, length = 1, MethodToken = AgAABgY2dze_awFR4sqxY4A, data_invoke = { function = AgAABgY2dze_awFR4sqxY4A, arguments = { foo = foo } }, data = [object Object] } view-source:38792
                //0:137149ms HistoryExtensions pushState after: { length = 2, state = [object Object] }

                //Console.WriteLine("HistoryExtensions pushState.yield after: " + new
                //{
                //    Native.window.history.length,
                //    Native.window.history.state
                //});

                //var data1 = (HistoryDetails)Native.window.history.state;

                //Console.WriteLine("HistoryExtensions pushState.yield after: " + new
                //{
                //    data1.invoke
                //});


                #region __unwind
                TaskCompletionSource <HistoryScope <T> > __unwind = null;

                Func <TaskCompletionSource <HistoryScope <T> > > __get_unwind =
                    delegate
                {
                    // ok, something is listening to inline unwind.
                    // lets wait for the event then and not reload

                    Console.WriteLine("HistoryExtensions pushState __get_unwind [inline]");

                    if (__unwind == null)
                    {
                        __unwind = new TaskCompletionSource <HistoryScope <T> >();
                    }

                    return(__unwind);
                };
                #endregion

                var scope = new HistoryScope <T>
                {
                    __state = state,
                    __TaskCompletionSource = __get_unwind
                };


                #region exclusive
                if (exclusive)
                {
                    // this state is market exlusive.
                    // as such. we shall destroy any other state before we continue.
                    // if we go back in time
                    // we have to reactivate them ofcourse.

                    Console.WriteLine("HistoryExtensions pushState exlusive scope " + new { url });

                    foreach (var unwind in HistoryScope.inline_unwind.AsEnumerable())
                    {
                        var reload = unwind();

                        if (reload)
                        {
                            throw new NotImplementedException("exclusve scope needs to unwind prior states, yet one of them asks for full reload. what to do?");
                        }
                    }

                    //0:1ms HistoryExtensions pushState exlusive scope { url = http://192.168.1.91:13905/#/foo } view-source:35994
                    //0:1ms HistoryExtensions pushState before enter scope { url = http://192.168.1.91:13905/#/foo }

                    Console.WriteLine("disable all history aware styles, who is reenabling them?");

                    IStyleSheet.InternalHistoryAwareSheets.AsEnumerable()
                    // the application .ctor is not rerun? so we cannot even keep the primary style can we?
                    //.Skip(1)
                    .WithEachIndex(

                        (style, i) =>
                    {
                        Console.WriteLine("new exclusive state, will disable historic css " + new { i } +style.Owner.getAttribute("historic-url"));

                        if (i == 0)
                        {
                            return;
                        }

                        style.disabled = true;
                    }
                        );
                }
                #endregion

                HistoryScope.inline_unwind_data.Push(data);
                HistoryScope.inline_unwind.Push(
                    delegate
                {
                    if (__unwind == null)
                    {
                        return(true);
                    }

                    // time to do inline unwind.
                    __unwind.SetResult(scope);

                    return(false);
                }
                    );


                // X:\jsc.svn\examples\javascript\CSS\Test\CSSHistoric\CSSHistoric\Application.cs

                ;

                var NextStyle = new IStyleSheet();
                NextStyle.Owner.setAttribute("historic-url", IStyleSheet.all.Owner.getAttribute("historic-url") + " -> " + url);
                IStyleSheet.InternalHistoryAwareSheets.Push(NextStyle);

                // activate the scope
                Console.WriteLine("HistoryExtensions pushState before enter scope " + new { url });
                yield(scope);
                Console.WriteLine("HistoryExtensions pushState " + new { HistoryScope.inline_unwind.Count });
            }
                );
        }
        public static void replaceState <T>(this History h,
                                            T state,
                                            string url,
                                            bool exclusive,
                                            Action <HistoryScope <T> > yield
                                            )
        {
            // tested by
            // X:\jsc.svn\examples\javascript\async\AsyncHistoricActivities\AsyncHistoricActivities\Application.cs

            HistoryExtensions.yield(
                delegate
            {
                //Console.WriteLine("enter replaceState");

                if (yield.Target != null)
                {
                    if (yield.Target != Native.self)
                    {
                        throw new InvalidOperationException("we can only continue with global methods for now... " + new { yield.Target });
                    }
                }

                var MethodToken = ((__MethodInfo)yield.Method).InternalMethodToken;


                var data_state = (HistoryDetails)Native.window.history.state;

                // HistoryExtensions onpopstate { state = [object Object], e = { state = 7 }, history = { state = 7 }, Count = 2 }

                //        m.state = h.state;
                //m.hint = 'ScriptCoreLib.JavaScript.DOM.HistoryExtensions.replaceState';

                if (data_state != null)
                {
                    data_state = (HistoryDetails)data_state.state;
                }


                var data = new HistoryDetails
                {
                    // parent
                    state = data_state,

                    hint = "ScriptCoreLib.JavaScript.DOM.HistoryExtensions.replaceState",

                    exclusive = exclusive,
                    url       = url,

                    // arguments:

                    //invoke = new { function = MethodToken, arguments = new object[] { state } }
                    invoke = new { MethodToken, arguments = new object[] { state } }
                };

                Console.WriteLine("before history.replaceState");
                // IE throws __exc	Argument not optional
                // X:\jsc.svn\examples\javascript\CSS\Test\CSSHistoric\CSSHistoric\Application.cs


                Native.window.history.replaceState(data, "", url);
                Console.WriteLine("after history.replaceState");

                #region __unwind
                TaskCompletionSource <HistoryScope <T> > __unwind = null;

                Func <TaskCompletionSource <HistoryScope <T> > > __get_unwind =
                    delegate
                {
                    // ok, something is listening to inline unwind.
                    // lets wait for the event then and not reload

                    Console.WriteLine("__get_unwind [inline]");

                    if (__unwind == null)
                    {
                        __unwind = new TaskCompletionSource <HistoryScope <T> >();
                    }

                    return(__unwind);
                };
                #endregion

                var scope = new HistoryScope <T> {
                    __state = state, __TaskCompletionSource = __get_unwind
                };

                if (HistoryScope.inline_unwind.Count > 0)
                {
                    HistoryScope.inline_unwind_data.Pop();
                    var unwind = HistoryScope.inline_unwind.Pop();
                    var reload = unwind();

                    if (reload)
                    {
                        throw new NotImplementedException("cant reload here can we");
                    }
                }

                #region exclusive
                if (exclusive)
                {
                    // this state is market exlusive.
                    // as such. we shall destroy any other state before we continue.
                    // if we go back in time
                    // we have to reactivate them ofcourse.

                    Console.WriteLine("HistoryExtensions pushState exlusive scope " + new { url });

                    foreach (var unwind in HistoryScope.inline_unwind.AsEnumerable())
                    {
                        var reload = unwind();

                        if (reload)
                        {
                            throw new NotImplementedException("exclusve scope needs to unwind prior states, yet one of them asks for full reload. what to do?");
                        }
                    }

                    Console.WriteLine("disable all history aware styles, who is reenabling them?");

                    IStyleSheet.InternalHistoryAwareSheets.AsEnumerable()
                    // the application .ctor is not rerun? so we cannot even keep the primary style can we?
                    //.Skip(1)
                    .WithEachIndex(

                        (style, i) =>
                    {
                        Console.WriteLine("new exclusive state, will disable historic css " + new { i } +style.Owner.getAttribute("historic-url"));

                        if (i == 0)
                        {
                            return;
                        }

                        style.disabled = true;
                    }
                        );
                }
                #endregion

                HistoryScope.inline_unwind_data.Push(data);
                HistoryScope.inline_unwind.Push(
                    delegate
                {
                    if (__unwind == null)
                    {
                        return(true);
                    }

                    // time to do inline unwind.
                    __unwind.SetResult(scope);

                    return(false);
                }
                    );

                //var css = IStyleSheet.InternalHistoryAwareSheets.Pop();
                //if (css != null)
                //    css.disabled = true;

                var css = IStyleSheet.InternalHistoryAwareSheets.Pop();
                if (css != null)
                {
                    Console.WriteLine("replace: remove css " + css.Owner.getAttribute("historic-url")
                                      );

                    css.disabled = true;
                    css.Owner.Orphanize();
                }

                //IStyleSheet.InternalHistoryAwareSheets.Push(new IStyleSheet());

                var NextStyle = new IStyleSheet();
                NextStyle.Owner.setAttribute("historic-url", IStyleSheet.all.Owner.getAttribute("historic-url") + " => " + url);
                IStyleSheet.InternalHistoryAwareSheets.Push(NextStyle);

                Console.WriteLine("before yield");
                yield(scope);

                Console.WriteLine("replaceState: " + new { HistoryScope.inline_unwind.Count });
            }
                );
        }
示例#9
0
        /// <summary>
        /// Source
        /// Calls [usp_source_History]
        /// </summary>
        public override List <HistoryDetails> Source(System.Int32?clientId, System.String partSearch, System.Int32?index, DateTime?startDate, DateTime?endDate, out DateTime?outDate, bool hasServerLocal, bool?isPoHub)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            outDate = null;
            string proc = "usp_source_History";

            proc = isPoHub == true ? "usp_source_HistoryPH" : proc;
            try {
                if (!hasServerLocal)
                {
                    cn = new SqlConnection(this.GTConnectionString);
                }
                else
                {
                    cn = new SqlConnection(this.ConnectionString);
                }

                cmd                = new SqlCommand(proc, 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;
                cn.Open();
                //DbDataReader reader = ExecuteReader(cmd);
                SqlDataReader         reader = cmd.ExecuteReader();
                List <HistoryDetails> lst    = new List <HistoryDetails>();
                while (reader.Read())
                {
                    HistoryDetails obj = new HistoryDetails();
                    obj.HistoryId                     = GetReaderValue_Int32(reader, "HistoryId", 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.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.OriginalEntryDate             = GetReaderValue_NullableDateTime(reader, "OriginalEntryDate", null);
                    obj.Salesman                      = GetReaderValue_NullableInt32(reader, "Salesman", null);
                    obj.SupplierNo                    = GetReaderValue_NullableInt32(reader, "SupplierNo", null);
                    obj.CurrencyNo                    = GetReaderValue_NullableInt32(reader, "CurrencyNo", 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.OfferStatusNo                 = GetReaderValue_NullableInt32(reader, "OfferStatusNo", null);
                    obj.OfferStatusChangeDate         = GetReaderValue_NullableDateTime(reader, "OfferStatusChangeDate", null);
                    obj.OfferStatusChangeLoginNo      = GetReaderValue_NullableInt32(reader, "OfferStatusChangeLoginNo", null);
                    obj.SupplierName                  = GetReaderValue_String(reader, "SupplierName", "");
                    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.CurrencyCode                  = GetReaderValue_String(reader, "CurrencyCode", "");
                    obj.ManufacturerCode              = GetReaderValue_String(reader, "ManufacturerCode", "");
                    obj.SupplierEmail                 = GetReaderValue_String(reader, "SupplierEmail", "");
                    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", "");
                    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 Historys", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }