Esempio n. 1
0
        public static YKBoxInfo GetBoxByHu(string hu)
        {
            string    sql    = string.Format(@"SELECT * FROM dbo.YKBox WHERE Hu = '{0}' AND Status = 'S' 
SELECT * FROM dbo.YKBoxDetail WHERE Hu = '{0}'", hu);
            DataSet   ds     = DBHelper.GetDataSet(sql, false);
            YKBoxInfo result = null;

            if (ds?.Tables?.Count == 2)
            {
                DataTable dtMain   = ds.Tables[0];
                DataTable dtDetail = ds.Tables[1];
                if (dtMain.Rows.Count > 0)
                {
                    result = YKBoxInfo.BuildBoxInfo(dtMain.Rows[0]);
                    if (dtDetail.Rows.Count > 0)
                    {
                        foreach (DataRow row in dtDetail.Rows)
                        {
                            result.Details.Add(YKBoxDetailInfo.BuildBoxDetailInfo(row));
                        }
                    }
                }
            }
            return(result);
        }
Esempio n. 2
0
        public static List <YKBoxInfo> GetUnHandoverBoxList(string device)
        {
            List <YKBoxInfo> result = new List <YKBoxInfo>();
            string           sql    = string.Format(@"SELECT * FROM dbo.YKBox WHERE EquipXindeco = '{0}' AND IsHandover = 0 AND Status='S'
SELECT * FROM dbo.YKBoxDetail WHERE Hu IN (SELECT Hu FROM dbo.YKBox WHERE EquipXindeco = '{0}' AND IsHandover = 0 AND Status='S')
", device);
            DataSet          ds     = DBHelper.GetDataSet(sql, false);

            if (ds != null && ds.Tables.Count == 2)
            {
                result = new List <YKBoxInfo>();
                DataTable dtBox    = ds.Tables[0];
                DataTable dtDetail = ds.Tables[1];
                if (dtBox != null && dtBox.Rows.Count > 0)
                {
                    foreach (DataRow row in dtBox.Rows)
                    {
                        YKBoxInfo item       = YKBoxInfo.BuildBoxInfo(row);
                        DataRow[] rowsDetail = dtDetail.Select(string.Format("Hu ='{0}'", item.Hu));
                        if (rowsDetail.Length > 0)
                        {
                            foreach (DataRow rowdetail in rowsDetail)
                            {
                                YKBoxDetailInfo detail = YKBoxDetailInfo.BuildBoxDetailInfo(rowdetail);
                                item.Details.Add(detail);
                            }
                        }
                        result.Add(item);
                    }
                }
            }
            return(result);
        }