Exemple #1
0
        /// <summary>
        /// 获取可选日期列表
        /// </summary>
        /// <returns></returns>
        private static string getServiceDateList()
        {
            var respObj = new RespData();

            try
            {
                IList <DateList> entities = new List <DateList>();
                for (int i = 0; i < 20; i++)
                {
                    DateList dateList = new DateList
                    {
                        CurrentDate = DateTime.Now.AddDays(i).ToShortDateString(),
                        Status      = "0",
                        MonthAndDay = DateTime.Now.AddDays(i).ToString("MM月dd日"),
                        Week        = ToChineseWeek(DateTime.Now.AddDays(i).DayOfWeek.ToString())
                    };
                    entities.Add(dateList);
                }
                respObj.content     = string.Format("DataItems:{{{0}}}", entities.ToJSON());
                respObj.code        = "200";
                respObj.description = "操作成功";
            }
            catch (Exception ex)
            {
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
            }
            string content = respObj.ToJSON();

            return(content);
        }
Exemple #2
0
        private string submitReservation()
        {
            var respObj = new RespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ReqContent>();
                var    service    = new ReservationServiceScheduleBLL(Default.GetLoggingSession());
                ReservationServiceScheduleEntity entity = new ReservationServiceScheduleEntity();

                entity.ReserveDate = DateTime.Parse(reqObj.Special.currentDate);
                entity.ReservationServiceBigClassTermID   = int.Parse(reqObj.Special.reservationBigClassTermId);
                entity.ReservationServiceSmallClassTermID = int.Parse(reqObj.Special.reservationSmallClassTermId);
                entity.ReservationServiceID = int.Parse(reqObj.Special.reservationServiceId);
                entity.VIPID = reqObj.Common.userId;
                entity.ReservationServiceScheduleID = Guid.NewGuid().ToString().Replace("-", "");

                service.Create(entity);
                respObj.code        = "200";
                respObj.description = "操作成功";
                ValidLogin(reqObj, respObj);
            }
            catch (Exception ex)
            {
                //throw ex;
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
            }
            string content = respObj.ToJSON();

            return(content);
        }
Exemple #3
0
        private string cancelReservation()
        {
            var respObj = new RespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ReqContent>();
                var    service    = new ReservationServiceScheduleBLL(Default.GetLoggingSession());
                ReservationServiceScheduleEntity entity = service.GetByID(reqObj.Special.ReservationServiceScheduleID);
                if (entity != null && entity.VIPID.Equals(reqObj.Common.userId))
                {
                    //TODO:取消时的状态转换
                    entity.StatusID = 0;
                }
                service.Update(entity);
                respObj.code        = "200";
                respObj.description = "操作成功";
                ValidLogin(reqObj, respObj);
            }
            catch (Exception ex)
            {
                //throw ex;
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
            }
            string content = respObj.ToJSON();

            return(content);
        }
Exemple #4
0
        private string validLogin()
        {
            var respObj = new RespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ReqContent>();
                //TODO:验证登录,默认登录成功!
                if (reqObj.Common.codeId.Equals(""))
                {
                }
                respObj.code        = "200";
                respObj.description = "操作成功";
                respObj.userId      = "1";
                respObj.codeId      = "8uc3f45";
            }
            catch (Exception ex)
            {
                //throw ex;
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
            }
            string content = respObj.ToJSON();

            return(content);
        }
Exemple #5
0
        /// <summary>
        /// 获取服务信息列表
        /// </summary>
        /// <returns></returns>
        private static string getServiceList()
        {
            var respObj = new RespData();

            try
            {
                var service = new ReservationServiceBLL(Default.GetLoggingSession());
                ReservationServiceEntity[] entities = service.GetAll();
                respObj.content     = string.Format("DataItems:{{{0}}}", entities.ToJSON());
                respObj.code        = "200";
                respObj.description = "操作成功";
            }
            catch (Exception ex)
            {
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
            }
            string content = respObj.ToJSON();

            return(content);
        }
Exemple #6
0
        private string getSmallClassTermList()
        {
            var respObj = new RespData();

            try
            {
                string            reqContent     = Request["ReqContent"];
                var               reqObj         = reqContent.DeserializeJSONTo <ReqContent>();
                var               service        = new ReservationServiceSmallClassTermStatusBLL(Default.GetLoggingSession());
                IWhereCondition[] whereCondition = new IWhereCondition[] {
                    new EqualsCondition()
                    {
                        FieldName = "reservationServiceId ", Value = reqObj.Special.reservationServiceId
                    },
                    new EqualsCondition()
                    {
                        FieldName = "reservationServiceBigClassTermId ", Value = reqObj.Special.reservationBigClassTermId
                    },
                    new EqualsCondition()
                    {
                        FieldName = "StatusID", Value = reqObj.Special.statusId
                    }
                };
                ReservationServiceSmallClassTermStatusEntity[] entities = service.Query(whereCondition, null);
                respObj.content     = string.Format("DataItems:{{{0}}}", entities.ToJSON());
                respObj.code        = "200";
                respObj.description = "操作成功";
                ValidLogin(reqObj, respObj);
            }
            catch (Exception ex)
            {
                //throw ex;
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
            }
            string content = respObj.ToJSON();

            return(content);
        }
Exemple #7
0
        private string getReservationList()
        {
            var respObj = new RespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ReqContent>();
                //TODO:判断登陆

                var service = new ReservationServiceScheduleBLL(Default.GetLoggingSession());
                IWhereCondition[] whereCondition = new IWhereCondition[] {
                    new EqualsCondition()
                    {
                        FieldName = "a.VIPID", Value = reqObj.Common.userId
                    },
                    //new EqualsCondition() { FieldName = "a.ReservationStoreID", Value = reqObj.Common.reservationStoreId },
                    //TODO:维护好状态数据字典
                    //new EqualsCondition() { FieldName = "a.StatusID", Value = reqObj.Special.statusId }
                };
                ReservationServiceScheduleEntity[] entities = service.QueryAllField(whereCondition, null);
                respObj.content     = string.Format("DataItems:{{{0}}}", entities.ToJSON());
                respObj.code        = "200";
                respObj.description = "操作成功";
                ValidLogin(reqObj, respObj);
            }
            catch (Exception ex)
            {
                //throw ex;
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
            }
            string content = respObj.ToJSON();

            return(content);
        }