• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MobileAPI.BaseMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CmsWeb.MobileAPI.BaseMessage的典型用法代码示例。如果您正苦于以下问题:C# BaseMessage类的具体用法?C# BaseMessage怎么用?C# BaseMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BaseMessage类属于CmsWeb.MobileAPI命名空间,在下文中一共展示了BaseMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: fetchCountries

        public ActionResult fetchCountries()
        {
            // Authenticate first
            var authError = Authenticate();
            if (authError != null) return authError;

            var countries = (from e in DbUtil.Db.Countries
                                  orderby e.Id
                                  select e).ToList();

            BaseMessage br = new BaseMessage();
            List<MobileCountry> ma = new List<MobileCountry>();

            br.error = 0;
            br.type = BaseMessage.API_TYPE_SYSTEM_COUNTRIES;
            br.count = countries.Count();

            foreach (var country in countries)
            {
                ma.Add(new MobileCountry().populate(country));
            }

            br.data = JsonConvert.SerializeObject(ma);
            return br;
        }
开发者ID:vs06,项目名称:bvcms,代码行数:25,代码来源:MobileAPIListController.cs


示例2: fetchMaritalStatuses

        public ActionResult fetchMaritalStatuses()
        {
            // Authenticate first
            var authError = Authenticate();
            if (authError != null) return authError;

            var statuses = (from e in DbUtil.Db.MaritalStatuses
                                 orderby e.Id
                                 select e).ToList();

            BaseMessage br = new BaseMessage();
            List<MobileMaritalStatus> ma = new List<MobileMaritalStatus>();

            br.error = 0;
            br.type = BaseMessage.API_TYPE_SYSTEM_MARITAL_STATUSES;
            br.count = statuses.Count();

            foreach (var status in statuses)
            {
                ma.Add(new MobileMaritalStatus().populate(status));
            }

            br.data = JsonConvert.SerializeObject(ma);
            return br;
        }
开发者ID:vs06,项目名称:bvcms,代码行数:25,代码来源:MobileAPIListController.cs


示例3: createErrorReturn

        public static BaseMessage createErrorReturn(string sErrorMessage)
        {
            BaseMessage br = new BaseMessage();
            br.data = sErrorMessage;

            return br;
        }
开发者ID:vs06,项目名称:bvcms,代码行数:7,代码来源:BaseMessage.cs


示例4: HomeActions

        public ActionResult HomeActions(string data)
        {
            var actions = from p in DbUtil.Db.MobileAppActions
                              join i in DbUtil.Db.MobileAppIcons on p.Id equals i.ActionID
                              join s in DbUtil.Db.MobileAppIconSets on i.SetID equals s.Id
                              where p.Enabled == true
                              where s.Active == true
                              orderby p.Order
                              select new MobileHomeAction
                              {
                                  type = p.Type,
                                  title = p.Title,
                                  option = p.Option,
                                  data = p.Data,
                                  icon = i.Url,
                                  loginType = p.LoginType,
                                  roles = p.Roles
                              };

            BaseMessage br = new BaseMessage();
            br.error = 0;
            br.count = actions.Count();
            br.data = JsonConvert.SerializeObject(actions.ToList());

            return br;
        }
开发者ID:peclecl,项目名称:bvcms,代码行数:26,代码来源:MobileAPIListController.cs


示例5: createTypeErrorReturn

        public static BaseMessage createTypeErrorReturn()
        {
            BaseMessage br = new BaseMessage();
            br.data = "ERROR: Type mis-match in API call.";

            return br;
        }
开发者ID:stevesloka,项目名称:bvcms,代码行数:7,代码来源:BaseMessage.cs


示例6: createErrorReturn

        public static BaseMessage createErrorReturn(string sErrorMessage, int errorCode = 1)
        {
            BaseMessage br = new BaseMessage();
            br.data = sErrorMessage;
            br.error = errorCode;

            return br;
        }
开发者ID:stevesloka,项目名称:bvcms,代码行数:8,代码来源:BaseMessage.cs


示例7: Authenticate

        public ActionResult Authenticate(string data)
        {
            if (!Auth())
                return BaseMessage.createErrorReturn("Authentication failed, please try again", BaseMessage.API_ERROR_INVALID_CREDENTIALS);

            var br = new BaseMessage();
            br.error = 0;
            br.data = JsonConvert.SerializeObject(new CheckInInformation(getSettings(), getCampuses(), getLabelFormats()));
            return br;
        }
