Пример #1
0
        public Model.MessageShow EditSaveMethod(Model.Rfid_tag data)
        {
            MessageShow msg = new MessageShow();

            if (data.Id <= 0)//The current user already exists
            {
                if (this.SqlCount(string.Format("SELECT COUNT(1) FROM Rfid_tag WHERE Code='{0}'", data.Code), null) > 0)
                {
                    msg.success = false;
                    msg.message = "此标签已存在";
                }
                else
                {
                    string insertStr = "INSERT INTO Rfid_tag(code,empty_pt,actived,created) VALUES(@Code,@Empty_pt,@Actived,@Created)";
                    msg.success = this.SqlExecute <int>(insertStr, data) > 0;
                    msg.message = msg.success ? "添加成功" : "添加失败";
                }
            }
            else
            {
                msg.success = this.SqlExecute <int>("UPDATE Rfid_tag SET code=@Code,empty_pt=@Empty_pt,actived=@Actived,created=@Created WHERE id=@Id", data) > 0;
                msg.message = msg.success ? "编辑成功" : "编辑失败";
            }
            return(msg);
        }
Пример #2
0
 public Model.MessageShow EditSaveMethod(Model.Rfid_tag data)
 {
     return(dal.EditSaveMethod(data));
 }