public MaterielOutEarningsOrderTable getMaterielOutEarningsOrderInfoFromBillNumber(string billNumber) { MaterielOutEarningsOrderTable record = new MaterielOutEarningsOrderTable(); foreach (KeyValuePair <int, MaterielOutEarningsOrderTable> index in m_tableDataList) { if (index.Value.billNumber == billNumber) { record = index.Value; break; } } return(record); }
public bool checkBillIsExist(string billNumber) { bool isRet = false; foreach (KeyValuePair <int, MaterielOutEarningsOrderTable> index in m_tableDataList) { MaterielOutEarningsOrderTable record = new MaterielOutEarningsOrderTable(); if (index.Value.billNumber == billNumber) { isRet = true; break; } } return(isRet); }
public SortedDictionary <int, MaterielOutEarningsOrderTable> getAllNotReviewMaterielOutEarningsOrderInfo() { SortedDictionary <int, MaterielOutEarningsOrderTable> list = new SortedDictionary <int, MaterielOutEarningsOrderTable>(); foreach (KeyValuePair <int, MaterielOutEarningsOrderTable> index in m_tableDataList) { MaterielOutEarningsOrderTable record = new MaterielOutEarningsOrderTable(); record = index.Value; if (index.Value.isReview != "1") { list.Add(list.Count, index.Value); } } return(list); }
public void insert(MaterielOutEarningsOrderTable record, bool isDisplayMessageBox = true) { MaterielOutEarningsOrderTable oldRecord = new MaterielOutEarningsOrderTable(); string insert = "INSERT INTO [dbo].[WAREHOUSE_MANAGEMENT_OUT_EARNINGS]([TRADING_DATE],[BILL_NUMBER],"; insert += "[SUM_VALUE],[SUM_MONEY],[MAKE_ORDER_STAFF],[STAFF_SAVE_ID],[MATERIEL_STAFF],[IS_RED_BILL]) VALUES("; // 根据单据编号,判断库中是否已经存在该单据 如果存在单据首先删除单据,然后再执行插入操作 if (checkBillIsExist(record.billNumber)) { delete(record.billNumber); } insert += "'" + record.tradingDate + "',"; insert += "'" + record.billNumber + "',"; insert += "'" + record.sumValue + "',"; insert += "'" + record.sumMoney + "',"; insert += record.makeOrderStaff + ","; insert += record.staffSaveId + ","; insert += record.materielOutStaffId + ","; // 红字蓝字标示 insert += record.isRedBill; insert += ")"; try { DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert); if (isDisplayMessageBox) { MessageBoxExtend.messageOK("数据保存成功"); } load(); } catch (Exception error) { MessageBoxExtend.messageWarning(error.Message); return; } writeOperatorLog(305, OperatorLogType.Add, record.billNumber); }
private void load() { string sql = "SELECT [PKEY],[TRADING_DATE],[BILL_NUMBER],[SUM_VALUE],[SUM_MONEY],"; sql += "[MAKE_ORDER_STAFF],[MATERIEL_STAFF],[ORDERR_REVIEW],[REVIEW_DATE],[IS_REVIEW],[STAFF_SAVE_ID],[IS_RED_BILL] "; sql += "FROM [dbo].[WAREHOUSE_MANAGEMENT_OUT_EARNINGS] ORDER BY PKEY"; m_tableDataList.Clear(); using (DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, sql)) { foreach (DataRow row in dataTable.Rows) { MaterielOutEarningsOrderTable record = new MaterielOutEarningsOrderTable(); record.pkey = DbDataConvert.ToInt32(row["PKEY"]); record.tradingDate = DbDataConvert.ToDateTime(row["TRADING_DATE"]).ToString("yyyy-MM-dd"); record.billNumber = DbDataConvert.ToString(row["BILL_NUMBER"]); record.sumValue = DbDataConvert.ToString(row["SUM_VALUE"]); record.sumMoney = DbDataConvert.ToString(row["SUM_MONEY"]); record.staffSaveId = DbDataConvert.ToInt32(row["STAFF_SAVE_ID"]); record.staffSaveName = Staff.getInctance().getStaffNameFromPkey(record.staffSaveId); record.materielOutStaffId = DbDataConvert.ToInt32(row["MATERIEL_STAFF"]); record.materielOutStaffName = Staff.getInctance().getStaffNameFromPkey(record.materielOutStaffId); record.makeOrderStaff = DbDataConvert.ToInt32(row["MAKE_ORDER_STAFF"]); record.makeOrderStaffName = Staff.getInctance().getStaffNameFromPkey(record.makeOrderStaff); record.isReview = DbDataConvert.ToString(row["IS_REVIEW"]); if (DbDataConvert.ToString(row["ORDERR_REVIEW"]).Length > 0) { record.orderrReview = DbDataConvert.ToInt32(row["ORDERR_REVIEW"]); record.orderrReviewName = Staff.getInctance().getStaffNameFromPkey(record.orderrReview); record.reviewDate = DbDataConvert.ToDateTime(row["REVIEW_DATE"]).ToString("yyyy-MM-dd"); } record.isRedBill = DbDataConvert.ToInt32(row["IS_RED_BILL"]); m_tableDataList.Add(m_tableDataList.Count, record); } } }