示例#1
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()));
            }
        }
示例#2
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> UInsert()
        {
            var dtid = Guid.Parse(Request.Form["dtid"]);

            try {
                var id             = Guid.Parse(Request.Form["id"]);
                var fname          = Request.Form["fname"];
                var lname          = Request.Form["lname"];
                var mname          = Request.Form["mname"];
                var add            = Request.Form["add"];
                var email          = Request.Form["email"];
                var pass           = Request.Form["pass"];
                var repass         = Request.Form["rpass"];
                var cnum           = Request.Form["cnum"];
                var isAllow        = Boolean.Parse(Request.Form["ia"]);
                var areg           = Guid.Parse(Request.Form["areg"]);
                var profID         = Guid.Parse(Request.Form["profid"]);
                var aid            = Guid.Parse(Request.Form["aid"]);
                var hashedPassword = UsersService.GenerateHashPassword(pass);
                if (ApplicationInformationService.GetByID(areg) == null)
                {
                    DateTimeStorageService.RemoveAdmin(dtid);
                    return(Failed("Please do not modify link to complete the signup process " + areg));
                }
                if (!pass.Equals(repass))
                {
                    DateTimeStorageService.RemoveAdmin(dtid);
                    return(Failed("Make sure password matches retype password"));
                }
                if (ValidateEmailAddress(email))
                {
                    if (ValidateContactNumber(cnum))
                    {
                        if (UsersService.Insert(id, fname, lname, mname, add, email, hashedPassword, cnum, isAllow, areg, profID, dtid))
                        {
                            InsertNewUserInformation(id, aid, Guid.Parse("7d789492-1c6c-4ea2-9e1e-893a68620d1e"));
                            return(Success(id.ToString()));
                        }
                    }
                    else
                    {
                        DateTimeStorageService.RemoveAdmin(dtid);
                        return(Failed(MessageUtilityService.InUse("Mobile Number")));
                    }
                }
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.FailedInsert("Signup")));
            } catch {
                DateTimeStorageService.RemoveAdmin(dtid);
                return(Failed(MessageUtilityService.ServerError()));
            }
        }