Click here to Skip to main content
15,896,359 members
Home / Discussions / C#
   

C#

 
GeneralRe: 3 tier app, data access layer, business logic layer Pin
sky39138-May-10 19:16
sky39138-May-10 19:16 
AnswerRe: 3 tier app, data access layer, business logic layer Pin
Stanciu Vlad7-May-10 22:39
Stanciu Vlad7-May-10 22:39 
GeneralRe: 3 tier app, data access layer, business logic layer Pin
sky39138-May-10 19:14
sky39138-May-10 19:14 
GeneralRe: 3 tier app, data access layer, business logic layer Pin
Stanciu Vlad8-May-10 21:02
Stanciu Vlad8-May-10 21:02 
AnswerRe: 3 tier app, data access layer, business logic layer Pin
Keith Barrow8-May-10 0:01
professionalKeith Barrow8-May-10 0:01 
GeneralRe: 3 tier app, data access layer, business logic layer Pin
sky39138-May-10 19:21
sky39138-May-10 19:21 
GeneralRe: 3 tier app, data access layer, business logic layer Pin
Pete O'Hanlon8-May-10 22:11
mvePete O'Hanlon8-May-10 22:11 
AnswerRe: 3 tier app, data access layer, business logic layer Pin
sky39138-May-10 19:58
sky39138-May-10 19:58 
hi friends...this is my code
please tell me + -
DAL
public static OleDbDataReader GetAll(OleDbConnection conn, bool status)
        {
            try
            {
                string query =
                    "SELECT [Id], [Name], [CreatedDate], [CreatedBy], " +
                    "   [UpdatedDate], [UpdatedBy] " +
                    "FROM [Role] " +
                    "WHERE [Status] = @pStatus " +
                    "ORDER BY [Name] ASC";

                OleDbCommand cmd = new OleDbCommand(query, conn);
                OleDbParameter pStatus = cmd.Parameters.Add("@pStatus", 
                    OleDbType.Boolean);
                pStatus.Value = status;
                OleDbDataReader dr = cmd.ExecuteReader();

                return dr;
            }
            catch (OleDbException ex)
            {
                throw new Exception("OleDb Error: " + ex.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }


BLL
public List<Role> GetAll(bool status)
        {
            List<Role> listRole = new List<Role>();

            try
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

                OleDbDataReader dr = RoleData.GetAll(conn, status);

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Role role = new Role();
                        role.Id = int.Parse(dr["Id"].ToString());
                        role.Name = dr["Name"].ToString();
                        role.CreatedBy = dr["CreatedBy"].ToString();
                        role.CreatedDate = (string.Empty.Equals(dr["CreatedDate"].ToString()) ?
                            DateTime.MinValue :
                            DateTime.Parse(dr["CreatedDate"].ToString()));
                        role.UpdatedBy = dr["UpdatedBy"].ToString();
                        role.UpdatedDate = (string.Empty.Equals(dr["UpdatedDate"].ToString()) ? 
                            DateTime.MinValue : 
                            DateTime.Parse(dr["UpdatedDate"].ToString()));
                        listRole.Add(role);
                    }
                }

                return listRole;
            }
            catch (OleDbException ex)
            {
                throw new Exception("OleDb Error: " + "\n" + ex.Message);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                conn.Close();
            }
        }

QuestionVehicle detection in C# Pin
ruknil7-May-10 18:07
ruknil7-May-10 18:07 
AnswerRe: Vehicle detection in C# Pin
Abhinav S7-May-10 21:00
Abhinav S7-May-10 21:00 
AnswerRe: Vehicle detection in C# Pin
Peace ON7-May-10 22:33
Peace ON7-May-10 22:33 
GeneralRe: Vehicle detection in C# Pin
Stanciu Vlad7-May-10 22:41
Stanciu Vlad7-May-10 22:41 
GeneralRe: Vehicle detection in C# Pin
OriginalGriff7-May-10 22:46
mveOriginalGriff7-May-10 22:46 
GeneralRe: Vehicle detection in C# Pin
DeepToot8-May-10 9:28
DeepToot8-May-10 9:28 
GeneralRe: Vehicle detection in C# Pin
OriginalGriff7-May-10 22:44
mveOriginalGriff7-May-10 22:44 
AnswerRe: Vehicle detection in C# Pin
Peace ON7-May-10 22:54
Peace ON7-May-10 22:54 
GeneralRe: Vehicle detection in C# Pin
ruknil7-May-10 23:39
ruknil7-May-10 23:39 
AnswerRe: Vehicle detection in C# Pin
Peace ON7-May-10 23:41
Peace ON7-May-10 23:41 
GeneralRe: Vehicle detection in C# Pin
ruknil7-May-10 23:47
ruknil7-May-10 23:47 
GeneralRe: Vehicle detection in C# Pin
OriginalGriff7-May-10 23:50
mveOriginalGriff7-May-10 23:50 
GeneralRe: Vehicle detection in C# Pin
OriginalGriff7-May-10 23:48
mveOriginalGriff7-May-10 23:48 
GeneralRe: Vehicle detection in C# Pin
Pete O'Hanlon8-May-10 12:03
mvePete O'Hanlon8-May-10 12:03 
GeneralRe: Vehicle detection in C# Pin
#realJSOP7-May-10 23:44
professional#realJSOP7-May-10 23:44 
Questiondatagridview filtering....where to start? Pin
mprice2147-May-10 17:47
mprice2147-May-10 17:47 
AnswerRe: datagridview filtering....where to start? Pin
Abhinav S7-May-10 18:13
Abhinav S7-May-10 18:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.