static void Main(string[] args) { PartSearchModel p = new PartSearchModel(); IPartServices q = new PartServices("Data Source = (local); Initial Catalog = AgvWarehouseDB; Integrated Security = True"); // IPartServices q = new PartServices("Data Source = 42.121.111.38; Initial Catalog = BlueCarGps; Persist Security Info = True; User ID = bluecargps; Password = bluecargps; Connect Timeout = 150;"); Part a = q.SearchByNr("PN001"); Console.WriteLine(a.BoxType); Console.ReadLine(); }
private void Offbutton_Click(object sender, RoutedEventArgs e) { IPartServices IPS = new PartServices(Properties.Settings.Default.db); IUniqueItemServices IUIS = new UniqueItemServices(Properties.Settings.Default.db); string input_PartNr = PartNrtextBox.Text; string input_UniqueNr = UniqueNrtextBox.Text; if (string.IsNullOrEmpty(input_PartNr)) { MessageBox.Show("零件编号不能为空"); } if (string.IsNullOrEmpty(input_UniqueNr)) { MessageBox.Show("零件唯一吗不能为空"); } Part pak = IPS.SearchByNr(input_PartNr); if (string.IsNullOrEmpty(pak.PartNr)) { MessageBox.Show("该零件不存在"); } UniqueItem UIK = IUIS.SearchByUniqNr(input_UniqueNr); if (UIK != null) { MessageBox.Show("该唯一码已被占用"); } UniqueItem InsertUI = new UniqueItem { PartNr = input_PartNr, UniqNr = input_UniqueNr, CreatedAt = DateTime.Now, State = 0 }; bool IsInsertOk = IUIS.Create(InsertUI); if (IsInsertOk) { string mean = "下线成功"; MessageBox.Show(mean); } else { string mean = "下线失败"; MessageBox.Show(mean); } }
public PartsController() { _partServices = new PartServices(Token); }