本文整理汇总了C#中CmsWeb.MobileAPI.BaseMessage.setNoError方法的典型用法代码示例。如果您正苦于以下问题:C# BaseMessage.setNoError方法的具体用法?C# BaseMessage.setNoError怎么用?C# BaseMessage.setNoError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmsWeb.MobileAPI.BaseMessage
的用法示例。
在下文中一共展示了BaseMessage.setNoError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckSessionToken
public ActionResult CheckSessionToken(string data)
{
var result = AuthenticateUser();
if (!result.IsValid)
return AuthorizationError(result);
var br = new BaseMessage();
br.setNoError();
return br;
}
示例2: 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;
}
示例3: 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;
}
示例4: UnLockFamily
public ActionResult UnLockFamily(string data)
{
if (!Auth())
return BaseMessage.createErrorReturn("Authentication failed, please try again", BaseMessage.API_ERROR_INVALID_CREDENTIALS);
BaseMessage dataIn = BaseMessage.createFromString(data);
var lockf = DbUtil.Db.FamilyCheckinLocks.SingleOrDefault(f => f.FamilyId == dataIn.argInt);
if (lockf != null)
{
lockf.Locked = false;
DbUtil.Db.SubmitChanges();
}
BaseMessage br = new BaseMessage();
br.setNoError();
br.id = dataIn.argInt;
return br;
}
示例5: RecordAttend
public ActionResult RecordAttend(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 roles is required to take attendance for organizations");
// Convert raw post to avoid "+" being converted to space for iOS timezone info. Remove this later when app has been updated.
String rawPost = new StreamReader(this.Request.InputStream).ReadToEnd();
rawPost = Server.UrlDecode(rawPost).Substring(5);
BaseMessage dataIn = BaseMessage.createFromString(rawPost);
if (dataIn.device == BaseMessage.API_DEVICE_IOS && dataIn.version == BaseMessage.API_VERSION_2)
{
dataIn.data = dataIn.data.Replace(" ", "+");
}
MobilePostAttend mpa = JsonConvert.DeserializeObject<MobilePostAttend>(dataIn.data);
if (dataIn.device == BaseMessage.API_DEVICE_IOS && dataIn.version == BaseMessage.API_VERSION_2)
{
int tzOffset = 0;
int.TryParse(DbUtil.Db.GetSetting("TZOffset", "0"), out tzOffset);
if (tzOffset != 0)
{
mpa.changeHourOffset(tzOffset);
}
}
var meeting = DbUtil.Db.Meetings.SingleOrDefault(m => m.OrganizationId == mpa.orgID && m.MeetingDate == mpa.datetime);
if (meeting == null)
{
meeting = new Meeting
{
OrganizationId = mpa.orgID,
MeetingDate = mpa.datetime,
CreatedDate = Util.Now,
CreatedBy = Util.UserPeopleId ?? 0,
GroupMeetingFlag = false,
};
DbUtil.Db.Meetings.InsertOnSubmit(meeting);
DbUtil.Db.SubmitChanges();
var acr = (from s in DbUtil.Db.OrgSchedules
where s.OrganizationId == mpa.orgID
where s.SchedTime.Value.TimeOfDay == mpa.datetime.TimeOfDay
where s.SchedDay == (int)mpa.datetime.DayOfWeek
select s.AttendCreditId).SingleOrDefault();
meeting.AttendCreditId = acr;
}
Attend.RecordAttendance(mpa.peopleID, meeting.MeetingId, mpa.present);
DbUtil.Db.UpdateMeetingCounters(mpa.orgID);
DbUtil.LogActivity($"Mobile RecAtt o:{meeting.OrganizationId} p:{mpa.peopleID} u:{Util.UserPeopleId} a:{mpa.present}");
BaseMessage br = new BaseMessage();
br.setNoError();
br.count = 1;
return br;
}
示例6: OneTimeManagedGivingLink
public ActionResult OneTimeManagedGivingLink(string data)
{
var result = AuthenticateUser();
if (!result.IsValid) return AuthorizationError(result);
var dataIn = BaseMessage.createFromString(data);
var managedGivingOrgId = DbUtil.Db.Organizations
.Where(o => o.RegistrationTypeId == RegistrationTypeCode.ManageGiving)
.Select(x => x.OrganizationId).FirstOrDefault();
var ot = GetOneTimeLink(managedGivingOrgId, result.User.PeopleId.GetValueOrDefault());
DbUtil.Db.OneTimeLinks.InsertOnSubmit(ot);
DbUtil.Db.SubmitChanges();
// DbUtil.LogActivity($"APIPerson GetOneTimeRegisterLink {OrgId}, {PeopleId}");
var br = new BaseMessage();
if (dataIn.version >= BaseMessage.API_VERSION_3)
{
br.data = DbUtil.Db.ServerLink($"OnlineReg/RegisterLink/{ot.Id.ToCode()}?{dataIn.getSourceQueryString()}");
}
else
{
br.data = DbUtil.Db.ServerLink($"OnlineReg/RegisterLink/{ot.Id.ToCode()}");
}
br.setNoError();
return br;
}
示例7: JoinOrg
public ActionResult JoinOrg(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);
MobilePostJoinOrg mpjo = JsonConvert.DeserializeObject<MobilePostJoinOrg>(dataIn.data);
var om = DbUtil.Db.OrganizationMembers.SingleOrDefault(m => m.PeopleId == mpjo.peopleID && m.OrganizationId == mpjo.orgID);
if (om == null && mpjo.join)
om = OrganizationMember.InsertOrgMembers(DbUtil.Db, mpjo.orgID, mpjo.peopleID, MemberTypeCode.Member, DateTime.Now, null, false);
if (om != null && !mpjo.join)
{
om.Drop(DbUtil.Db, DateTime.Today);
DbUtil.LogActivity($"Dropped {om.PeopleId} for {om.Organization.OrganizationId} via {dataIn.getSourceOS()} app", peopleid:om.PeopleId, orgid: om.OrganizationId);
}
DbUtil.Db.SubmitChanges();
BaseMessage br = new BaseMessage();
br.setNoError();
br.count = 1;
return br;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: RegisterPushID
public ActionResult RegisterPushID(string data)
{
// Authenticate first
var result = AuthenticateUser();
if (!result.IsValid) return AuthorizationError(result);
BaseMessage dataIn = BaseMessage.createFromString(data);
BaseMessage br = new BaseMessage();
switch (dataIn.argInt)
{
case 1: // Add
{
savePushID(Util.UserPeopleId ?? 0, dataIn.device, dataIn.key);
br.setNoError();
break;
}
case 2: // Enable - May not be used
{
if (enablePushID(dataIn.key, true))
br.setNoError();
break;
}
case 3: // Disable - May not be used
{
if (enablePushID(dataIn.key, false))
br.setNoError();
break;
}
default: break;
}
return br;
}
示例12: GivingLink
public ActionResult GivingLink(string data)
{
var dataIn = BaseMessage.createFromString(data);
var sql = @"
SELECT OrganizationId FROM dbo.Organizations
WHERE RegistrationTypeId = 8
AND RegSettingXml.value('(/Settings/Fees/DonationFundId)[1]', 'int') IS NULL";
var givingOrgId = DbUtil.Db.Connection.ExecuteScalar(sql) as int?;
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;
}
示例13: CreateUser
public ActionResult CreateUser(string data)
{
BaseMessage dataIn = BaseMessage.createFromString(data);
MobilePostCreate mpc = JsonConvert.DeserializeObject<MobilePostCreate>(dataIn.data);
MobileAccount account = MobileAccount.Create(mpc.first, mpc.last, mpc.email, mpc.phone, mpc.dob);
var br = new BaseMessage();
// todo: notify user based on ResultCode
if (account.Result == MobileAccount.ResultCode.BadEmailAddress || account.Result == MobileAccount.ResultCode.FoundMultipleMatches)
{
br.setError(BaseMessage.API_ERROR_CREATE_FAILED);
}
else
{
br.setNoError();
br.data = account.User.Username;
}
return br;
}
示例14: AuthenticatedLink
public ActionResult AuthenticatedLink(string data)
{
var result = AuthenticateUser();
if (!result.IsValid) return AuthorizationError(result);
// Link in data string is path only include leading slash
var dataIn = BaseMessage.createFromString(data);
var ot = new OneTimeLink
{
Id = Guid.NewGuid(),
Querystring = Util.UserName,
Expires = DateTime.Now.AddMinutes(15)
};
DbUtil.Db.OneTimeLinks.InsertOnSubmit(ot);
DbUtil.Db.SubmitChanges();
var br = new BaseMessage();
br.setNoError();
br.data = $"{DbUtil.Db.ServerLink($"Logon?ReturnUrl={HttpUtility.UrlEncode(dataIn.argString)}&otltoken={ot.Id.ToCode()}")}";
return br;
}
示例15: FetchOrgRollList
public ActionResult FetchOrgRollList(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 roles is required to take attendance for organizations");
// Convert raw post to avoid "+" being converted to space for iOS timezone info. Remove this later when app has been updated.
String rawPost = new StreamReader(this.Request.InputStream).ReadToEnd();
rawPost = Server.UrlDecode(rawPost).Substring(5);
// Check to see if type matches
BaseMessage dataIn = BaseMessage.createFromString(rawPost);
if (dataIn.device == BaseMessage.API_DEVICE_IOS && dataIn.version == BaseMessage.API_VERSION_2)
{
dataIn.data = dataIn.data.Replace(" ", "+");
}
MobilePostRollList mprl = JsonConvert.DeserializeObject<MobilePostRollList>(dataIn.data);
if (dataIn.device == BaseMessage.API_DEVICE_IOS && dataIn.version == BaseMessage.API_VERSION_2)
{
int tzOffset = 0;
int.TryParse(DbUtil.Db.GetSetting("TZOffset", "0"), out tzOffset);
if (tzOffset != 0)
{
mprl.changeHourOffset(tzOffset);
}
}
var meetingId = DbUtil.Db.CreateMeeting(mprl.id, mprl.datetime);
var people = RollsheetModel.RollList(meetingId, mprl.id, mprl.datetime);
var meeting = DbUtil.Db.Meetings.SingleOrDefault(m => m.MeetingId == meetingId);
MobileRollList mrl = new MobileRollList();
mrl.attendees = new List<MobileAttendee>();
mrl.meetingID = meetingId;
mrl.headcountEnabled = DbUtil.Db.Setting("RegularMeetingHeadCount", "true");
mrl.headcount = meeting.HeadCount ?? 0;
BaseMessage br = new BaseMessage();
br.id = meetingId;
br.setNoError();
br.count = people.Count();
foreach (var person in people)
{
mrl.attendees.Add(new MobileAttendee().populate(person));
}
br.data = SerializeJSON(mrl, dataIn.version);
return br;
}