Esempio n. 1
0
        public bool addList(List <RecordDetail> list)
        {
            string query_string  = "insert into `t_record_detail` (`id`, `recordId`, `index`, `testValue`, `torqueValue`, `difference`, `percent`, `result`, `standard`, `upper`, `lower`,`manualwritevalue`) VALUES ";
            string query_string1 = "";

            for (int i = 0; i < list.Count; i++)
            {
                string uuid = Guid.NewGuid().ToString("N");
                query_string1 = query_string + "('" + uuid
                                + "','" + list[i].RecordId
                                + "','" + list[i].Index.ToString()
                                + "','" + list[i].TestValue.ToString()
                                + "','" + list[i].TorqueValue.ToString()
                                + "','" + list[i].Difference.ToString()
                                + "','" + list[i].Percent.ToString()
                                + "','" + list[i].Result.ToString()
                                + "','" + list[i].Standard.ToString()
                                + "','" + list[i].Upper.ToString()
                                + "','" + list[i].Lower.ToString()
                                + "','" + list[i].ManualWriteValue.ToString() + "')"
                                + ";";
                MysqlTool.addData(query_string1);
            }
            //query_string = query_string.Remove(query_string.Length - 1);

            return(true);//;MysqlTool.addData(query_string);
        }
Esempio n. 2
0
        public static bool UpdateUdpEndPoint(string ip, int port, string uid)
        {
            var sql = $"update userinfo set udpip='{ip}',udp_port={port},create_date='{DateTime.Now}' where id={uid}";
            var ret = MysqlTool.ExecuteNonQuery(sql);

            return(ret > 0);
        }
Esempio n. 3
0
        public List <Record> selectListByAll(string id, string seriesNum, string operatorName, DateTime startTime, DateTime endTime)
        {
            string query_string = "SELECT * from `t_record` where isDel=0";

            if (id != "")
            {
                query_string = query_string + " and id='" + id + "'";
            }
            if (operatorName != "")
            {
                query_string = query_string + " and operator='" + operatorName + "'";
            }
            if (seriesNum != "")
            {
                query_string = query_string + " and seriesNum='" + seriesNum + "'";
            }
            if (startTime.Year != 1)
            {
                query_string = query_string + " and createTime>='" + startTime.ToString("yyyy-MM-dd HH:mm:ss") + "'";
            }
            if (endTime.Year != 1)
            {
                query_string = query_string + " and createTime<='" + endTime.ToString("yyyy-MM-dd HH:mm:ss") + "'";
            }
            DataTable dt = MysqlTool.queryData(query_string, new MySqlParameter[] {
                new MySqlParameter()
            });
            List <Record> ls = MysqlTool.toList <Record>(dt);

            return(ls.Count > 0 ? ls : null);
        }
Esempio n. 4
0
        public static DataTable GetUserOnline()
        {
            string sql = "select * from userinfo where login_state=1";

            DataTable dt = MysqlTool.ExecuteDataTable(sql);

            return(dt);
        }
Esempio n. 5
0
        public bool updateStatus(string id, int status)
        {
            string query_string = "UPDATE `t_borrow` SET `status`=@status WHERE `id`=@id";

            return(MysqlTool.updateData(query_string, new MySqlParameter[] {
                new MySqlParameter("@id", id),
                new MySqlParameter("@status", status)
            }));
        }
        public bool updateOne(Technology one)
        {
            string query_string = "UPDATE `t_technology` SET `mode`=@mode WHERE `id`=@id";

            return(MysqlTool.updateData(query_string, new MySqlParameter[] {
                new MySqlParameter("@id", one.Id),
                new MySqlParameter("@mode", one.Mode)
            }));
        }
Esempio n. 7
0
        public List <RecordDetail> selectListByRecordId(string recordId)
        {
            string    query_string = "SELECT * from `t_record_detail` where recordId=@recordId and isDel=0 order by `index`";
            DataTable dt           = MysqlTool.queryData(query_string, new MySqlParameter[] {
                new MySqlParameter("@recordId", recordId)
            });
            List <RecordDetail> ls = MysqlTool.toList <RecordDetail>(dt);

            return(ls.Count > 0 ? ls : null);
        }
Esempio n. 8
0
        public bool addOne(BorrowRecord one)
        {
            string query_string = "INSERT INTO `t_borrow` (`id`, `seriesNum`, `operator`, `status`) VALUES (@id, @seriesNum, @operator, @status)";

            return(MysqlTool.addData(query_string, new MySqlParameter[] {
                new MySqlParameter("@id", one.Id),
                new MySqlParameter("@seriesNum", one.SeriesNum),
                new MySqlParameter("@operator", one.Operator),
                new MySqlParameter("@status", one.Status)
            }));
        }
        public bool addOne(Technology one)
        {
            string query_string = "INSERT INTO `t_technology` (`id`, `mode`, `version`, `proId`) VALUES (@id, @mode, @version, @proId)";

            return(MysqlTool.addData(query_string, new MySqlParameter[] {
                new MySqlParameter("@id", one.Id),
                new MySqlParameter("@mode", one.Mode),
                new MySqlParameter("@version", one.Version),
                new MySqlParameter("@proId", one.ProId)
            }));
        }
Esempio n. 10
0
        public static bool UpdateLoginState(int loginState)
        {
            var sql   = "update userinfo set login_state=@login_state";
            var param = new MySqlParameter[1]
            {
                new MySqlParameter("login_state", loginState),
            };
            var ret = MysqlTool.ExecuteNonQuery(sql, param);

            return(ret > 0);
        }
