예제 #1
0
        public JsonResult CheckCodeViewExitAnswer(string questiongroup, string question, string code, string codeView)
        {
            int        ret;
            ANSWER_BUS bus = new ANSWER_BUS();
            ANSWER_OBJ obj;

            if (!string.IsNullOrEmpty(code))
            {
                //check for update
                obj = bus.GetByKey(new fieldpara("CODEVIEW", codeView, 0),
                                   new fieldpara("QUESTIONGROUPCODE", questiongroup, 0),
                                   new fieldpara("QUESTIONCODE", question, 0),
                                   new fieldpara("UNIVERSITYCODE", _ses.gUNIVERSITYCODE, 0));

                if (obj == null)
                {
                    //change codeview
                    ret = 1;
                }
                else
                {
                    //change other feature,not codeview
                    ret = (code == obj.CODE) ? 1 : -1;
                }
            }
            else
            {
                obj = bus.GetByKey(new fieldpara("CODEVIEW", codeView, 0),
                                   new fieldpara("UNIVERSITYCODE", _ses.gUNIVERSITYCODE, 0));
                ret = (obj == null) ? 1 : -1;
            }
            bus.CloseConnection();
            return(Json(new { sussess = ret }, JsonRequestBehavior.AllowGet));
        }