Beispiel #1
0
        private NavigationDto LoadDto(SafeSqlDataReader data)
        {
            NavigationDto dto = new NavigationDto()
            {
                NavigationKey = data.GetInt32("NavigationKey"),

                CreatedByUserId     = data.GetString("CreatedByUserId"),
                CreatedByUserKey    = data.GetInt32("CreatedByUserKey"),
                CreatedOnDate       = data.GetDateTime("CreatedOnDate"),
                HasChildren         = data.GetBoolean("HasChildren"),
                IsPrivilegeRequired = data.GetBoolean("IsPrivilegeRequired"),
                LastChanged         = (byte[])data.GetValue("LastChanged"),
                ModifiedByUserId    = data.GetString("ModifiedByUserId"),
                ModifiedByUserKey   = data.GetInt32("ModifiedByUserKey"),
                ModifiedOnDate      = data.GetDateTime("ModifiedOnDate"),
                Name                = data.GetString("Name"),
                NavigationId        = data.GetString("NavigationId"),
                NavigationType      = data.GetInt32("NavigationType"),
                ParentNavigationKey = (int?)data.GetValue("ParentNavigationKey"),
                Sequence            = data.GetInt32("Sequence"),
                SpriteCssClass      = data.GetString("SpriteCssClass"),
                Url = data.GetString("Url")
            };

            if (dto.ParentNavigationKey.HasValue && dto.ParentNavigationKey.Value == 0)
            {
                dto.ParentNavigationKey = null;
            }
            if (string.IsNullOrEmpty(dto.Url))
            {
                dto.Url = null;
            }
            return(dto);
        }
Beispiel #2
0
        public List <SalesOrderTypeDto> FetchList()
        {
            List <SalesOrderTypeDto> list = new List <SalesOrderTypeDto>();

            using (var cn = new SqlConnection(ConfigurationManager.ConnectionStrings["CslaSampleBlazorDb"].ConnectionString))
            {
                cn.Open();
                using (var cm = (SqlCommand)cn.CreateCommand())
                {
                    cm.CommandType = System.Data.CommandType.StoredProcedure;
                    cm.CommandText = "spsoSalesOrderTypeListSelect";
                    Trace.WriteLine("Connection in SalesOrderTypeDal: " + cm.Connection.ClientConnectionId);
                    using (SafeSqlDataReader data = new SafeSqlDataReader(cm.ExecuteReader()))
                    {
                        while (data.Read())
                        {
                            var dto = LoadDto(data);
                            list.Add(dto);
                        }
                    }
                }
            }

            return(list);
        }
Beispiel #3
0
        public List <NavigationDto> FetchUserList(int navigationType, int userKey)
        {
            List <NavigationDto> list = new List <NavigationDto>();

            using (var cn = new SqlConnection(ConfigurationManager.ConnectionStrings["CslaSampleBlazorDb"].ConnectionString))
            {
                cn.Open();
                using (var cm = (SqlCommand)cn.CreateCommand())
                {
                    cm.CommandType = System.Data.CommandType.StoredProcedure;
                    cm.CommandText = "spseUserNavigationListSelect";
                    cm.Parameters.AddWithValue("@NavigationType", navigationType);
                    cm.Parameters.AddWithValue("@UserKey", userKey);
                    Trace.WriteLine("Connection in NavigationDal: " + cm.Connection.ClientConnectionId);
                    using (SafeSqlDataReader data = new SafeSqlDataReader(cm.ExecuteReader()))
                    {
                        while (data.Read())
                        {
                            list.Add(LoadDto(data));
                        }
                    }
                }
            }
            return(list);
        }
        private SalesOrderStatusDto LoadDto(SafeSqlDataReader data)
        {
            TimeZoneInfo        currentUserTimeZoneInfo = DalHelpers.GetCurrentUserTimeZoneInfo();
            SalesOrderStatusDto dto = new SalesOrderStatusDto()
            {
                SalesOrderStatusKey = data.GetInt32("SalesOrderStatusKey"),
                CreatedByUserKey    = data.GetInt32("CreatedByUserKey"),
                CreatedByUserId     = data.GetString("CreatedByUserId"),
                CreatedOnDate       = TimeZoneInfo.ConvertTimeFromUtc(data.GetSmartDate("CreatedOnDate"), currentUserTimeZoneInfo),
                ModifiedByUserKey   = data.GetInt32("ModifiedByUserKey"),
                ModifiedByUserId    = data.GetString("ModifiedByUserId"),
                ModifiedOnDate      = TimeZoneInfo.ConvertTimeFromUtc(data.GetSmartDate("ModifiedOnDate"), currentUserTimeZoneInfo),
                Name = data.GetString("Name"),
                SalesOrderStatusId    = data.GetString("SalesOrderStatusId"),
                SalesOrderStatusValue = data.GetInt16("SalesOrderStatusValue"),
            };

            return(dto);
        }
