public HttpResponseMessage GetData(string package = "")
        {
            StudentService.StudentService ss = new StudentService.StudentService();
            string cookieValue = String.Empty;

            string[] packageDecode = null;
            string   applicationId = String.Empty;
            string   userId        = String.Empty;
            string   verifyCode    = String.Empty;

            if (!String.IsNullOrEmpty(package))
            {
                try
                {
                    packageDecode = ss.DecodeBase64String(package).Split('.');
                    cookieValue   = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));

                    if (iUtil.CompareCookie(iUtil.cookieName, cookieValue))
                    {
                        applicationId = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                        userId        = ss.DecodeBase64String(ss.StringReverse(packageDecode[2]));
                        verifyCode    = ss.DecodeBase64String(ss.StringReverse(packageDecode[3]));
                    }
                }
                catch
                {
                }
            }

            DataTable dt = API.Models.Application.GetData(applicationId, userId, verifyCode).Tables[0];

            return(Request.CreateResponse(HttpStatusCode.OK, iUtil.APIResponse.GetData(dt)));
        }
Example #2
0
        public HttpResponseMessage SetTermServiceConsent()
        {
            string        userId          = String.Empty;
            string        termServiceType = String.Empty;
            StringBuilder xmlData         = new StringBuilder();

            try
            {
                dynamic json    = GetJSONFromRequest();
                string  package = json["package"];

                StudentService.StudentService ss = new StudentService.StudentService();
                string[] packageDecode           = null;
                string   cookieValue             = String.Empty;

                if (!String.IsNullOrEmpty(package))
                {
                    packageDecode = ss.DecodeBase64String(package).Split('.');
                    cookieValue   = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));

                    if (iUtil.CompareCookie(iUtil.cookieName, cookieValue))
                    {
                        userId          = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                        termServiceType = ss.DecodeBase64String(ss.StringReverse(packageDecode[2]));
                    }
                }
            }
            catch
            {
            }

            if (!String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(termServiceType))
            {
                xmlData.AppendFormat(
                    "<table>" +
                    "<row>" +
                    "<studentId>{0}</studentId>" +
                    "<termType>{1}</termType>" +
                    "<termStatus>Y</termStatus>" +
                    "<ip>{2}</ip>" +
                    "<createdBy>{3}</createdBy>" +
                    "</row>" +
                    "</table>", userId, termServiceType, iUtil.GetIP(), userId
                    );
            }

            DataSet ds = iUtil.ExecuteCommandStoredProcedure(iUtil.infinityConnectionString, "sp_stdSetStudentTermService",
                                                             new SqlParameter("@xmlData", (!String.IsNullOrEmpty(xmlData.ToString()) ? xmlData.ToString() : null))
                                                             );

            return(Request.CreateResponse(HttpStatusCode.OK, iUtil.APIResponse.GetData(ds.Tables[0])));
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string what          = Request.QueryString["what"];
            string package       = Request.QueryString["package"];
            string fileName      = (DateTime.Now).ToString("dd-MM-yyyy@HH-mm-ss", new CultureInfo("en-US"));
            string saveFile      = String.Empty;
            string cookieValue   = String.Empty;
            string userId        = String.Empty;
            string applicationId = String.Empty;
            string verifyCode    = String.Empty;

            string[] packageDecode             = null;
            bool     status                    = true;
            Dictionary <string, object> result = new Dictionary <string, object>();
            JavaScriptSerializer        json   = new JavaScriptSerializer();

            StudentService.StudentService ss = new StudentService.StudentService();

            try
            {
                packageDecode = ss.DecodeBase64String(package).Split('.');
                cookieValue   = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));
                userId        = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                applicationId = ss.DecodeBase64String(ss.StringReverse(packageDecode[2]));

                if (iUtil.CompareCookie(iUtil.cookieName, cookieValue))
                {
                    FileInfo f = new FileInfo(Request.Files[0].FileName);

                    fileName = (applicationId + what + fileName + f.Extension.ToLower());
                    saveFile = (Server.MapPath("~").Replace("API", "").Replace("Publish", "") + iUtil.fileUploadPath + "/" + fileName);

                    Request.Files[0].SaveAs(saveFile);

                    status = true;
                }
                else
                {
                    status = false;
                }
            }
            catch
            {
                status = false;
            }

            result.Add("status", status);
            result.Add("fileName", fileName);

            Response.Write(json.Serialize(result));
        }