开发者ID:stevesloka,项目名称:bvcms,代码行数:10,代码来源:CheckInAPIController.cs


示例8: Countries

        public ActionResult Countries(string data)
        {
            var countries = getCountries();

            BaseMessage br = new BaseMessage();
            br.error = 0;
            br.count = countries.Count();
            br.data = JsonConvert.SerializeObject(countries.ToList());

            return br;
        }
开发者ID:clearfunction,项目名称:bvcms,代码行数:11,代码来源:MobileAPIListController.cs


示例9: CheckSessionToken

        public ActionResult CheckSessionToken(string data)
        {
            var result = AuthenticateUser();

            if (!result.IsValid)
                return AuthorizationError(result);

            var br = new BaseMessage();
            br.setNoError();
            return br;
        }
开发者ID:GSBCfamily,项目名称:bvcms,代码行数:11,代码来源:MobileAPIController.cs


示例10: AcceptTask

        public ActionResult AcceptTask(string data)
        {
            var result = AuthenticateUser();
            if (!result.IsValid) return AuthorizationError(result);

            BaseMessage dataIn = BaseMessage.createFromString(data);

            TaskModel.AcceptTask(dataIn.argInt);

            BaseMessage br = new BaseMessage();
            br.count = 1;
            br.setNoError();

            return br;
        }
开发者ID:clearfunction,项目名称:bvcms,代码行数:15,代码来源:MobileAPIController.cs


示例11: States

        public ActionResult States(string data)
        {
            var states = from e in DbUtil.Db.StateLookups
                         orderby e.StateCode
                         select new MobileState
                         {
                             code = e.StateCode,
                             name = e.StateName
                         };

            BaseMessage br = new BaseMessage();
            br.error = 0;
            br.count = states.Count();
            br.data = JsonConvert.SerializeObject(states.ToList());

            return br;
        }
开发者ID:stevesloka,项目名称:bvcms,代码行数:17,代码来源:MobileAPIListController.cs


示例12: Countries

        public ActionResult Countries(string data)
        {
            var countries = from e in DbUtil.Db.Countries
                                 orderby e.Id
                                 select new MobileCountry
                                 {
                                     id = e.Id,
                                     code = e.Code,
                                     description = e.Description
                                 };

            BaseMessage br = new BaseMessage();
            br.error = 0;
            br.count = countries.Count();
            br.data = JsonConvert.SerializeObject(countries.ToList());

            return br;
        }
开发者ID:peclecl,项目名称:bvcms,代码行数:18,代码来源:MobileAPIListController.cs


示例13: Authenticate

        public ActionResult Authenticate(string data)
        {
            var dataIn = BaseMessage.createFromString(data);

            var result = AuthenticateUser(requirePin: true);

            if (!result.IsValid)
                return AuthorizationError(result);

            savePushID(Util.UserPeopleId ?? 0, dataIn.device, dataIn.key);

            MobileSettings ms = getUserInfo();

            var br = new BaseMessage();
            br.setNoError();
            br.data = SerializeJSON(ms, dataIn.version);
            br.token = result.User.ApiSessions.Single().SessionToken.ToString();
            return br;
        }
开发者ID:GSBCfamily,项目名称:bvcms,代码行数:19,代码来源:MobileAPIController.cs


示例14: GivingLink

        public ActionResult GivingLink(string data)
        {
            var dataIn = BaseMessage.createFromString(data);

            var givingOrgId = DbUtil.Db.Organizations
                 .Where(o => o.RegistrationTypeId == RegistrationTypeCode.OnlineGiving)
                 .Select(x => x.OrganizationId).FirstOrDefault();

            var br = new BaseMessage();

            if (dataIn.version >= BaseMessage.API_VERSION_3)
            {
                br.data = DbUtil.Db.ServerLink($"OnlineReg/{givingOrgId}?{dataIn.getSourceQueryString()}");
            }
            else
            {
                br.data = DbUtil.Db.ServerLink($"OnlineReg/{givingOrgId}");
            }

            br.setNoError();
            return br;
        }
