示例#1
0
        public static object getClients()
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.Clients select ob;

            return(obj);
        }
示例#2
0
        public static object getPaymentType()
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.PaymentTypes select ob;

            return(obj);
        }
示例#3
0
        public static decimal getBookMoney(int ID)
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.Appointments
                      where ob.UniqueID == ID
                      select ob;

            return(obj.First().StudentBookMoney.Value);
        }
示例#4
0
        public static object getCoursesByClient(int clientId)
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.Appointments
                      where ob.ClientId == clientId
                      select ob;

            return(obj);
        }
示例#5
0
        public static object getPayment()
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.Payments
                      join pT in DbObj.PaymentTypes
                      on ob.PaymentTypeId equals pT.PaymentTypeId
                      select new { pT.PaymentTypeDesc, ob.AppointmentId, ob.ClientWorkSpaceId, ob.Notes, ob.PaymentDate, ob.PaymentId, ob.PaymentTypeId, ob.PaymentValue };

            return(obj);
        }
示例#6
0
        public static object getExpences()
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.Expences
                      join eT in DbObj.ExpencesTypes
                      on ob.ExpencesTypeId equals eT.ExpencesTypeId
                      select new { eT.ExpencesDesc, ob.ExpencesDate, ob.ExpencesId, ob.ExpencesValue, ob.Notes };

            return(obj);
        }
示例#7
0
        public static object getCourseStudents()
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.CourseStudents
                      join course in DbObj.Appointments
                      on ob.UniqueID equals course.UniqueID
                      select new { ob.CourseStudentId, ob.UniqueID, course.Subject, ob.CourseStudentName, ob.CourseStudentNationalId, ob.Notes, ob.PaidMoney, ob.BookMoney, ob.CoursePrice };

            return(obj);
        }
示例#8
0
        public static object getCourses()
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.Appointments
                      join c in DbObj.Clients
                      on ob.ClientId equals c.ClientId
                      join r in DbObj.Rooms
                      on ob.RoomId equals r.RoomId
                      select new { ob.UniqueID, ob.Subject, r.RoomDesc, c.ClientName, ob.StudentBookMoney, ob.CoursePrice };

            return(obj);
        }
示例#9
0
        public static bool CheckSafeIsClose()
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.Safes orderby ob.SafeId descending select ob;

            if (obj.Count() == 0)
            {
                return(true);
            }

            return(Convert.ToBoolean(obj.First().IsClose));
        }
示例#10
0
        public static decimal getSafeCurrentValue()
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.Safes orderby ob.SafeId descending select ob;

            if (!obj.Any())
            {
                return(0);
            }

            return(Convert.ToDecimal(obj.First().CurrentValue));
        }
示例#11
0
        public static object getPaymentByCourse(int appointmentId)
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.Payments
                      join pT in DbObj.PaymentTypes
                      on ob.PaymentTypeId equals pT.PaymentTypeId
                      join c in DbObj.Appointments
                      on ob.AppointmentId equals c.UniqueID
                      where ob.AppointmentId == appointmentId
                      select new { pT.PaymentTypeDesc, c.Subject, c.Location, ob.AppointmentId, ob.Notes, ob.PaymentDate, ob.PaymentId, ob.PaymentTypeId, ob.PaymentValue };

            return(obj);
        }
示例#12
0
        public static bool putPaymentTypes()
        {
            DbObj = new DataClassesAlexLabDataContext(ConectionString);

            var obj = from ob in DbObj.PaymentTypes select ob;

            try
            {
                if (obj.Count() == 0)
                {
                    PaymentType roo = new PaymentType()
                    {
                        PaymentTypeDesc = "Rooms"
                    };

                    MainClass.DbObj.PaymentTypes.InsertOnSubmit(roo);
                    MainClass.DbObj.SubmitChanges();

                    PaymentType roo2 = new PaymentType()
                    {
                        PaymentTypeDesc = "Workspace"
                    };

                    MainClass.DbObj.PaymentTypes.InsertOnSubmit(roo2);
                    MainClass.DbObj.SubmitChanges();

                    PaymentType roo3 = new PaymentType()
                    {
                        PaymentTypeDesc = "Others"
                    };

                    MainClass.DbObj.PaymentTypes.InsertOnSubmit(roo3);
                    MainClass.DbObj.SubmitChanges();
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }