public async Task <JsonResult> SRDGetOwner(string id, string aid)
 {
     try {
         var data = SignalRDataService.GetByOIDAPI(Guid.Parse(id), Guid.Parse(aid));
         return(Success(SignalRDataVM.MToVM(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> UAuthenticate()
 {
     try {
         var email    = Request.Form["email"];
         var pass     = Request.Form["pass"];
         var aid      = Guid.Parse(Request.Form["aid"]);
         var userInfo = UsersService.GetByEmailAddress(email);
         if (userInfo == null)
         {
             return(Failed(MessageUtilityService.AuthenticationFailed()));
         }
         if (userInfo.isAllowAccess)
         {
             if (UsersService.ComparePassword(userInfo.Password, pass))
             {
                 var vm = UsersService.SetSubData(userInfo, aid);
                 if (UserAccessLevelService.HasAccess(userInfo.ID, superAdmin))
                 {
                     vm.Password = pass;
                 }
                 return(Success(vm));
             }
         }
         return(Failed(MessageUtilityService.AuthenticationFailed()));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 //questionID, quizTakerID
 public async Task <JsonResult> QUAGet(string id, string qtid)
 {
     try {
         var data = QuizUserAnswerService.GetByQQIDQTID(Guid.Parse(id), Guid.Parse(qtid));
         return(Success(QuizUserAnswerVM.MsToVMs(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #4
0
 public async Task <JsonResult> ILSGetOwner(string id, string aid)
 {
     try {
         var data = ImageLinkStorageService.GetByOIDAPI(Guid.Parse(id), Guid.Parse(aid));
         return(Success(ImageLinkStorageVM.MsToVMs(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #5
0
        public async Task <JsonResult> MSInsert()
        {
            var id   = Guid.Parse(Request.Form["id"]);
            var uid  = Guid.Parse(Request.Form["uid"]);
            var name = Request.Form["name"];
            var aid  = Guid.Parse(Request.Form["aid"]);
            var scid = Guid.Parse(Request.Form["scid"]);
            var sbid = Guid.Parse(Request.Form["sbid"]);
            var slid = Guid.Parse(Request.Form["slid"]);
            var dtid = Guid.Parse(Request.Form["dtid"]);

            try {
                if (MyStoreService.IsStoreNameAllowUse(name))
                {
                    //remove dtid
                    DateTimeStorageService.RemoveAdmin(dtid);
                    return(Failed(MessageUtilityService.InUse("Store Name")));
                }
                if (MyStoreService.Insert(id, uid, name, aid, scid, sbid, slid, false, dtid))
                {
                    return(Success(id.ToString()));
                }
                //removing datetimeID
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.FailedInsert("MyStore")));
            } catch {
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.ServerError()));
            }
        }
예제 #6
0
 public async Task <JsonResult> SSUpdate()
 {
     try {
         var id = Guid.Parse(Request.Form["id"]);
         return(Success(""));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #7
0
 public async Task <JsonResult> UUploadImage()
 {
     try
     {
         var path     = Request.Form["path"];
         var fileName = Guid.NewGuid().ToString();
         foreach (string file in Request.Files)
         {
             var fileContent = Request.Files[file];
             if (fileContent != null && fileContent.ContentLength > 0)
             {
                 //before uploading image make sure it does not exist in path
                 // get a stream
                 var stream = fileContent.InputStream;
                 // and optionally write the file to disk
                 if (!Directory.Exists(Path.Combine(Server.MapPath("~/UPLOADS/" + path))))
                 {
                     Directory.CreateDirectory(Path.Combine(Server.MapPath("~/UPLOADS/" + path)));
                 }
                 var uploadPath = Path.Combine(Server.MapPath("~/UPLOADS/" + path), fileName + ".png");
                 using (var fileStream = System.IO.File.Create(uploadPath))
                 {
                     stream.CopyTo(fileStream);
                 }
             }
         }
         return(Success("UPLOADS/" + path + "/" + fileName + ".png"));
     }
     catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #8
0
 public async Task <JsonResult> SBGetByRadius(string id, string aid, string lcid, string rad, string longi, string lat)
 {
     try {
         var data = StoreBranchService.GetNearestBranchByLocation(Guid.Parse(id), Guid.Parse(aid), Guid.Parse(lcid), float.Parse(rad), float.Parse(longi), float.Parse(lat));
         return(Success(data));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #9
0
 public async Task <JsonResult> DSGet(string id, string aid)
 {
     try {
         var data = DateTimeStorageService.GetByID(Guid.Parse(id));
         return(Success(DateTimeStorageVM.MToVM(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #10
0
 public async Task <JsonResult> SGCGenerateCode1()
 {
     try{
         var code = SecurityGeneratorService.GetCode();
         return(Success(code));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #11
0
        public async Task <JsonResult> STInsert()
        {
            var id     = Guid.Parse(Request.Form["id"]);
            var name   = Request.Form["name"];
            var desc   = Request.Form["desc"];
            var oid    = Guid.Parse(Request.Form["oid"]);
            var aid    = Guid.Parse(Request.Form["aid"]);
            var dtid   = Guid.Parse(Request.Form["dtid"]);
            var catID  = Guid.Parse(Request.Form["cid"]);
            var uid    = Guid.Parse(Request.Form["uid"]);
            var sadmin = Guid.Parse("3c35cccc-d48d-4721-9283-d58faeac6cc1");

            try {
                if (!UserAccessLevelService.HasAccess(uid, sadmin))
                {
                    return(Failed(MessageUtilityService.ContactAdmin("Content")));
                }
                if (StatusTypesReferencesService.Insert(id, name, desc, oid, aid, dtid, catID))
                {
                    return(Success(id.ToString()));
                }
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.FailedInsert("")));
            } catch {
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.ServerError()));
            }
        }
 public async Task <JsonResult> SIGetOwner(string id, string aid)
 {
     try {
         var data = SearchInputService.GetByOIDAPI(Guid.Parse(id), Guid.Parse(aid));
         return(Success(SearchInputsDataVM.MsToVMs(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> ELIsEmailExist()
 {
     try {
         //checks if email exist in the database else create one
         var name  = Request.Form["name"];
         var email = Request.Form["email"];
         var aid   = Guid.Parse(Request.Form["aid"]);
         var cnum  = Request.Form["cnum"];
         var data  = EmailListService.GetByEAdd(email);
         var tz    = Request.Form["tz"];
         if (data != null)
         {
             if (InsertNewEmailList(Guid.NewGuid(), name, email, aid, cnum))
             {
                 return(Success(true));
             }
             return(Failed(MessageUtilityService.ServerError()));
         }
         else
         {
             //update time updated data
             DateTimeStorageService.Update(data.DateTimeID, data.ID, DateTimeStorageService.GetByTZ(tz));
             EmailListService.Update(data.ID, name, data.Email, data.DateTimeID, cnum);
         }
         //email is already registered in the database
         return(Success(false));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> ELGet(string id)
 {
     try {
         var data = EmailListService.GetByID(Guid.Parse(Request.Form["id"]));
         return(Success(EmailListVM.MToVM(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> ELGetAll()
 {
     try {
         var data = EmailListService.GetAll();
         return(Success(EmailListVM.MsToVMs(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> QTCheckTestScore()
 {
     try
     {
         var qtid    = Guid.Parse(Request.Form["id"]);
         var aid     = Guid.Parse(Request.Form["aid"]);
         var answers = QuizUserAnswerService.GetByQTID(qtid);
         var ts      = 0f;
         foreach (var answer in answers)
         {
             //if multiple choice
             if (answer.OtherAnswer.Length <= 0)
             {
                 var choiceSelected = QuizQuestionAnswerService.GetByID(answer.QuizAnswerID, answer.QuizQuestionID);
                 answer.PointsEarned = choiceSelected.Points;
             }
             //if essay retain the assigned score
             QuizUserAnswerService.Update(answer.ID, answer.QuizTakersID, answer.QuizQuestionID, answer.QuizAnswerID, answer.OtherAnswer, answer.PointsEarned);
             ts += answer.PointsEarned;
         }
         //update total score
         var qtModel = QuizTakerService.GetByID(qtid);
         QuizTakerService.Update(qtid, qtModel.QuizInfoID, qtModel.UserID, ts, qtModel.DateTimeStorageID);
         return(Success(true));
     }
     catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> LSGetByID(string id, string oid, string lcid, string aid)
 {
     try {
         var data = LocationStorageService.GetByIDOID(Guid.Parse(id), Guid.Parse(oid), Guid.Parse(lcid));
         var vm   = LocationStorageService.SetSubData(data, Guid.Parse(aid));
         return(Success(vm));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> NMGetByOwner(string id, string aid)
 {
     try {
         var data = NotificationManagerService.GetByOIDAID(Guid.Parse(id), Guid.Parse(aid));
         var vms  = NotificationManagerService.SetSubDatas(data, Guid.Parse(aid));
         return(Success(vms));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #19
0
 public async Task <JsonResult> RCGet(string id)
 {
     try{
         var data = ReportClaimsService.GetByAID(Guid.Parse(id));
         var vms  = ReportClaimsService.SetSubDatas(data, Guid.Parse(id));
         return(Success(vms));
     }catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #20
0
 public async Task <JsonResult> RSGetBySender(string id, string aid)
 {
     try {
         var data = ReviewStorageService.GetByAIDSID(Guid.Parse(aid), Guid.Parse(id));
         var vms  = ReviewStorageService.SetSubDatas(data, Guid.Parse(aid));
         return(Success(vms));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #21
0
 public async Task <JsonResult> GetNCode()
 {
     try {
         var n    = int.Parse(Request.Form["n"]);
         var code = SecurityGeneratorService.GetNCode(n);
         return(Success(code));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> GDGetByCategory(string id, string cid, string aid)
 {
     try {
         var data = GroupingsDataService.GetByOIDCIDAID(Guid.Parse(id), Guid.Parse(cid), Guid.Parse(aid), false);
         var vms  = GroupingsDataService.SetSubDatas(data, Guid.Parse(aid), 0);
         return(Success(vms));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #23
0
 public async Task <JsonResult> DSGetTZ()
 {
     try {
         var tz   = Request.Form["tz"];
         var time = DateTimeUtil.GetTimeNowByUTC(tz);
         return(Success(DateTimeUtil.DateTimeToString(time)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> QTGetByQuiz(string id, string aid)
 {
     try {
         var data = QuizTakerService.GetByQIID(Guid.Parse(id));
         var vms  = QuizTakerService.SetSubDatas(data, Guid.Parse(aid));
         return(Success(vms));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 //nid=qqid
 public async Task <JsonResult> QQAGet(string id, string aid, string nid)
 {
     try {
         var data = QuizQuestionAnswerService.GetByID(Guid.Parse(id), Guid.Parse(nid));
         var vms  = QuizQuestionAnswerService.SetSubData(data, Guid.Parse(aid));
         return(Success(vms));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> QIGetByID(string id, string oid, string aid)
 {
     try {
         var data = QuizInfoService.GetByID(Guid.Parse(id), Guid.Parse(oid), Guid.Parse(aid));
         var vm   = QuizInfoService.SetSubData(data, Guid.Parse(aid));
         return(Success(vm));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #27
0
 public async Task <JsonResult> MSGetByUser(string id, string aid, bool ia)
 {
     try {
         var data = MyStoreService.GetByUIDAPI(Guid.Parse(id), Guid.Parse(aid), ia);
         var vms  = MyStoreService.SetSubDatas(data, Guid.Parse(aid));
         return(Success(vms));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> LSGetByCategory(string id, string aid)
 {
     try {
         var data = LocationStorageService.GetByLCID(Guid.Parse(id));
         var vms  = LocationStorageService.SetSubDatas(data, Guid.Parse(aid));
         return(Success(vms));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #29
0
 public async Task <JsonResult> SBGet(string id, string aid, string lcid)
 {
     try {
         var data = StoreBranchService.GetBySID(Guid.Parse(id));
         var vms  = StoreBranchService.SetSubDatas(data, Guid.Parse(aid), Guid.Parse(lcid));
         return(Success(vms));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
예제 #30
0
 public async Task <JsonResult> STGetByID()
 {
     try {
         var id   = Guid.Parse(Request.Form["id"]);
         var aid  = Guid.Parse(Request.Form["aid"]);
         var data = StatusTypesReferencesService.GetByIDAID(id, aid);
         return(Success(StatusTypesReferencesVM.MToVM(data)));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }