Esempio n. 1
0
        private void ImportStudent()
        {
            var obj = new
            {
                code = 0,
                msg  = ""
            };

            try
            {
                string data = Request.Form["data"];
                int    examDescription_id       = Request.Form["examDescription_id"].AsInt();
                List <Models.userInfo> dataList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Models.userInfo> >(data);
                var bill = new BLL.examResultBLL();
                bill.BeginTransaction();
                try
                {
                    foreach (var dd in dataList)
                    {
                        bill.Insert(new Models.examResult
                        {
                            examDescription_id = examDescription_id,
                            scode = dd.code,
                            kszt  = "待考"
                        });
                    }
                    bill.Commit();
                }
                catch (Exception ex)
                {
                    bill.Rollback();
                    throw ex;
                }
            }
            catch (Exception ex)
            {
                obj = new
                {
                    code = 99,
                    msg  = ex.Message
                };
            }

            ResponseJson(obj);
        }