Beispiel #1
0
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private EmsModel.Building GetEmsModel(DbDataReader dr)
 {
     EmsModel.Building EmsModel = new EmsModel.Building();
     EmsModel.Id          = dr["Id"] as int?; EmsModel.Name = dr["Name"] as string; EmsModel.PID = dr["PID"] as int?; EmsModel.Creator = dr["Creator"] as string; EmsModel.CreateTime = dr["CreateTime"] as DateTime?; EmsModel.Editor = dr["Editor"] as string; EmsModel.UpdateTime = dr["UpdateTime"] as DateTime?; EmsModel.IsDelete = dr["IsDelete"] as Byte?; EmsModel.Remarks = dr["Remarks"] as string; EmsModel.RoomNo = dr["RoomNo"] as string; EmsModel.Type = dr["Type"] as Byte?; EmsModel.SectionPlaceId = dr["SectionPlaceId"] as int?;
     EmsModel.SecName     = dr["SecName"] as string;     //科所名称
     EmsModel.Director    = dr["Director"] as string;
     EmsModel.SecDirector = dr["SecDirector"] as string; //科所
     return(EmsModel);
 }
Beispiel #2
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"]);
            int pid      = Convert.ToInt32(context.Request["pid"]);

            EmsModel.Building build = new EmsModel.Building();
            build.PID      = pid;
            build.IsDelete = 0;
            //序列化
            System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
            EmsModel.JsonModel mod = new EmsBLL.Building().GetJsonModel(build, startIndex, pageSize);
            //输出Json
            HttpContext.Current.Response.Write(callback + "({\"result\":" + jss.Serialize(mod) + "})");
            HttpContext.Current.Response.End();
        }
Beispiel #3
0
        public void AddBuilding(HttpContext context)
        {
            string callback = context.Request["jsoncallback"];
            string name = context.Request["name"], flag = context.Request["flag"];
            string roomno = context.Request["roomno"];

            EmsBLL.Building bllBuild = new EmsBLL.Building();
            int             result, pid = Convert.ToInt32(context.Request["pid"]);
            bool            isNameEx = flag == "room" ? bllBuild.IsNameExists(roomno, pid, Convert.ToInt32(context.Request["ppid"]), 0) : bllBuild.IsNameExists(name, pid);

            if (isNameEx)
            {
                result = -1;
            }
            else
            {
                EmsModel.Building build = new EmsModel.Building();
                build.Name       = name;
                build.PID        = pid;
                build.Creator    = context.Request["useridcard"];
                build.CreateTime = DateTime.Now;
                build.IsDelete   = 0;
                if (flag == "room")
                {
                    build.RoomNo = roomno;
                    string type = context.Request["type"];
                    build.Type = Convert.ToByte(type);
                    if (type == "1" && !string.IsNullOrEmpty(context.Request["secplace"]))
                    {
                        build.SectionPlaceId = Convert.ToInt32(context.Request["secplace"]);
                    }
                }
                result = bllBuild.Add(build);
            }
            //输出Json
            HttpContext.Current.Response.Write(callback + "({\"result\":" + result + "})");
            HttpContext.Current.Response.End();
        }