Example #4
0
        public HttpResponseMessage GetExist(
            string package    = "",
            string packageOld = "",
            string verifyCode = ""
            )
        {
            StudentService.StudentService ss = new StudentService.StudentService();
            string[] packageDecode           = null;
            string[] packageOldDecode        = null;
            string   userId   = String.Empty;
            string   username = String.Empty;
            string   password = String.Empty;

            try
            {
                if (!String.IsNullOrEmpty(package))
                {
                    packageDecode = ss.DecodeBase64String(package).Split('.');
                    username      = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));
                    password      = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                }
                if (!String.IsNullOrEmpty(packageOld))
                {
                    packageOldDecode = ss.DecodeBase64String(packageOld).Split('.');
                    userId           = ss.DecodeBase64String(ss.StringReverse(packageOldDecode[0]));
                    username         = ss.DecodeBase64String(ss.StringReverse(packageOldDecode[1]));
                    password         = ss.DecodeBase64String(ss.StringReverse(packageOldDecode[2]));
                }
            }
            catch
            {
            }

            DataTable dt = API.Models.User.GetExist(userId, username, password, verifyCode).Tables[0];

            return(Request.CreateResponse(HttpStatusCode.OK, iUtil.APIResponse.GetData(dt)));
        }
Example #5
0
        public HttpResponseMessage GetData(
            string package         = "",
            string sendEmailStatus = "",
            string email           = ""
            )
        {
            StudentService.StudentService ss = new StudentService.StudentService();
            string[] packageDecode           = null;
            string   action     = String.Empty;
            string   userId     = String.Empty;
            string   username   = String.Empty;
            string   password   = String.Empty;
            string   verifyCode = String.Empty;

            if (!String.IsNullOrEmpty(package))
            {
                try
                {
                    packageDecode = ss.DecodeBase64String(package).Split('.');
                    action        = ss.DecodeBase64String(ss.StringReverse(packageDecode[packageDecode.GetLength(0) - 1]));

                    if (action.Equals("signin"))
                    {
                        username = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));
                        password = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                    }

                    if (action.Equals("info"))
                    {
                        userId     = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));
                        verifyCode = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                    }

                    if (action.Equals("requestPassword"))
                    {
                        username   = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));
                        verifyCode = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                    }
                }
                catch
                {
                }
            }

            DataTable dt = API.Models.User.GetData(userId, username, password, verifyCode, sendEmailStatus, email).Tables[0];

            return(Request.CreateResponse(HttpStatusCode.OK, iUtil.APIResponse.GetData(dt)));
        }
