Ejemplo n.º 1
0
        public Tables.tblOrderItem_Record GetOne_tblOrderItem_Record(Guid id)
        {
            Params.spS_tblOrderItem param = new Params.spS_tblOrderItem(true);

            param.SetUpConnection(string.Empty);

            param.Param_Oit_GuidID = id;

            using (SPs.spS_tblOrderItem sp = new SPs.spS_tblOrderItem(true)) {
                System.Data.SqlClient.SqlDataReader sqlDataReader = null;
                sp.Execute(ref param, out sqlDataReader);
                param.Dispose();

                if (sqlDataReader.Read())
                {
                    Tables.tblOrderItem_Record record = new Tables.tblOrderItem_Record();

                    record.Col_Oit_GuidID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidID.ColumnIndex);
                    if (!record.Col_Oit_GuidID.UseNull)
                    {
                        record.Col_Oit_GuidID.Value = sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidID.ColumnIndex).Value;
                    }

                    record.Col_Oit_GuidOrderID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidOrderID.ColumnIndex);
                    if (!record.Col_Oit_GuidOrderID.UseNull)
                    {
                        record.Col_Oit_GuidOrderID.Value = sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidOrderID.ColumnIndex).Value;
                    }

                    record.Col_Oit_GuidProductID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidProductID.ColumnIndex);
                    if (!record.Col_Oit_GuidProductID.UseNull)
                    {
                        record.Col_Oit_GuidProductID.Value = sqlDataReader.GetSqlGuid(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_GuidProductID.ColumnIndex).Value;
                    }

                    record.Col_Oit_LngAmount.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_LngAmount.ColumnIndex);
                    if (!record.Col_Oit_LngAmount.UseNull)
                    {
                        record.Col_Oit_LngAmount.Value = sqlDataReader.GetSqlInt32(SPs.spS_tblOrderItem.Resultset1.Fields.Column_Oit_LngAmount.ColumnIndex).Value;
                    }


                    sqlDataReader.Close();
                    sp.Connection.Close();

                    return(record);
                }
                else
                {
                    sqlDataReader.Close();
                    sp.Connection.Close();

                    return(null);
                }
            }
        }
Ejemplo n.º 2
0
        public void Edit_tblOrderItem_Record(Tables.tblOrderItem_Record record)
        {
            Params.spU_tblOrderItem param = new Params.spU_tblOrderItem(false);

            param.SetUpConnection(string.Empty);

            param.Param_Oit_GuidID = record.Col_Oit_GuidID.Value;

            if (record.Col_Oit_GuidOrderID == null || record.Col_Oit_GuidOrderID.UseNull)
            {
                param.Param_ConsiderNull_Oit_GuidOrderID = true;
                param.Param_Oit_GuidOrderID = SqlGuid.Null;
            }
            else if (!record.Col_Oit_GuidOrderID.UseDefault)
            {
                param.Param_Oit_GuidOrderID = record.Col_Oit_GuidOrderID.Value;
            }

            if (record.Col_Oit_GuidProductID == null || record.Col_Oit_GuidProductID.UseNull)
            {
                param.Param_ConsiderNull_Oit_GuidProductID = true;
                param.Param_Oit_GuidProductID = SqlGuid.Null;
            }
            else if (!record.Col_Oit_GuidProductID.UseDefault)
            {
                param.Param_Oit_GuidProductID = record.Col_Oit_GuidProductID.Value;
            }

            if (record.Col_Oit_LngAmount == null || record.Col_Oit_LngAmount.UseNull)
            {
                param.Param_ConsiderNull_Oit_LngAmount = true;
                param.Param_Oit_LngAmount = SqlInt32.Null;
            }
            else if (!record.Col_Oit_LngAmount.UseDefault)
            {
                param.Param_Oit_LngAmount = record.Col_Oit_LngAmount.Value;
            }


            using (SPs.spU_tblOrderItem sp = new SPs.spU_tblOrderItem(true)) {
                sp.Execute(ref param);
                param.Dispose();
            }
        }