Exemplo n.º 1
0
        public JsonResult Delete(List <string> listCode)
        {
            var ret = 0;

            if (listCode == null)
            {
                ret = -1;
            }
            else
            {
                var bus = new EXAMFORM_BUS();
                foreach (string t in listCode)
                {
                    if (t != null)
                    {
                        var item = bus.GetByID(new EXAMFORM_OBJ.BusinessObjectID(t));
                        if (item == null)
                        {
                            ret = -2; continue;
                        }
                        if (ret >= 0)
                        {
                            ret = bus.delete(item._ID);
                        }
                    }
                }
                bus.CloseConnection();
            }
            return(Json(new
            {
                ret
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Xóa toàn bộ examform và examformdetail theo examtimecode
        /// </summary>
        /// <param name="examTimeCode"></param>
        /// <returns></returns>
        public int DeleteAll(string examTimeCode)
        {
            var ret = 0;
            //get list examform
            EXAMFORM_BUS        examformBus   = new EXAMFORM_BUS();
            List <EXAMFORM_OBJ> liExamform    = examformBus.getAllBy2("CODE", new fieldpara("EXAMTIMECODE", examTimeCode, 0));
            EXAMFORMDETAIL_BUS  examDetailBus = new EXAMFORMDETAIL_BUS();

            foreach (var examform in liExamform)
            {
                var liExamFormDetail = examDetailBus.getAllBy2("CODE", new fieldpara("EXAMFORMCODE", examform.CODE, 0));
                foreach (var item in liExamFormDetail)
                {
                    ret = examDetailBus.delete(item._ID);
                    if (ret < 0)
                    {
                        return(ret);
                    }
                }
                examformBus.delete(examform._ID);
                if (ret < 0)
                {
                    return(ret);
                }
            }
            return(ret);
        }