Пример #1
0
        public JsonResult SaveUploadDocs(mContest _obj, string Docs = "")
        {
            string Message = string.Empty, Code = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    RContest _objRepository = new RContest();
                    _obj.CreatedIP = Request.ServerVariables["REMOTE_ADDR"].ToString();
                    DataSet _ds = _objRepository.INSERT_UPDATE_tbl_contest_Doc_Upload(_obj, Docs);
                    if (_ds != null)
                    {
                        if (_ds.Tables[0].Rows[0]["Counts"].ToString() == "1")
                        {
                            Message = "Documents have been uploaded!";
                            Code    = "success";
                        }
                        else if (_ds.Tables[0].Rows[0]["Counts"].ToString() == "2")
                        {
                            Message = "You have already submitted your entry.";
                            Code    = "alreadyexists";
                        }
                        else
                        {
                            Message = "Error from server side. Kindly refresh the page and try again.";
                            Code    = "servererror";
                        }
                    }
                }
            }
            catch (NullReferenceException)
            {
                Message = "Your session has been expired. Kindly login again.";
                Code    = "sessionexpired";
            }
            catch (Exception)
            {
                Message = "Error from server side. Kindly refresh the page and try again.";
                Code    = "servererror";
            }
            return(Json(new
            {
                m = Message,
                c = Code
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }
Пример #2
0
        public JsonResult CheckDtl(mContest _obj)
        {
            string Code = string.Empty, Message = string.Empty;

            try
            {
                RContest _objRepository = new RContest();
                _obj.CreatedIP = Request.ServerVariables["REMOTE_ADDR"].ToString();
                DataSet _ds = _objRepository.SELECT_tbl_contest_details(_obj);
                if (_ds != null)
                {
                    if (_ds.Tables[0].Rows[0]["Counts"].ToString() == "0")
                    {
                        Code    = "success";
                        Message = "Basic Details have been saved succefully.";
                    }
                    else
                    {
                        Code    = "alreadyexists";
                        Message = "You have already submitted your entry.";
                    }
                }
            }
            catch (NullReferenceException)
            {
                Code    = "error";
                Message = "Your session has been expired. Kindly refresh and try again.";
            }
            catch (Exception)
            {
                Code    = "error";
                Message = "Error from server side. Kindly refresh and try again.";
            }
            return(Json(new
            {
                c = Code,
                m = Message
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }