コード例 #1
0
        /// <summary>
        /// 将服务器已经不存在,本地存在的数据Scode放入Removescode集合
        /// </summary>
        public void GetDeleteClientDataList()
        {
            SCODE Scode = GetServerClientSCODE();

            if (Scode.ServerSCODE.Count > 0)
            {
                foreach (string scode in Scode.ClientSCODE)
                {
                    if (!Scode.ServerSCODE.Contains(scode))
                    {
                        RemoveClientScodeList.Add(scode);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 得到被实例化服务器和本地数据库的SCODE集合的SCODE对象
        /// </summary>
        /// <returns></returns>
        private SCODE GetServerClientSCODE()
        {
            SCODE scode = new SCODE();

            try
            {
                SqlCommand cmd = new SqlCommand();
                using (SqlConnection conn = new SqlConnection(ClientConnStr))
                {
                    conn.Open();
                    cmd.CommandText = "select Scode from productsourcestock where Vencode='" + SourceCode + "'";
                    cmd.Connection  = conn;
                    SqlDataReader reader = cmd.ExecuteReader();
                    List <string> cli    = new List <string>();
                    while (reader.Read())
                    {
                        cli.Add(reader["Scode"].ToString());
                    }
                    scode.ClientSCODE = cli;
                }
                // //using (SqlConnection conns = new SqlConnection("server=" + Server + ";database=" + Database + ";uid=" + Uid + ";pwd=" + Pwd))
                // //{
                // SqlConnection conns = new SqlConnection("server=" + Server + ";database=" + Database + ";uid=" + Uid + ";pwd=" + Pwd);
                // conns.Open();
                // cmd.CommandText = "select SCODE from STOCK_VIEW";
                // //cmd.Connection = conns;
                // SqlDataReader readers = cmd.ExecuteReader();
                // List<string> sli = new List<string>();
                // while (readers.Read())
                // {
                //     sli.Add(readers["SCODE"].ToString());
                // }
                // scode.ServerSCODE = sli;
                //// }
                scode.ServerSCODE = GetServerScode();
                return(scode);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }