예제 #1
0
        public Tables.Category GetOne_Category(Int32 id)
        {
            Params.spS_tblCategory param = new Params.spS_tblCategory(true);

            param.SetUpConnection(string.Empty);

            param.Param_Cat_LngID = id;

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

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

                    record.Col_Cat_LngID.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblCategory.Resultset1.Fields.Column_Cat_LngID.ColumnIndex);
                    if (!record.Col_Cat_LngID.UseNull)
                    {
                        record.Col_Cat_LngID.Value = sqlDataReader.GetSqlInt32(SPs.spS_tblCategory.Resultset1.Fields.Column_Cat_LngID.ColumnIndex).Value;
                    }

                    record.Col_Cat_StrName.UseNull = sqlDataReader.IsDBNull(SPs.spS_tblCategory.Resultset1.Fields.Column_Cat_StrName.ColumnIndex);
                    if (!record.Col_Cat_StrName.UseNull)
                    {
                        record.Col_Cat_StrName.Value = sqlDataReader.GetSqlString(SPs.spS_tblCategory.Resultset1.Fields.Column_Cat_StrName.ColumnIndex).Value;
                    }


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

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

                    return(null);
                }
            }
        }
예제 #2
0
        public Int32 Add_Category(Tables.Category record)
        {
            Params.spI_tblCategory param = new Params.spI_tblCategory(true);

            param.SetUpConnection(string.Empty);

            if (record.Col_Cat_StrName == null || record.Col_Cat_StrName.UseNull)
            {
                param.Param_Cat_StrName = SqlString.Null;
            }
            else if (!record.Col_Cat_StrName.UseDefault)
            {
                param.Param_Cat_StrName = record.Col_Cat_StrName.Value;
            }


            using (SPs.spI_tblCategory sp = new SPs.spI_tblCategory(true)) {
                sp.Execute(ref param);
                Int32 id = param.Param_Cat_LngID.Value;
                param.Dispose();

                return(id);
            }
        }
예제 #3
0
        public void Edit_Category(Tables.Category record)
        {
            Params.spU_tblCategory param = new Params.spU_tblCategory(false);

            param.SetUpConnection(string.Empty);

            param.Param_Cat_LngID = record.Col_Cat_LngID.Value;

            if (record.Col_Cat_StrName == null || record.Col_Cat_StrName.UseNull)
            {
                param.Param_ConsiderNull_Cat_StrName = true;
                param.Param_Cat_StrName = SqlString.Null;
            }
            else if (!record.Col_Cat_StrName.UseDefault)
            {
                param.Param_Cat_StrName = record.Col_Cat_StrName.Value;
            }


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