Esempio n. 11
0
        public static DataTable GetUser(string username)
        {
            string sql = "select * from userinfo where username=@username";

            MySqlParameter[] param = new MySqlParameter[1];
            param[0] = new MySqlParameter("username", username);

            DataTable dt = MysqlTool.ExecuteDataTable(sql, param);

            return(dt);
        }
Esempio n. 12
0
        public static bool Add(UserInfoModel model, int loginState = 0)
        {
            var sql   = "insert into userinfo(username,userpass,nickname,login_state) values(@username,@userpass,@nickname,@loginState)";
            var param = new MySqlParameter[4];

            param[0] = new MySqlParameter("username", model.username);
            param[1] = new MySqlParameter("userpass", model.userpass);
            param[2] = new MySqlParameter("nickname", model.nickname);
            param[3] = new MySqlParameter("loginState", loginState);
            var ret = MysqlTool.ExecuteNonQuery(sql, param);

            return(ret > 0);
        }
Esempio n. 13
0
        public bool addOne(Record one)
        {
            string query_string = "INSERT INTO `t_record` (`id`, `seriesNum`, `proName`, `mode`, `result`, `operator`) VALUES (@id, @seriesNum, @proName, @mode, @result, @operator)";

            return(MysqlTool.addData(query_string, new MySqlParameter[] {
                new MySqlParameter("@id", one.Id),
                new MySqlParameter("@seriesNum", one.SeriesNum),
                new MySqlParameter("@proName", one.ProName),
                new MySqlParameter("@mode", one.Mode),
                new MySqlParameter("@result", one.Result),
                new MySqlParameter("@operator", one.Operator)
            }));
        }
Esempio n. 14
0
        private static bool IsExist <T>(Expression <Func <T, bool> > expression, MySqlParameter[] param) where T : UserInfoModel
        {
            string where = ExpressionTransform.DealExpress(expression);
            string sql = $"select count(1) from userinfo where {where}";
            var    dt  = MysqlTool.ExecuteDataTable(sql, param);

            if (dt != null && dt.Rows.Count > 0)
            {
                var total = int.Parse(dt.Rows[0][0].ToString());
                if (total > 0)
                {
                    return(true);
                }
            }
            return(false);
        }
        public Technology selectOne(string id)
        {
            string    query_string = "SELECT `id`, `mode`, `version`,`proId` FROM t_technology WHERE id=@id and isDel=0";
            DataTable dt           = MysqlTool.queryData(query_string, new MySqlParameter[] {
                new MySqlParameter("@id", id)
            });
            Technology tech = null;

            if (dt.Rows.Count > 0)
            {
                tech = new Technology(dt.Rows[0]["id"].ToString(),
                                      Int32.Parse(dt.Rows[0]["mode"].ToString()),
                                      dt.Rows[0]["version"].ToString(),
                                      dt.Rows[0]["proId"].ToString());
            }
            return(tech);
        }
        public Technology selectOneByProductId(string productId)
        {
            string    query_string = "SELECT * FROM t_technology WHERE id = ( SELECT techId FROM `t_product` WHERE id = @id and isDel=0) and isDel=0";
            DataTable dt           = MysqlTool.queryData(query_string, new MySqlParameter[] {
                new MySqlParameter("@id", productId)
            });
            Technology tech = null;

            if (dt.Rows.Count > 0)
            {
                tech = new Technology(dt.Rows[0]["id"].ToString(),
                                      Int32.Parse(dt.Rows[0]["mode"].ToString()),
                                      dt.Rows[0]["version"].ToString(),
                                      dt.Rows[0]["proId"].ToString());
            }
            return(tech);
        }
Esempio n. 17
0
        public static UserInfoModel GetModel(int id)
        {
            string sql = "select * from userinfo where id=@id";

            MySqlParameter[] param = new MySqlParameter[1];
            param[0] = new MySqlParameter("id", id);

            DataTable dt = MysqlTool.ExecuteDataTable(sql, param);

            if (dt != null && dt.Rows.Count > 0)
            {
                var dataJson = JsonConvert.SerializeObject(dt);
                var model    = JsonConvert.DeserializeObject <List <UserInfoModel> >(dataJson);
                return(model[0]);
            }
            return(null);
        }
Esempio n. 18
0
        public static UserInfoModel GetModel(string username, string pass)
        {
            string sql = "select * from userinfo where username=@username and userpass=@pass";

            MySqlParameter[] param = new MySqlParameter[2];
            param[0] = new MySqlParameter("username", username);
            param[1] = new MySqlParameter("pass", pass.Replace(" ", "+"));

            DataTable dt = MysqlTool.ExecuteDataTable(sql, param);

            if (dt != null && dt.Rows.Count > 0)
            {
                var dataJson = JsonConvert.SerializeObject(dt);
                var model    = JsonConvert.DeserializeObject <List <UserInfoModel> >(dataJson);
                return(model[0]);
            }
            return(null);
        }
Esempio n. 19
0
        public List <string> selectUserNameList(DateTime startTime, DateTime endTime)
        {
            string query_string = "SELECT distinct operator from `t_record` where isDel=0";

            if (startTime.Year != 1)
            {
                query_string = query_string + " and createTime>='" + startTime.ToString("yyyy-MM-dd HH:mm:ss") + "'";
            }
            if (endTime.Year != 1)
            {
                query_string = query_string + " and createTime<='" + endTime.ToString("yyyy-MM-dd HH:mm:ss") + "'";
            }
            DataTable dt = MysqlTool.queryData(query_string, new MySqlParameter[] {
                new MySqlParameter()
            });
            List <string> ls = new List <string>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ls.Add(dt.Rows[i]["operator"].ToString());
            }
            return(ls.Count > 0 ? ls : null);
        }