コード例 #1
0
        public ClientCodeRates GetClientCodeBillableRate(ClientCode code, BillableService service)
        {
            SqlServerConnection conn = new SqlServerConnection();
            SqlDataReader       dr   = conn.SqlServerConnect("SELECT bs_idnt, bs_concept, bs_service, bs_amount, bs_description, ISNULL(cr_rate, bs_amount)x FROM BillableService LEFT OUTER JOIN ClientCodesRates ON bs_idnt=cr_service AND cr_code=" + code.Id + " WHERE bs_idnt=" + service.Id);

            if (dr.Read())
            {
                return new ClientCodeRates {
                           Service = new BillableService
                           {
                               Id      = Convert.ToInt64(dr[0]),
                               Concept = new Concept {
                                   Id = Convert.ToInt64(dr[1])
                               },
                               Name        = dr[2].ToString(),
                               Amount      = Convert.ToDouble(dr[3]),
                               Description = dr[4].ToString()
                           },
                           Code   = code,
                           Amount = Convert.ToDouble(dr[5]),
                }
            }
            ;

            return(new ClientCodeRates());
        }
コード例 #2
0
 public Room()
 {
     Id      = 0;
     Void    = false;
     Name    = "";
     Type    = new RoomType();
     Concept = new Concept();
     Service = new BillableService();
 }
コード例 #3
0
        public List <Room> GetRooms(RoomType type, Concept concept, BillableService service, bool includeVoid = false, string conditions = "", string filter = "")
        {
            List <Room>         rooms = new List <Room>();
            SqlServerConnection conn  = new SqlServerConnection();

            string query = "";

            if (type != null)
            {
                query = "WHERE rm_type=" + type.Id;
            }
            if (concept != null)
            {
                query += (query == "" ? "WHERE " : " AND ") + "rm_concept=" + concept.Id;
            }
            if (service != null)
            {
                query += (query == "" ? "WHERE " : " AND ") + "rm_service=" + service.Id;
            }
            if (!includeVoid)
            {
                query += (query == "" ? "WHERE " : " AND ") + "rm_void=0";
            }
            if (!string.IsNullOrEmpty(conditions))
            {
                query += (query == "" ? "WHERE " : " AND ") + conditions;
            }
            if (!string.IsNullOrEmpty(filter))
            {
                query += conn.GetQueryString(filter, "rm_room+'-'+rt_type+'-'+bs_service+'-'+CAST(bs_amount AS NVARCHAR)", "", true, false);
            }

            SqlDataReader dr = conn.SqlServerConnect("SELECT rm_idnt, rm_void, rm_room, rm_concept, rt_idnt, rt_void, rt_concept, rt_type, ISNULL(bs_idnt,0), bs_code, ISNULL(bs_concept,0), bs_service, ISNULL(bs_amount,0), bs_description FROM Rooms INNER JOIN RoomType ON rm_type=rt_idnt LEFT OUTER JOIN BillableService ON rm_service=bs_idnt " + query);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    rooms.Add(new Room {
                        Id      = Convert.ToInt64(dr[0]),
                        Void    = Convert.ToBoolean(dr[1]),
                        Name    = dr[2].ToString(),
                        Concept = new Concept {
                            Id = Convert.ToInt64(dr[3])
                        },
                        Type = new RoomType {
                            Id      = Convert.ToInt64(dr[4]),
                            Void    = Convert.ToBoolean(dr[5]),
                            Concept = new Concept {
                                Id = Convert.ToInt64(dr[6])
                            },
                            Name = dr[7].ToString(),
                        },
                        Service = new BillableService {
                            Id      = Convert.ToInt64(dr[8]),
                            Code    = dr[9].ToString(),
                            Concept = new Concept {
                                Id = Convert.ToInt64(dr[10])
                            },
                            Name = dr[11].ToString(),
                        }
                    });
                }
            }

            return(rooms);
        }