Exemplo n.º 1
0
    {  //Guardian models
        internal Models.GuardianModel.MapGuardianResp MapParent(Models.GuardianModel.MapGuardianReq req)
        {
            Models.GuardianModel.MapGuardianResp rsp = new Models.GuardianModel.MapGuardianResp();
            rsp.apiError = new APIErrors();
            bool success = true;

            foreach (long student in req.ListudentPK)
            {
                rsp.apiError.sErrorMessage = "Mapping Successful";
                ITGuardian iGuard = _storage.MapParent(student, req.parentPK);
                //Added Entity
                if (iGuard != null && iGuard.n > 0)
                {
                    //nothing
                }
                else
                {
                    success = false;
                } if (!success)
                {
                    rsp.apiError.sErrorMessage = "Unable to add Relation. Maybe this relation is pre-existing.";
                }
                else
                {
                    rsp.apiError.jErrorVal = 0;
                }
            }
            return(rsp);
        }
Exemplo n.º 2
0
        internal Models.GuardianModel.GetGuardianResp GetParent(Models.GuardianModel.GetGuardianReq req)
        {
            Models.GuardianModel.GetGuardianResp rsp = new Models.GuardianModel.GetGuardianResp();
            rsp.apiError = new APIErrors();
            rsp.apiError = ApiError_defs.err_Nesting_Faliled;
            ITGuardian IGuard = _storage.GetParent(req.studentPK);

            //Added Entity
            if (IGuard != null && IGuard.n > 0)
            {
                rsp.parent   = new Models.GuardianModel.Relative();
                rsp.apiError = ApiError_defs.ok;
                ITEntity parent = _storage.GetEntityByID(IGuard.nEntityFKParent);
                rsp.parent.sFname      = parent.sFname;
                rsp.parent.sMname      = parent.sMname;
                rsp.parent.sLname      = parent.sLname;
                rsp.parent.nRelativeId = parent.n;
                rsp.parent.nRecordId   = IGuard.n;
            }
            else
            {
                rsp.apiError.sErrorMessage = "Unable to get parent";
            }
            return(rsp);
        }
Exemplo n.º 3
0
        internal Models.GuardianModel.editGuardianResp editGuardian(Models.GuardianModel.editGuardianReq req)
        {
            Models.GuardianModel.editGuardianResp rsp = new Models.GuardianModel.editGuardianResp();
            rsp.apiError = new APIErrors();
            ITGuardian iGuard = _storage.editGuardian(_storage.GetGuardian(req.nGuardianId), req.nStudentPK, req.nparentPK, req.bStatus);

            //Added Entity
            if (iGuard != null && iGuard.n > 0)
            {
                rsp.apiError = ApiError_defs.ok;
            }
            else
            {
                rsp.apiError.sErrorMessage = "Unable to delete Relation";
            }
            return(rsp);
        }