Beispiel #5
0
        private SalesOrderTypeDto LoadDto(SafeSqlDataReader data)
        {
            SalesOrderTypeDto dto = new SalesOrderTypeDto()
            {
                SalesOrderTypeKey = data.GetInt32("SalesOrderTypeKey"),
                CreatedByUserId   = data.GetString("CreatedByUserId"),
                CreatedByUserKey  = data.GetInt32("CreatedByUserKey"),
                CreatedOnDate     = data.GetDateTime("CreatedOnDate"),
                LastChanged       = (byte[])data.GetValue("LastChanged"),
                ModifiedByUserId  = data.GetString("ModifiedByUserId"),
                ModifiedByUserKey = data.GetInt32("ModifiedByUserKey"),
                ModifiedOnDate    = data.GetDateTime("ModifiedOnDate"),
                Name                = data.GetString("Name"),
                SalesOrderTypeId    = data.GetString("SalesOrderTypeId"),
                SalesOrderTypeValue = data.GetInt16("SalesOrderTypeValue")
            };

            return(dto);
        }
Beispiel #6
0
        private DivisionDto LoadDto(SafeSqlDataReader data)
        {
            TimeZoneInfo currentUserTimeZoneInfo = DalHelpers.GetCurrentUserTimeZoneInfo();
            DivisionDto  dto = new DivisionDto()
            {
                DivisionKey       = data.GetInt32("DivisionKey"),
                CreatedByUserKey  = data.GetInt32("CreatedByUserKey"),
                CreatedByUserId   = data.GetString("CreatedByUserId"),
                CreatedOnDate     = TimeZoneInfo.ConvertTimeFromUtc(data.GetSmartDate("CreatedOnDate"), currentUserTimeZoneInfo),
                DivisionId        = data.GetString("DivisionId"),
                DivisionValue     = data.GetInt32("DivisionValue"),
                ModifiedByUserKey = data.GetInt32("ModifiedByUserKey"),
                ModifiedByUserId  = data.GetString("ModifiedByUserId"),
                ModifiedOnDate    = TimeZoneInfo.ConvertTimeFromUtc(data.GetSmartDate("ModifiedOnDate"), currentUserTimeZoneInfo),
                Name = data.GetString("Name"),
            };

            return(dto);
        }
Beispiel #7
0
 public NavigationDto Fetch(int navigationKey)
 {
     using (var cn = new SqlConnection(ConfigurationManager.ConnectionStrings["CslaSampleBlazorDb"].ConnectionString))
     {
         cn.Open();
         using (var cm = (SqlCommand)cn.CreateCommand())
         {
             cm.CommandType = System.Data.CommandType.StoredProcedure;
             cm.CommandText = "spseNavigationSelect";
             cm.Parameters.AddWithValue("@NavigationKey", navigationKey);
             SafeSqlDataReader data = new SafeSqlDataReader(cm.ExecuteReader());
             if (!data.SqlDataReader.HasRows)
             {
                 throw new DataNotFoundException("Navigation");
             }
             data.Read();
             return(LoadDto(data));
         }
     }
 }
 public SalesOrderStatusDto Fetch(int salesOrderStatusKey)
 {
     using (var cn = new SqlConnection(ConfigurationManager.ConnectionStrings["CslaSampleBlazorDb"].ConnectionString))
     {
         cn.Open();
         var cm = cn.CreateCommand();
         cm.CommandType = System.Data.CommandType.StoredProcedure;
         cm.CommandText = "spsoSalesOrderStatusSelect";
         cm.Parameters.AddWithValue("@SalesOrderStatusKey", salesOrderStatusKey);
         using (SafeSqlDataReader data = new SafeSqlDataReader(cm.ExecuteReader()))
         {
             if (!data.SqlDataReader.HasRows)
             {
                 throw new DataNotFoundException("SalesOrderStatus");
             }
             data.Read();
             return(LoadDto(data));
         }
     }
 }
        public List <SalesOrderStatusDto> FetchList()
        {
            List <SalesOrderStatusDto> list = new List <SalesOrderStatusDto>();

            using (var cn = new SqlConnection(ConfigurationManager.ConnectionStrings["CslaSampleBlazorDb"].ConnectionString))
            {
                cn.Open();
                var cm = cn.CreateCommand();
                cm.CommandType = System.Data.CommandType.StoredProcedure;
                cm.CommandText = "spsoSalesOrderStatusListSelect";
                using (SafeSqlDataReader data = new SafeSqlDataReader(cm.ExecuteReader()))
                {
                    while (data.Read())
                    {
                        list.Add(LoadDto(data));
                    }
                }
            }
            return(list);
        }