public static void UpdateItem(string name, float avgprice, float refprice, float lowprice, float highprice, DateTime updatetime, string FWQ, int formula) { using (DBGoblinWOW dc = new DBGoblinWOW(Constant.CONNSTR)) { try { DBItem tar = dc.Item.Single(d => d.name == name && d.FWQ == FWQ); if (tar != null) { tar.avgprice = avgprice; tar.refprice = refprice; tar.lowprice = lowprice; tar.highprice = highprice; tar.formula = formula; } else { tar.avgprice = 0; tar.refprice = 0; tar.lowprice = 0; tar.highprice = 0; tar.formula = Constant.FORMULAUNKNOWN; } tar.updatetime = updatetime; dc.SubmitChanges(); } catch (Exception ex) { } } }
public static float GetAvgPrice(string name, string FWQ) { float avg = 0; using (DBGoblinWOW dc = new DBGoblinWOW(Constant.CONNSTR)) { try { var rst = from data in dc.ItemInSale where data.name == name && data.FWQ == FWQ select data; foreach (DBItemInSale cur in rst) { avg = cur.avgprice; break; } } catch (Exception ex) { } } return(avg); }
public static void Add(string name, string FWQ) { using (DBGoblinWOW dc = new DBGoblinWOW(Constant.CONNSTR)) { try { var rst = from data in dc.Item where data.name == name && data.FWQ == FWQ select data; if (rst.Count() > 0) { Exception ex = new Exception("物品已存在"); throw (ex); } DBItem item = new DBItem(); item.name = name; item.FWQ = FWQ; item.updatetime = System.DateTime.Now; dc.Item.InsertOnSubmit(item); dc.SubmitChanges(); } catch (Exception ex) { throw(ex); } } }
public static void Add(string name, string FWQ) { using (DBGoblinWOW dc = new DBGoblinWOW(Constant.CONNSTR)) { try { DBItemInSale item = new DBItemInSale(); item.name = name; item.FWQ = FWQ; dc.ItemInSale.InsertOnSubmit(item); dc.SubmitChanges(); } catch (Exception ex) { throw (ex); } } }
public static List <DBFormula> GetFormulaByOutputAndType(string output, int type) { List <DBFormula> ret = new List <DBFormula>(); using (DBGoblinWOW dc = new DBGoblinWOW(Constant.CONNSTR)) { try { var rst = from data in dc.Formula where data.output == output && data.type == type select data; foreach (DBFormula cur in rst) { ret.Add(cur); } } catch (Exception ex) { } } return(ret); }
public static List <DBItemInSale> GetItemInSaleByName(string name, string FWQ) { List <DBItemInSale> ret = new List <DBItemInSale>(); using (DBGoblinWOW dc = new DBGoblinWOW(Constant.CONNSTR)) { try { var rst = from data in dc.ItemInSale where data.name == name && data.FWQ == FWQ select data; foreach (DBItemInSale cur in rst) { ret.Add(cur); } } catch (Exception ex) { } } return(ret); }
public static DBItem GetItemByName(string name, string FWQ) { DBItem ret = new DBItem(); using (DBGoblinWOW dc = new DBGoblinWOW(Constant.CONNSTR)) { try { var rst = from data in dc.Item where data.name == name && data.FWQ == FWQ select data; foreach (DBItem cur in rst) { ret = cur; break; } } catch (Exception ex) { } } return(ret); }