public string GetIndex(PartItem partItem) { return(Stammer.Stamm(partItem.PartNumber) + @" " + String.Join(" ", partItem.Name.Split(' ').Select(Stammer.Stamm)) + @" " + Stammer.Stamm(partItem.Brand) + @" " + String.Join(@" ", partItem.Analogs.Split(' ').Select(Stammer.Stamm))); }
public static ImportIdentificator SearchImportInfo(PartItem partItem) { using (var context = new Context()) { return(context.ImportIdentificators.FirstOrDefault(i => i.Id == partItem.ImportIdentificatorId)); } }
public PartItemViewModel(PartItem item) { Name = item.Name; Balance = item.Balance; Brand = item.Brand; Commentary = item.Commentary; PartNumber = item.PartNumber; Price = item.Price; PartItem = item; }
private PartItem GetCameraItem() { PartItem item = null; if (m_lCameraCache.Count > 0) { item = m_lCameraCache[0]; m_lCameraCache.Remove(item); } else { var obj = GameObject.Instantiate(DataManager.GetInstance().CameraObj) as GameObject; item = obj.GetComponent <PartItem>(); } m_lCameraItemList.Add(item); item.SetState(true); return(item); }
public PartItem BuildFrom(CatalogImportItem item) { var analogs = String.Join(" ", item.Analogs.Select(a => a.Replace(" ", ""))); var partItem = new PartItem() { Balance = item.Balance, Brand = item.Brand, Commentary = item.Commentary, Name = item.Name, Price = item.Price, PartNumber = item.PartNumber, StammedPartNumber = Stammer.Stamm(item.PartNumber), SourceArgument = item.SourceArgument, Analogs = analogs }; partItem.SearchString = IndexFormatter.GetIndex(partItem); return(partItem); }
private string GetDefaultSearchProperty(PartItem partItem) { return(partItem.PartNumber + " " + partItem.SearchString); }
void StartToDownPicture(string WebPath) { System.Net.WebClient WC = new System.Net.WebClient(); //取得圖片名稱 string[] filenames = WebPath.Split('?'); string filename = ""; foreach (string PartItem in filenames) { bool testhave = PartItem.Contains(".jpg"); if (testhave) { char[] cut = { '/' }; string[] cutnames = PartItem.Split(cut); filename = cutnames.Last(); } } string errorstring = ""; try { System.IO.MemoryStream Ms = new System.IO.MemoryStream(WC.DownloadData(WebPath)); Image img = Image.FromStream(Ms); var test = img.Tag; if (pathtext == "")//沒有下載地址 { //FolderBrowserDialog path = new FolderBrowserDialog(); //path.ShowDialog(); //pathtext = path.SelectedPath; if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { pathtext = folderBrowserDialog1.SelectedPath; } else { pathtext = "cancel"; } } if (pathtext != "cancel") { //下載檔案 if (pathtext != "" && filename != "") { string willsavepath = string.Format("{0}\\{1}", pathtext, filename); errorstring = willsavepath; int time = 0; SaveFileVoid(time, willsavepath, img); } else { error = "Can't find txt name."; } } } catch (Exception) { Console.WriteLine(string.Format("無法下載:{0}", errorstring)); error = "It's not picture. Can't download."; } }
public static List <PartItem> GetPartsFromIds(string[] partIds) { List <PartItem> parts = new List <PartItem>(); var connectionString = Environment.GetEnvironmentVariable("DatabaseConnectionString"); string queryString = "SELECT CurrencyCode, ListUnitPrice, PartNumber, LeadTime, SupplierName, Description " + "FROM [dbo].[MasterPriceList] " + "WHERE PartNumber = @partId"; foreach (var partId in partIds) { var id = partId.Trim(); // check id is 6 digit number else skip if (Regex.IsMatch(id, "^[0-9]{6,6}$")) { using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(queryString, connection); command.Parameters.AddWithValue("@partId", partId.Trim()); connection.Open(); SqlDataReader reader = command.ExecuteReader(); try { while (reader.Read()) { var part = new PartItem { CurrencyCode = reader["CurrencyCode"].ToString(), PartNumber = reader["PartNumber"].ToString(), ListUnitPrice = float.Parse(reader["ListUnitPrice"].ToString()), SupplierName = reader["SupplierName"].ToString(), Decription = reader["Description"].ToString() }; double leadTime = 0; if (float.TryParse(reader["LeadTime"].ToString(), out float parsed)) { leadTime = parsed; } part.LeadTime = leadTime; parts.Add(part); } } finally { // Always call Close when done reading. reader.Close(); } } } } return(parts); }