Esempio n. 1
0
        /*--------------删除人员-----------*/
        public CommonOutput deleteUser(string id)
        {
            RDDataContext rd         = new RDDataContext();
            CommonOutput  returnData = new CommonOutput();

            if (!string.IsNullOrEmpty(id))
            {
                var thisguy = rd.user.SingleOrDefault(c => c.id == id);
                if (thisguy != null)
                {
                    rd.user.DeleteOnSubmit(thisguy);
                }
                rd.SubmitChanges();
                rd.Dispose();
                returnData.success = true;
                returnData.message = "success";
                rd.Dispose(); return(returnData);
            }
            else
            {
                rd.Dispose();
                returnData.success = false;
                returnData.message = "未选中信息";
                rd.Dispose(); return(returnData);
            }
        }
Esempio n. 2
0
        /*--------------编辑人员信息-----------*/
        public CommonOutput editUser(string id, string name, string password, string IC, string face, string phone, string number, string groupNum, string department)
        {
            RDDataContext rd         = new RDDataContext();
            CommonOutput  returnData = new CommonOutput();

            if (!string.IsNullOrEmpty(name))
            {
                var x = rd.user.SingleOrDefault(c => c.id == id);
                x.department = department;
                x.groupNum   = groupNum;
                x.number     = number;
                x.phone      = phone;
                x.face       = face;
                x.IC         = IC;
                x.password   = password;
                x.name       = name;
                rd.SubmitChanges();
                returnData.success = true;
                returnData.message = "success";
                rd.Dispose(); return(returnData);
            }
            else
            {
                returnData.success = false;
                returnData.message = "字典类型不能为空";
                rd.Dispose(); return(returnData);
            }
        }
Esempio n. 3
0
        /*--------------添加-----------*/
        public CommonOutput addToolsPosition(string layer, string seat, string isok)
        {
            RDDataContext rd         = new RDDataContext();
            CommonOutput  returnData = new CommonOutput();

            if ((!string.IsNullOrEmpty(layer) && !string.IsNullOrEmpty(seat)) || !string.IsNullOrEmpty(isok))
            {
                deviceState x = new deviceState();

                x.id       = Guid.NewGuid().ToString();
                x.layerNum = layer;
                x.seatNum  = seat;
                x.isok     = isok;
                rd.deviceState.InsertOnSubmit(x);
                rd.SubmitChanges();
                returnData.success = true;
                returnData.message = "success";
                rd.Dispose(); return(returnData);
            }
            else
            {
                returnData.success = false;
                returnData.message = "用户信息不全!";
                rd.Dispose(); return(returnData);
            }
        }
Esempio n. 4
0
        /*--------------添加用户-----------*/
        public CommonOutput addUser(string name, string password, string IC, string face, string phone, string number, string groupNum, string department)
        {
            RDDataContext rd         = new RDDataContext();
            CommonOutput  returnData = new CommonOutput();

            if ((!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(password)) || !string.IsNullOrEmpty(password))
            {
                user x = new user();

                x.id         = Guid.NewGuid().ToString();
                x.department = department;
                x.groupNum   = groupNum;
                x.number     = number;
                x.phone      = phone;
                x.face       = face;
                x.IC         = IC;
                x.password   = password;
                x.name       = name;
                rd.user.InsertOnSubmit(x);
                rd.SubmitChanges();
                returnData.success = true;
                returnData.message = "success";
                rd.Dispose(); return(returnData);
            }
            else
            {
                returnData.success = false;
                returnData.message = "用户信息不全!";
                rd.Dispose(); return(returnData);
            }
        }
Esempio n. 5
0
        /*--------------编辑-----------*/
        public CommonOutput editDevice(string id, string IP, string name, string mask, string gate, string type, string size, string Num, string model, string note, string layer, string seats, string limitTIme, string hostName, string IPVersion, string DNS)
        {
            RDDataContext rd         = new RDDataContext();
            CommonOutput  returnData = new CommonOutput();

            if ((!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(Num)) || !string.IsNullOrEmpty(size))
            {
                var x = rd.device.SingleOrDefault(c => c.id == id);
                x.IP        = IP;
                x.name      = name;
                x.mask      = mask;
                x.gate      = gate;
                x.type      = type;
                x.size      = size;
                x.Num       = Num;
                x.model     = model;
                x.note      = note;
                x.layer     = layer;
                x.seats     = seats;
                x.limitTIme = limitTIme;
                x.hostName  = hostName;
                x.IPVersion = IPVersion;
                x.DNS       = DNS;
                rd.SubmitChanges();
                returnData.success = true;
                returnData.message = "success";
                rd.Dispose(); return(returnData);
            }
            else
            {
                returnData.success = false;
                returnData.message = "用户信息不全!";
                rd.Dispose(); return(returnData);
            }
        }