开发者ID:vanutama,项目名称:bvcms,代码行数:22,代码来源:MobileAPIController.cs


示例15: FetchTasks

        public ActionResult FetchTasks(string data)
        {
            var result = AuthenticateUser();
            if (!result.IsValid) return AuthorizationError(result);

            BaseMessage dataIn = BaseMessage.createFromString(data);

            var tasks = from t in DbUtil.Db.ViewIncompleteTasks
                        orderby t.CreatedOn, t.StatusId, t.OwnerId, t.CoOwnerId
                        where t.OwnerId == Util.UserPeopleId || t.CoOwnerId == Util.UserPeopleId
                        select t;

            var complete = (from c in DbUtil.Db.Tasks
                            where c.StatusId == TaskStatusCode.Complete
                            where c.OwnerId == Util.UserPeopleId || c.CoOwnerId == Util.UserPeopleId
                            orderby c.CreatedOn descending
                            select c).Take(20);

            BaseMessage br = new BaseMessage();

            switch (dataIn.device)
            {
                case BaseMessage.API_DEVICE_ANDROID:
                {
                    Dictionary<int, MobileTask> taskList = new Dictionary<int, MobileTask>();

                    foreach (var item in tasks)
                    {
                        MobileTask task = new MobileTask().populate(item, Util.UserPeopleId ?? 0);
                        taskList.Add(task.id, task);
                    }

                    foreach (var item in complete)
                    {
                        MobileTask task = new MobileTask().populate(item, Util.UserPeopleId ?? 0);
                        taskList.Add(task.id, task);
                    }

                    br.data = SerializeJSON(taskList, dataIn.version);
                    break;
                }

                case BaseMessage.API_DEVICE_IOS:
                {
                    List<MobileTask> taskList = new List<MobileTask>();

                    foreach (var item in tasks)
                    {
                        MobileTask task = new MobileTask().populate(item, Util.UserPeopleId ?? 0);
                        taskList.Add(task);
                    }

                    foreach (var item in complete)
                    {
                        MobileTask task = new MobileTask().populate(item, Util.UserPeopleId ?? 0);
                        taskList.Add(task);
                    }

                    br.data = SerializeJSON(taskList, dataIn.version);
                    break;
                }
            }

            br.count = tasks.Count();
            br.setNoError();
            return br;
        }
开发者ID:vanutama,项目名称:bvcms,代码行数:67,代码来源:MobileAPIController.cs


示例16: FetchRegistrations

        public ActionResult FetchRegistrations(string data)
        {
            var dataIn = BaseMessage.createFromString(data);

            // Authenticate first
            var result = AuthenticateUser();
            if (!result.IsValid) return AuthorizationError(result);

            var br = new BaseMessage();
            br.setNoError();
            br.data = SerializeJSON(GetRegistrations(), dataIn.version);
            return br;
        }
开发者ID:vanutama,项目名称:bvcms,代码行数:13,代码来源:MobileAPIController.cs


示例17: FetchPerson

        public ActionResult FetchPerson(string data)
        {
            // Authenticate first
            var result = AuthenticateUser();
            if (!result.IsValid) return AuthorizationError(result);

            BaseMessage dataIn = BaseMessage.createFromString(data);
            MobilePostFetchPerson mpfs = JsonConvert.DeserializeObject<MobilePostFetchPerson>(dataIn.data);

            BaseMessage br = new BaseMessage();

            var person = DbUtil.Db.People.SingleOrDefault(p => p.PeopleId == mpfs.id);

            if (person == null)
            {
                br.setError(BaseMessage.API_ERROR_PERSON_NOT_FOUND);
                br.data = "Person not found.";
                return br;
            }

            br.setNoError();
            br.count = 1;

            if (dataIn.device == BaseMessage.API_DEVICE_ANDROID)
            {
                br.data = SerializeJSON(new MobilePerson().populate(person), dataIn.version);
            }
            else
            {
                List<MobilePerson> mp = new List<MobilePerson>();
                mp.Add(new MobilePerson().populate(person));
                br.data = SerializeJSON(mp, dataIn.version);
            }

            return br;
        }
开发者ID:vanutama,项目名称:bvcms,代码行数:36,代码来源:MobileAPIController.cs


