コード例 #1
0
        public override void ParseFromDataReader(System.Data.SqlClient.SqlDataReader r)
        {
            ID     = r.GetGuid(0);
            TaskID = r.GetInt32(1);
            if (!r.IsDBNull(2))
            {
                Priority = (Priority)r.GetInt32(2);
            }
            else
            {
                Priority = null;
            }

            if (!r.IsDBNull(3))
            {
                ScheduleID = r.GetGuid(3);
            }
            else
            {
                ScheduleID = null;
            }

            if (!r.IsDBNull(4))
            {
                Inserted = r.GetDateTime(4);
            }
            else
            {
                Inserted = DT_NEVER;
            }

            if (!r.IsDBNull(5))
            {
                ServerID = r.GetInt32(5);
            }
            else
            {
                ServerID = null;
            }

            if (!r.IsDBNull(6))
            {
                LastUpdate = r.GetDateTime(6);
            }
            else
            {
                LastUpdate = DT_NEVER;
            }

            if (!r.IsDBNull(7))
            {
                ReturnCode = r.GetString(7);
            }
            else
            {
                ReturnCode = null;
            }

            Status = (TaskStatus)r.GetInt32(8);
        }
コード例 #2
0
ファイル: HistoryDetail.cs プロジェクト: paulusyeung/RT2020
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            listView.Items.Clear();

            int     iCount   = 0;
            decimal totalQty = 0;
            string  query    = BuildQuery();

            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.CommandText    = query;
            cmd.CommandTimeout = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CommandTimedOut"]);
            cmd.CommandType    = CommandType.Text;

            using (System.Data.SqlClient.SqlDataReader reader = SqlHelper.Default.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    ListViewItem objItem = this.listView.Items.Add(reader.GetGuid(0).ToString());
                    objItem.SubItems.Add(reader.GetInt32(2).ToString()); // Line Number
                    objItem.SubItems.Add(reader.GetString(4));
                    objItem.SubItems.Add(reader.GetString(5));
                    objItem.SubItems.Add(reader.GetString(6));
                    objItem.SubItems.Add(reader.GetString(7));
                    objItem.SubItems.Add(reader.GetDecimal(8).ToString("##"));

                    totalQty += reader.GetDecimal(8);
                    iCount++;
                }
            }

            txtTotalStock.Text = iCount.ToString();
            txtTotalQty.Text   = totalQty.ToString("##");
        }
コード例 #3
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            listView.Items.Clear();

            string query = BuildQuery();

            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.CommandText    = query;
            cmd.CommandTimeout = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CommandTimedOut"]);
            cmd.CommandType    = CommandType.Text;

            using (System.Data.SqlClient.SqlDataReader reader = SqlHelper.Default.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    ListViewItem objItem = this.listView.Items.Add(reader.GetGuid(0).ToString());
                    objItem.SubItems.Add(reader.GetString(3));                                            // Tx Number
                    objItem.SubItems.Add(reader.GetString(5));
                    objItem.SubItems.Add(reader.GetDateTime(4).ToString(Common.Utility.GetDateFormat())); //
                    objItem.SubItems.Add(reader.GetDateTime(6).ToString(Common.Utility.GetDateFormat()));
                    objItem.SubItems.Add(reader.GetString(1));
                    objItem.SubItems.Add(reader.GetDecimal(7).ToString("##"));
                }
            }
        }
コード例 #4
0
        public Common.Item[] GetAllDisplay_Suppliers_Array()
        {
            Params.spS_tblSupplier_Display param = new Params.spS_tblSupplier_Display(true);

            param.SetUpConnection(string.Empty);


            using (SPs.spS_tblSupplier_Display sp = new SPs.spS_tblSupplier_Display(true)) {
                System.Collections.ArrayList records = new System.Collections.ArrayList();

                System.Data.SqlClient.SqlDataReader sqlDataReader = null;
                sp.Execute(ref param, out sqlDataReader);

                while (sqlDataReader.Read())
                {
                    records.Add(new Common.Item(sqlDataReader.GetGuid(SPs.spS_tblSupplier_Display.Resultset1.Fields.Column_ID1.ColumnIndex), sqlDataReader.GetString(SPs.spS_tblSupplier_Display.Resultset1.Fields.Column_Display.ColumnIndex)));
                }

                sqlDataReader.Close();

                if (sp.Connection.State == System.Data.ConnectionState.Open)
                {
                    sp.Connection.Close();
                }

                sp.Dispose();
                param.Dispose();

                return((Common.Item[])records.ToArray(typeof(Common.Item)));
            }
        }
コード例 #5
0
        public Common.Item[] GetAllDisplay_tblOrderItem_Collection_Array(WSTypes.WSGuid col_Oit_GuidOrderID, WSTypes.WSGuid col_Oit_GuidProductID)
        {
            Params.spS_tblOrderItem_Display param = new Params.spS_tblOrderItem_Display(true);

            param.SetUpConnection(string.Empty);

            if (col_Oit_GuidOrderID == null || col_Oit_GuidOrderID.UseNull)
            {
                param.Param_Oit_GuidOrderID = SqlGuid.Null;
            }
            else if (!col_Oit_GuidOrderID.UseDefault)
            {
                param.Param_Oit_GuidOrderID = col_Oit_GuidOrderID.Value;
            }

            if (col_Oit_GuidProductID == null || col_Oit_GuidProductID.UseNull)
            {
                param.Param_Oit_GuidProductID = SqlGuid.Null;
            }
            else if (!col_Oit_GuidProductID.UseDefault)
            {
                param.Param_Oit_GuidProductID = col_Oit_GuidProductID.Value;
            }


            using (SPs.spS_tblOrderItem_Display sp = new SPs.spS_tblOrderItem_Display(true)) {
                System.Collections.ArrayList records = new System.Collections.ArrayList();

                System.Data.SqlClient.SqlDataReader sqlDataReader = null;
                sp.Execute(ref param, out sqlDataReader);

                while (sqlDataReader.Read())
                {
                    records.Add(new Common.Item(sqlDataReader.GetGuid(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_ID1.ColumnIndex), sqlDataReader.GetString(SPs.spS_tblOrderItem_Display.Resultset1.Fields.Column_Display.ColumnIndex)));
                }

                sqlDataReader.Close();

                if (sp.Connection.State == System.Data.ConnectionState.Open)
                {
                    sp.Connection.Close();
                }

                sp.Dispose();
                param.Dispose();

                return((Common.Item[])records.ToArray(typeof(Common.Item)));
            }
        }
コード例 #6
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            listView.Items.Clear();

            string query = @"
SELECT     TOP (100) PERCENT rd.DetailsId, rd.HeaderId, rd.TxNumber, p.STKCODE, p.APPENDIX1, p.APPENDIX2, p.APPENDIX3, ISNULL
                          ((SELECT     CDQTY
                              FROM         dbo.ProductWorkplace AS frompw
                              WHERE     (ProductId = rd.ProductId) AND (WorkplaceId = '" + this.FromLocation.ToString() + @"')), 0) AS From_CDQTY, ISNULL
                          ((SELECT     CDQTY
                              FROM         dbo.ProductWorkplace AS topw
                              WHERE     (ProductId = rd.ProductId) AND (WorkplaceId = '" + Common.Utility.CurrentWorkplaceId.ToString() + @"')), 0) AS To_CDQTY, rd.QtyRequested, p.ProductName
FROM         dbo.InvtBatchRPL_Details AS rd LEFT OUTER JOIN
                      dbo.Product AS p ON rd.ProductId = p.ProductId
WHERE     (rd.HeaderId = '" + this.HeaderId.ToString() + @"')
ORDER BY p.STKCODE, p.APPENDIX1, p.APPENDIX2, p.APPENDIX3";

            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.CommandText    = query;
            cmd.CommandTimeout = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CommandTimedOut"]);
            cmd.CommandType    = CommandType.Text;

            using (System.Data.SqlClient.SqlDataReader reader = SqlHelper.Default.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    ListViewItem objItem = this.listView.Items.Add(reader.GetGuid(0).ToString());
                    objItem.SubItems.Add(string.Empty);        // Status
                    objItem.SubItems.Add(reader.GetString(3)); // STKCODE
                    objItem.SubItems.Add(reader.GetString(4));
                    objItem.SubItems.Add(reader.GetString(5));
                    objItem.SubItems.Add(reader.GetString(6));
                    objItem.SubItems.Add(reader.GetDecimal(7).ToString("n0")); // FM C/D
                    objItem.SubItems.Add(reader.GetDecimal(8).ToString("n0"));
                    objItem.SubItems.Add(reader.GetDecimal(9).ToString("n0")); // RPL
                    objItem.SubItems.Add(reader.GetString(10));
                }
            }
        }