示例#1
0
        public void UpdatReqdoc(ReqDocs rd)
        {
            ReqDocsC r = new ReqDocsC();

            r.deleteDB(rd.Id);
            r.insertDB(rd);
        }
示例#2
0
        public List <ReqDocs> ListsOfReqDocs(string id)
        {
            List <ReqDocs> l = new List <ReqDocs>();

            while (con.State == ConnectionState.Open)
            {
                System.Threading.Thread.Sleep(500);
            }
            con.Open();
            MySqlCommand cmd = con.CreateCommand();

            cmd.CommandText = "select * from ReqDocs where clientId=@id";
            cmd.Parameters.AddWithValue("@id", id);
            MySqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ReqDocs rd = new ReqDocs();
                rd.Id       = Convert.ToInt32(reader[0].ToString());
                rd.clientId = reader[1].ToString();
                rd.kind     = reader[2].ToString();
                rd.comment  = reader[3].ToString();
                l.Add(rd);
            }
            con.Close();
            return(l);
        }
示例#3
0
        public void addNewReqDoc(ReqDocs r)
        {
            ReqDocsC inter = new ReqDocsC();

            inter.insertDB(r);
            ClientC inter1 = new ClientC();
            Client  c      = inter1.FindClient(r.clientId);

            if (!c.Request)
            {
                c.Request = true;
                inter1.UpdateClient(c);
            }
            inter.insertDB(r);
        }
示例#4
0
        public void insertDB(ReqDocs r)
        {
            r.Id = getId();
            while (con.State == ConnectionState.Open)
            {
                System.Threading.Thread.Sleep(500);
            }
            con.Open();
            string       query1 = "INSERT INTO ReqDocs (Id,clientId,kind,comment) VALUES (@Id,@clientId,@kind,@comment)";
            MySqlCommand cmd    = new MySqlCommand(query1, con);

            cmd.Parameters.AddWithValue("@Id", r.Id);
            cmd.Parameters.AddWithValue("@clientId", r.clientId);
            cmd.Parameters.AddWithValue("@kind", r.kind);
            cmd.Parameters.AddWithValue("@comment", r.comment);
            cmd.ExecuteNonQuery();
            con.Close();
        }