Ejemplo n.º 1
0
        public void AddStudentInfo(HttpContext context)
        {
            string callback = context.Request["jsoncallback"];
            string name     = context.Request["name"];
            int    result;

            if (new EmsBLL.Student().IsNameExists(name))
            {
                result = -1;
            }
            else
            {
                EmsModel.Student stu = new EmsModel.Student();
                stu.Name       = name;
                stu.Sex        = context.Request["sex"];
                stu.KaNo       = context.Request["kano"];
                stu.IDCard     = context.Request["idcard"];
                stu.ClassId    = Convert.ToInt32(context.Request["classid"]);
                stu.Phone      = context.Request["phone"];
                stu.Remarks    = context.Request["remarks"];
                stu.Creator    = context.Request["useridcard"];
                stu.CreateTime = DateTime.Now;
                stu.IsDelete   = 0;
                stu.UseStatus  = 0;
                result         = new EmsBLL.Student().Add(stu);
            }
            //输出Json
            HttpContext.Current.Response.Write(callback + "({\"result\":" + result + "})");
            HttpContext.Current.Response.End();
        }
Ejemplo n.º 2
0
        public void GetModelById(HttpContext context)
        {
            string callback = context.Request["jsoncallback"];
            int    stuid    = Convert.ToInt32(context.Request["itemid"]);

            //序列化
            System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
            EmsModel.Student stu = new EmsBLL.Student().GetEmsModel(stuid);
            //输出Json
            HttpContext.Current.Response.Write(callback + "({\"result\":" + jss.Serialize(stu) + "})");
            HttpContext.Current.Response.End();
        }
Ejemplo n.º 3
0
        public void GetUserByKaNo(HttpContext context)
        {
            string callback = context.Request["jsoncallback"];

            string KaNo = context.Request["KaNo"];

            EmsModel.UserInfo user = new EmsBLL.UserInfo().GetEmsModelByKaNo(KaNo);

            EmsModel.Student stu = new EmsBLL.Student().GetEmsModelByKaNo(KaNo);
            //序列化
            System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();

            //输出Json
            HttpContext.Current.Response.Write(callback +
                                               "({\"result\":" + jss.Serialize(user) + ",\"result2\":" + jss.Serialize(stu) + "})");

            HttpContext.Current.Response.End();
        }
Ejemplo n.º 4
0
        public void GetDataPage(HttpContext context)
        {
            string callback = context.Request["jsoncallback"];
            //当前页
            int startIndex = Convert.ToInt32(context.Request["startIndex"]);
            //页容量
            int    pageSize = Convert.ToInt32(context.Request["pageSize"]);
            string name     = context.Request["name"];

            EmsModel.Student stu = new EmsModel.Student();
            if (!string.IsNullOrEmpty(name))
            {
                stu.Name = name;
            }
            stu.IsDelete = 0;
            //序列化
            System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
            EmsModel.JsonModel mod = new EmsBLL.Student().GetJsonModel(stu, startIndex, pageSize);
            //输出Json
            HttpContext.Current.Response.Write(callback + "({\"result\":" + jss.Serialize(mod) + "})");
            HttpContext.Current.Response.End();
        }
        public void ChangeUseStatus(HttpContext context)
        {
            string callback  = context.Request["jsoncallback"];
            int    itemid    = Convert.ToInt32(context.Request["itemid"]);
            byte   status    = Convert.ToByte(context.Request["Status"]);
            string tablename = context.Request["tablename"];
            int    result;

            switch (tablename)
            {
            case "UserInfo":
                EmsModel.UserInfo user = new EmsBLL.UserInfo().GetEmsModel(itemid);
                user.Id = itemid;
                //user.IsDelete = 1;
                user.UseStatus = status;
                result         = new EmsBLL.UserInfo().Update(user);
                break;

            case "Student":
                EmsModel.Student stu = new EmsBLL.Student().GetEmsModel(itemid);
                stu.Id        = itemid;
                stu.UseStatus = status;
                result        = new EmsBLL.Student().Update(stu);
                break;

            case "Warehouse":
                EmsModel.Warehouse ware = new EmsBLL.Warehouse().GetEmsModel(itemid);
                ware.Id        = itemid;
                ware.UseStatus = status;
                result         = new EmsBLL.Warehouse().Update(ware);
                break;

            case "InstrumentEquip":
                EmsModel.InstrumentEquip insEp = new EmsBLL.InstrumentEquip().GetEmsModel(itemid);
                insEp.Id        = itemid;
                insEp.UseStatus = status;
                result          = new EmsBLL.InstrumentEquip().Update(insEp);
                break;

            case "EquipDetail":
                EmsModel.EquipDetail equip = new EmsBLL.EquipDetail().GetEmsModel(itemid);
                equip.Id        = itemid;
                equip.UseStatus = status;
                result          = new EmsBLL.EquipDetail().Update(equip);
                break;

            case "ClassInfo":
                EmsModel.ClassInfo cla = new EmsBLL.ClassInfo().GetEmsModel(itemid);
                cla.Id        = itemid;
                cla.UseStatus = status;
                result        = new EmsBLL.ClassInfo().Update(cla);
                break;

            case "LearnYear":
                EmsModel.LearnYear ley = new EmsBLL.LearnYear().GetEmsModel(itemid);
                ley.Id        = itemid;
                ley.UseStatus = status;
                result        = new EmsBLL.LearnYear().Update(ley);
                break;

            case "SectionPlace":
                EmsModel.SectionPlace spla = new EmsBLL.SectionPlace().GetEmsModel(itemid);
                spla.Id        = itemid;
                spla.UseStatus = status;
                result         = new EmsBLL.SectionPlace().Update(spla);
                break;

            default:
                result = 0;
                break;
            }
            //输出Json
            context.Response.Write(callback + "({\"result\":" + result + "})");
            context.Response.End();
        }