Example #6
0
        public static DataSet SetData(string method, List <User> data)
        {
            string action = String.Empty;

            string[] packageDecode = null;
            string   userId        = String.Empty;
            string   username      = String.Empty;
            string   password      = String.Empty;
            string   verifyCode    = String.Empty;
            DataSet  ds            = new DataSet();

            StudentService.StudentService ss = new StudentService.StudentService();

            if (method.Equals("POST"))
            {
                action = "INSERT";
            }
            if (method.Equals("PUT"))
            {
                action = "UPDATE";
            }
            if (method.Equals("DELETE"))
            {
                action = "DELETE";
            }

            foreach (var d in data)
            {
                try
                {
                    packageDecode = ss.DecodeBase64String(d.package).Split('.');

                    if (action.Equals("INSERT"))
                    {
                        username = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));
                        password = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                    }

                    if (action.Equals("UPDATE"))
                    {
                        userId     = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));
                        verifyCode = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));

                        if (packageDecode.GetLength(0).Equals(4))
                        {
                            username = ss.DecodeBase64String(ss.StringReverse(packageDecode[2]));
                            password = ss.DecodeBase64String(ss.StringReverse(packageDecode[3]));
                        }
                    }

                    ds = iUtil.ExecuteCommandStoredProcedure(iUtil.bermudaConnectionString, "sp_sexSetUser",
                                                             new SqlParameter("@action", action),
                                                             new SqlParameter("@id", userId),
                                                             new SqlParameter("@username", username),
                                                             new SqlParameter("@password", password),
                                                             new SqlParameter("@verifyCode", verifyCode),
                                                             new SqlParameter("@verifyStatus", d.verifyStatus),
                                                             new SqlParameter("@titlePrefixId", d.titlePrefixId),
                                                             new SqlParameter("@firstName", d.firstName),
                                                             new SqlParameter("@middleName", d.middleName),
                                                             new SqlParameter("@lastName", d.lastName),
                                                             new SqlParameter("@nationalityId", d.nationalityId),
                                                             new SqlParameter("@genderId", d.genderId),
                                                             new SqlParameter("@email", d.email),
                                                             new SqlParameter("@countryId", d.countryId),
                                                             new SqlParameter("@cancelledStatus", d.cancelledStatus),
                                                             new SqlParameter("@by", d.by),
                                                             new SqlParameter("@ip", iUtil.GetIP())
                                                             );
                }
                catch
                {
                }
            }

            return(ds);
        }
        public static DataSet SetData(string method, List <Application> data)
        {
            string action      = String.Empty;
            string cookieValue = String.Empty;

            string[] packageDecode = null;
            string   applicationId = String.Empty;
            string   userId        = String.Empty;
            string   verifyCode    = String.Empty;
            DataSet  ds            = new DataSet();

            StudentService.StudentService ss = new StudentService.StudentService();

            if (method.Equals("POST"))
            {
                action = "INSERT";
            }
            if (method.Equals("PUT"))
            {
                action = "UPDATE";
            }
            if (method.Equals("DELETE"))
            {
                action = "DELETE";
            }

            foreach (var d in data)
            {
                try
                {
                    packageDecode = ss.DecodeBase64String(d.package).Split('.');

                    if (action.Equals("INSERT"))
                    {
                        userId     = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));
                        verifyCode = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                    }

                    if (action.Equals("UPDATE"))
                    {
                        cookieValue = ss.DecodeBase64String(ss.StringReverse(packageDecode[0]));

                        if (iUtil.CompareCookie(iUtil.cookieName, cookieValue))
                        {
                            applicationId = ss.DecodeBase64String(ss.StringReverse(packageDecode[1]));
                            userId        = ss.DecodeBase64String(ss.StringReverse(packageDecode[2]));
                            verifyCode    = ss.DecodeBase64String(ss.StringReverse(packageDecode[3]));
                        }
                    }

                    ds = iUtil.ExecuteCommandStoredProcedure(iUtil.bermudaConnectionString, "sp_sexSetApplication",
                                                             new SqlParameter("@action", action),
                                                             new SqlParameter("@id", applicationId),
                                                             new SqlParameter("@userId", userId),
                                                             new SqlParameter("@verifyCode", verifyCode),
                                                             new SqlParameter("@titlePrefixId", d.titlePrefixId),
                                                             new SqlParameter("@firstName", d.firstName),
                                                             new SqlParameter("@middleName", d.middleName),
                                                             new SqlParameter("@lastName", d.lastName),
                                                             new SqlParameter("@nationalityId", d.nationalityId),
                                                             new SqlParameter("@genderId", d.genderId),
                                                             new SqlParameter("@email", d.email),
                                                             new SqlParameter("@studentCategoryId", d.studentCategoryId),
                                                             new SqlParameter("@studentCategorySpecify", d.studentCategorySpecify),
                                                             new SqlParameter("@studentCategoryOther", d.studentCategoryOther),
                                                             new SqlParameter("@countryId", d.countryId),
                                                             new SqlParameter("@universityId", d.universityId),
                                                             new SqlParameter("@universityOther", d.universityOther),
                                                             new SqlParameter("@facultyId", d.facultyId),
                                                             new SqlParameter("@department", d.department),
                                                             new SqlParameter("@semesterDateStart", d.semesterDateStart),
                                                             new SqlParameter("@semesterDateEnd", d.semesterDateEnd),
                                                             new SqlParameter("@homeAddress", d.homeAddress),
                                                             new SqlParameter("@homeDistrict", d.homeDistrict),
                                                             new SqlParameter("@homeCity", d.homeCity),
                                                             new SqlParameter("@homeProvince", d.homeProvince),
                                                             new SqlParameter("@homePostalCode", d.homePostalCode),
                                                             new SqlParameter("@countryHomeId", d.countryHomeId),
                                                             new SqlParameter("@mailingAddress", d.mailingAddress),
                                                             new SqlParameter("@mailingDistrict", d.mailingDistrict),
                                                             new SqlParameter("@mailingCity", d.mailingCity),
                                                             new SqlParameter("@mailingProvince", d.mailingProvince),
                                                             new SqlParameter("@mailingPostalCode", d.mailingPostalCode),
                                                             new SqlParameter("@countryMailingId", d.countryMailingId),
                                                             new SqlParameter("@contactTel", d.contactTel),
                                                             new SqlParameter("@birthdate", d.birthdate),
                                                             new SqlParameter("@maritalStatusId", d.maritalStatusId),
                                                             new SqlParameter("@passportNumber", d.passportNumber),
                                                             new SqlParameter("@passportExpiryDate", d.passportExpiryDate),
                                                             new SqlParameter("@emergencyName", d.emergencyName),
                                                             new SqlParameter("@relationshipId", d.relationshipId),
                                                             new SqlParameter("@emergencyMailingAddress", d.emergencyMailingAddress),
                                                             new SqlParameter("@emergencyMailingDistrict", d.emergencyMailingDistrict),
                                                             new SqlParameter("@emergencyMailingCity", d.emergencyMailingCity),
                                                             new SqlParameter("@emergencyMailingProvince", d.emergencyMailingProvince),
                                                             new SqlParameter("@emergencyMailingPostalCode", d.emergencyMailingPostalCode),
                                                             new SqlParameter("@countryMailingEmergencyId", d.countryMailingEmergencyId),
                                                             new SqlParameter("@emergencyHomeTel", d.emergencyHomeTel),
                                                             new SqlParameter("@emergencyOfficeTel", d.emergencyOfficeTel),
                                                             new SqlParameter("@emergencyMobile", d.emergencyMobile),
                                                             new SqlParameter("@emergencyFax", d.emergencyFax),
                                                             new SqlParameter("@emergencyEmail", d.emergencyEmail),
                                                             new SqlParameter("@curEduInstitution", d.curEduInstitution),
                                                             new SqlParameter("@curEduFaculty", d.curEduFaculty),
                                                             new SqlParameter("@disciplineId", d.disciplineId),
                                                             new SqlParameter("@educationalBackgroundId", d.educationalBackgroundId),
                                                             new SqlParameter("@curEduYear", d.curEduYear),
                                                             new SqlParameter("@TOEFLScore", d.TOEFLScore),
                                                             new SqlParameter("@TOEFLTypeId", d.TOEFLTypeId),
                                                             new SqlParameter("@IELTSResult", d.IELTSResult),
                                                             new SqlParameter("@englishNativeOther", d.englishNativeOther),
                                                             new SqlParameter("@passportFile", d.passportFile),
                                                             new SqlParameter("@facePhotographsFile", d.facePhotographsFile),
                                                             new SqlParameter("@transcriptFile", d.transcriptFile),
                                                             new SqlParameter("@travelInsuranceFile", d.travelInsuranceFile),
                                                             new SqlParameter("@letterHomeUniversityFile", d.letterHomeUniversityFile),
                                                             new SqlParameter("@curriculumVitaeFile", d.curriculumVitaeFile),
                                                             new SqlParameter("@TOEFLIELTSFile", d.TOEFLIELTSFile),
                                                             new SqlParameter("@letterIntentFile", d.letterIntentFile),
                                                             new SqlParameter("@declarationA", d.declarationA),
                                                             new SqlParameter("@declarationB", d.declarationB),
                                                             new SqlParameter("@declarationC", d.declarationC),
                                                             new SqlParameter("@declarationD", d.declarationD),
                                                             new SqlParameter("@declarationE", d.declarationE),
                                                             new SqlParameter("@declarationESpecify", d.declarationESpecify),
                                                             new SqlParameter("@submitStatus", d.submitStatus),
                                                             new SqlParameter("@submitBy", d.by),
                                                             new SqlParameter("@submitIp", iUtil.GetIP()),
                                                             new SqlParameter("@applicationStatus", d.applicationStatus),
                                                             new SqlParameter("@centralApprovalStatus", d.centralApprovalStatus),
                                                             new SqlParameter("@centralApprovalBy", d.by),
                                                             new SqlParameter("@centralApprovalIp", iUtil.GetIP()),
                                                             new SqlParameter("@divisionApprovalStatus", d.divisionApprovalStatus),
                                                             new SqlParameter("@divisionApprovalBy", d.by),
                                                             new SqlParameter("@divisionApprovalIp", iUtil.GetIP()),
                                                             new SqlParameter("@reason", d.reason),
                                                             new SqlParameter("@cancelledStatus", d.cancelledStatus),
                                                             new SqlParameter("@by", d.by),
                                                             new SqlParameter("@ip", iUtil.GetIP())
                                                             );
                }
                catch
                {
                }
            }

            return(ds);
        }