/// <summary> /// 添加网络订单明细 /// </summary> /// <param name="webOrderFormList">网络订单信息</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>添加成功返回True,添加失败返回False</returns> public bool AddBill(B_WebForOrderFormList webOrderFormList, out string error) { try { error = null; DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.B_WebForOrderFormList where a.GoodsID == webOrderFormList.GoodsID && a.Provider == webOrderFormList.Provider && a.Ny == webOrderFormList.Ny select a; if (varData.Count() > 0) { error = "此记录已存在,不可重复录入"; return(false); } else { dataContext.B_WebForOrderFormList.InsertOnSubmit(webOrderFormList); dataContext.SubmitChanges(); } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 修改网络订单明细 /// </summary> /// <param name="webOrderFormList">网络订单明细信息</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>修改成功返回True,修改失败返回False</returns> public bool UpdateListInfo(B_WebForOrderFormList webOrderFormList, out string error) { try { error = null; DepotManagementDataContext dataContext = CommentParameter.DepotDataContext; var varData = from a in dataContext.B_WebForOrderFormList where a.ID == Convert.ToInt32(webOrderFormList.ID) select a; if (varData.Count() != 1) { error = "数据不唯一或者为空"; return(false); } else { B_WebForOrderFormList lnqWebForOrderForm = varData.Single(); lnqWebForOrderForm.BargainNumber = webOrderFormList.BargainNumber; lnqWebForOrderForm.CheckPersonnel = webOrderFormList.CheckPersonnel; lnqWebForOrderForm.GoodsID = webOrderFormList.GoodsID; lnqWebForOrderForm.OrderFormCount = webOrderFormList.OrderFormCount; lnqWebForOrderForm.OrderFormNumber = webOrderFormList.OrderFormNumber; lnqWebForOrderForm.Provider = webOrderFormList.Provider; lnqWebForOrderForm.StockCount = webOrderFormList.StockCount; lnqWebForOrderForm.ChangeFlag = webOrderFormList.ChangeFlag; dataContext.SubmitChanges(); } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }