예제 #1
0
        public JsonResult ReSendActiveEmail(tbl_UserAuth md)
        {
            string sGuid = Guid.NewGuid().ToString();
            var    obj   = new GCRequest
            {
                _a = "Updatetbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", md.Id },
                    { "UserName", md.UserName },
                    { "Active", 0 },
                },
                _d = new Dictionary <string, object>
                {
                    { "TimeZone", sGuid },
                    { "CreatedDate", DateTime.Now },
                }
            };
            var robj = service.P(obj);

            if (int.Parse(robj.Records[0][0].ToString()) == 1)
            {
                string confirmCode    = Convert.ToBase64String(Encoding.Unicode.GetBytes(String.Format("user={0}&id={1}&code={2}&date={3}", md.UserName, md.Id, sGuid, DateTime.Now)));
                var    urlConfirmLink = "http://cotoiday.vn/RegisterAccount/ConfirmPage?token=" + confirmCode;
                var    resendResult   = SendConfirmMail.SendEmail(urlConfirmLink, md.Email);
                if (resendResult)
                {
                    return(Json(1));
                }
            }

            return(Json(0));
        }
예제 #2
0
        public JsonResult UpdateInforUser(tbl_UserAuth md)
        {
            var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj     = new GCRequest
            {
                _a = "Updatetbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", md.Id }
                },
                _d = new Dictionary <string, object>
                {
                    { "DisplayName", md.DisplayName },
                    { "BirthDate", md.BirthDate },
                    { "Nationality", md.Nationality },
                    { "Gender", md.Gender },
                    { "CityId", md.CityId },
                    { "Cmnd", md.Cmnd },
                    { "MaritalStatus", md.MaritalStatus },
                    { "Height", md.Height },
                    { "Weight", md.Weight },
                    { "Address", md.Address },
                    { "Email", md.Email },
                    { "PhoneNumber", md.PhoneNumber },
                    { "Criminal", md.Criminal },
                    { "CriminalReason", md.CriminalReason },
                    { "ModifiedDate", DateTime.Now }
                }
            };
            var robj = service.P(obj);

            return(Json(robj.Result));
        }
예제 #3
0
        public JsonResult DeleteAccount(tbl_UserAuth md)
        {
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id

            var obj = new GCRequest
            {
                _a = "Updatetbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "Id", md.Id }
                },
                _d = new Dictionary <string, object>
                {
                    { "Status", 0 }
                }
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            return(Json(robj.Result));
        }
예제 #4
0
        public JsonResult CheckUser(tbl_UserAuth md)
        {
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj = new GCRequest
            {
                _a = "fGettbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _c = new Dictionary <string, object>
                {
                    { "UserName", md.UserName }
                },
                _f = "Id"
            };
            var robj = service.P(obj);

            if (robj.TotalRecordCount > 0)
            {
                return(Json(1));
            }
            return(Json(0));
        }
예제 #5
0
        public ActionResult CreateAccount(tbl_UserAuth md)
        {
            var convertPass = WebsiteExtension.EncryptPassword(md.PasswordHash);
            //var service = new S(ConfigurationManager.ConnectionStrings["CotoidayCon"].ConnectionString, true); //isDebug = true -> show error message in response object, uid is logged user id
            var obj = new GCRequest
            {
                _a = "Inserttbl_UserAuth", //Action prefix f,p for get data; gc_App is table name
                _d = new Dictionary <string, object>
                {
                    { "TypeId", md.TypeId },
                    { "UserName", md.UserName.ToLower() },
                    { "PasswordHash", convertPass },
                    { "StaffId", md.StaffId },
                    { "Status", 1 },
                    { "CreatedDate", DateTime.Now }
                }
            };
            var robj = service.P(obj); // {Result: 0 is failed, 1 is success, Records: List object array, TotalRecordCount: number of records, Message: error content }

            ViewBag.result = robj.Result;
            ViewBag.type   = md.TypeId;
            return(View(robj.Records[0][0]));
        }