예제 #1
0
        public static List <Mat_SupplierListModel> querySupplierForBOM(string type)
        {
            List <Mat_SupplierListModel> list = null;
            string    sql = @"SELECT [ID]
                                      ,[SupplierID]
                                      ,[SupplierName]
                                  FROM [Mat_SupplierList] where WareHouseID=" + type + " order by SupplierID";
            DataTable dt  = SqlHelper.GetDataDataTable(SqlHelper.SqlConnString, System.Data.CommandType.Text, sql, null);

            if (DataHelper.HasData(dt))
            {
                list = new List <Mat_SupplierListModel>();
                foreach (DataRow row in dt.Rows)
                {
                    Mat_SupplierListModel model = new Mat_SupplierListModel();

                    model.supplierid   = NumericParse.StringToInt(DataHelper.GetCellDataToStr(row, "SupplierID"));
                    model.suppliername = DataHelper.GetCellDataToStr(row, "SupplierName");
                    list.Add(model);
                }
                Mat_SupplierListModel firstmodel = new Mat_SupplierListModel();

                firstmodel.supplierid   = 0;
                firstmodel.suppliername = "-- 请选择类型 --";
                list.Insert(0, firstmodel);
            }
            return(list);
        }
예제 #2
0
        public static List <Mat_SupplierListModel> QuerySupplierListForEditing()
        {
            List <Mat_SupplierListModel> list = null;
            string    sql = @"SELECT TOP 1000 [ID]
                                          ,[SupplierID]
                                          ,[SupplierName]
                                          ,[WareHouseID]
                           FROM [Mat_SupplierList]
                           order by ID";
            DataTable dt  = SqlHelper.GetDataDataTable(SqlHelper.SqlConnString, System.Data.CommandType.Text, sql, null);

            if (DataHelper.HasData(dt))
            {
                list = new List <Mat_SupplierListModel>();
                foreach (DataRow row in dt.Rows)
                {
                    Mat_SupplierListModel model = new Mat_SupplierListModel();
                    model.id           = NumericParse.StringToInt(DataHelper.GetCellDataToStr(row, "ID"));
                    model.supplierid   = NumericParse.StringToInt(DataHelper.GetCellDataToStr(row, "SupplierID"));
                    model.suppliername = DataHelper.GetCellDataToStr(row, "SupplierName");
                    model.warehouseid  = NumericParse.StringToInt(DataHelper.GetCellDataToStr(row, "WareHouseID"));
                    list.Add(model);
                }
                Mat_SupplierListModel firstmodel = new Mat_SupplierListModel();
                firstmodel.id           = 0;
                firstmodel.suppliername = "-- 请选择供应商 --";
                list.Insert(0, firstmodel);
            }

            return(list);
        }