示例18: AddPerson

        public ActionResult AddPerson(string data)
        {
            // Authenticate first
            var result = AuthenticateUser();
            if (!result.IsValid) return AuthorizationError(result);

            // Check Role
            if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Attendance"))
                return BaseMessage.createErrorReturn("Attendance role is required to take attendance for organizations.");

            BaseMessage dataIn = BaseMessage.createFromString(data);
            MobilePostAddPerson mpap = JsonConvert.DeserializeObject<MobilePostAddPerson>(dataIn.data);
            mpap.clean();

            var p = new Person();

            p.CreatedDate = Util.Now;
            p.CreatedBy = Util.UserId;

            p.MemberStatusId = MemberStatusCode.JustAdded;
            p.AddressTypeId = 10;

            p.FirstName = mpap.firstName;
            p.LastName = mpap.lastName;
            p.Name = "";

            if (mpap.goesBy.Length > 0)
                p.NickName = mpap.goesBy;

            if (mpap.birthday != null)
            {
                p.BirthDay = mpap.birthday.Value.Day;
                p.BirthMonth = mpap.birthday.Value.Month;
                p.BirthYear = mpap.birthday.Value.Year;
            }

            p.GenderId = mpap.genderID;
            p.MaritalStatusId = mpap.maritalStatusID;

            Family f;

            if (mpap.familyID > 0)
            {
                f = DbUtil.Db.Families.First(fam => fam.FamilyId == mpap.familyID);
            }
            else
            {
                f = new Family();

                if (mpap.homePhone.Length > 0)
                    f.HomePhone = mpap.homePhone;

                if (mpap.address.Length > 0)
                    f.AddressLineOne = mpap.address;

                if (mpap.address2.Length > 0)
                    f.AddressLineTwo = mpap.address2;

                if (mpap.city.Length > 0)
                    f.CityName = mpap.city;

                if (mpap.state.Length > 0)
                    f.StateCode = mpap.state;

                if (mpap.zipcode.Length > 0)
                    f.ZipCode = mpap.zipcode;

                if (mpap.country.Length > 0)
                    f.CountryName = mpap.country;

                DbUtil.Db.Families.InsertOnSubmit(f);
            }

            f.People.Add(p);

            p.PositionInFamilyId = PositionInFamily.Child;

            if (mpap.birthday != null && p.GetAge() >= 18)
            {
                if (f.People.Count(per => per.PositionInFamilyId == PositionInFamily.PrimaryAdult) < 2)
                    p.PositionInFamilyId = PositionInFamily.PrimaryAdult;
                else
                    p.PositionInFamilyId = PositionInFamily.SecondaryAdult;
            }

            p.OriginId = OriginCode.Visit;
            p.FixTitle();

            if (mpap.eMail.Length > 0)
                p.EmailAddress = mpap.eMail;

            if (mpap.cellPhone.Length > 0)
                p.CellPhone = mpap.cellPhone;

            if (mpap.homePhone.Length > 0)
                p.HomePhone = mpap.homePhone;

            p.MaritalStatusId = mpap.maritalStatusID;
            p.GenderId = mpap.genderID;

//.........这里部分代码省略.........
开发者ID:vanutama,项目名称:bvcms,代码行数:101,代码来源:MobileAPIController.cs


示例19: FetchPeople

        public ActionResult FetchPeople(string data)
        {
            // Authenticate first
            var result = AuthenticateUser();
            if (!result.IsValid) return AuthorizationError(result);

            BaseMessage dataIn = BaseMessage.createFromString(data);
            MobilePostSearch mps = JsonConvert.DeserializeObject<MobilePostSearch>(dataIn.data);

            BaseMessage br = new BaseMessage();

            var m = new SearchModel(mps.name, mps.comm, mps.addr);

            br.setNoError();
            br.count = m.Count;

            switch (dataIn.device)
            {
                case BaseMessage.API_DEVICE_ANDROID:
                    {
                        Dictionary<int, MobilePerson> mpl = new Dictionary<int, MobilePerson>();

                        MobilePerson mp;

                        foreach (var item in m.ApplySearch().OrderBy(p => p.Name2).Take(100))
                        {
                            mp = new MobilePerson().populate(item);
                            mpl.Add(mp.id, mp);
                        }

                    br.data = SerializeJSON(mpl, dataIn.version);
                        break;
                    }

                case BaseMessage.API_DEVICE_IOS:
                    {
                        List<MobilePerson> mp = new List<MobilePerson>();

                        foreach (var item in m.ApplySearch().OrderBy(p => p.Name2).Take(100))
                        {
                            mp.Add(new MobilePerson().populate(item));
                        }

                    br.data = SerializeJSON(mp, dataIn.version);
                        break;
                    }
            }

            return br;
        }
开发者ID:vanutama,项目名称:bvcms,代码行数:50,代码来源:MobileAPIController.cs


示例20: FetchOrgs

        public ActionResult FetchOrgs(string data)
        {
            var result = AuthenticateUser();
            if (!result.IsValid) return AuthorizationError(result);

            if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Attendance"))
                return BaseMessage.createErrorReturn("Attendance roles is required to take attendance for organizations");

            BaseMessage dataIn = BaseMessage.createFromString(data);

            var pid = Util.UserPeopleId;
            var oids = DbUtil.Db.GetLeaderOrgIds(pid);
            var dt = DateTime.Parse("8:00 AM");

            var roles = DbUtil.Db.CurrentRoles();

            IQueryable<Organization> q = null;

            if (Util2.OrgLeadersOnly)
            {
                q = from o in DbUtil.Db.Organizations
                    where o.LimitToRole == null || roles.Contains(o.LimitToRole)
                    where oids.Contains(o.OrganizationId)
                    where o.OrganizationStatusId == OrgStatusCode.Active
                    where o.SecurityTypeId != 3
                    select o;
            }
            else
            {
                q = from o in DbUtil.Db.Organizations
                    where o.LimitToRole == null || roles.Contains(o.LimitToRole)
                    //let sc = o.OrgSchedules.FirstOrDefault() // SCHED
                    where (o.OrganizationMembers.Any(om => om.PeopleId == pid // either a leader, who is not pending / inactive
                                       && (om.Pending ?? false) == false
                                       && (om.MemberTypeId != MemberTypeCode.InActive)
                                       && (om.MemberType.AttendanceTypeId == AttendTypeCode.Leader)
                               )
                       || oids.Contains(o.OrganizationId)) // or a leader of a parent org
                    where o.SecurityTypeId != 3
                    where o.OrganizationStatusId == OrgStatusCode.Active
                    select o;
            }

            var orgs = from o in q
                       //let sc = o.OrgSchedules.FirstOrDefault() // SCHED
                           //join sch in DbUtil.Db.OrgSchedules on o.OrganizationId equals sch.OrganizationId
                       from sch in DbUtil.Db.OrgSchedules.Where(s => o.OrganizationId == s.OrganizationId).DefaultIfEmpty()
                       from mtg in DbUtil.Db.Meetings.Where(m => o.OrganizationId == m.OrganizationId).OrderByDescending(m => m.MeetingDate).Take(1).DefaultIfEmpty()
                       orderby sch.SchedDay, sch.SchedTime
                       select new OrganizationInfo
                       {
                           id = o.OrganizationId,
                           name = o.OrganizationName,
                           time = sch.SchedTime,
                           day = sch.SchedDay,
                           lastMeetting = mtg.MeetingDate
                       };

            BaseMessage br = new BaseMessage();
            List<MobileOrganization> mo = new List<MobileOrganization>();

            br.setNoError();
            br.count = orgs.Count();

            int tzOffset = 0;
            int.TryParse(DbUtil.Db.GetSetting("TZOffset", "0"), out tzOffset);

            foreach (var item in orgs)
            {
                MobileOrganization org = new MobileOrganization().populate(item);

                // Initial release version
                if (dataIn.version == BaseMessage.API_VERSION_2 && tzOffset != 0)
                {
                    org.changeHourOffset(-tzOffset);
                }

                mo.Add(org);
            }

            br.data = SerializeJSON(mo, dataIn.version);
            return br;
        }
开发者ID:vanutama,项目名称:bvcms,代码行数:83,代码来源:MobileAPIController.cs



注:本文中的CmsWeb.MobileAPI.BaseMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Cocos2D.CCBReader类代码示例发布时间:2022-05-24
下一篇:
C# CmsWebService.Issue类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap