public DataSet QueryByBillNo(string BillNo) { using (PersistentManager persistentManager = new PersistentManager()) { DeliveryBillMasterDao dao = new DeliveryBillMasterDao(); string sql = string.Format("select {0} from {1} WHERE BILLNO='{2}'", strQueryFields, strTableView, BillNo); return(dao.GetData(sql)); } }
public string GetNewBillNo() { using (PersistentManager persistentManager = new PersistentManager()) { DeliveryBillMasterDao dao = new DeliveryBillMasterDao(); DataSet ds = dao.GetData(string.Format("select TOP 1 BILLNO FROM WMS_OUT_BILLMASTER where BILLNO LIKE '{0}%' order by BILLNO DESC", System.DateTime.Now.ToString("yyMMdd"))); if (ds.Tables[0].Rows.Count == 0) { return(System.DateTime.Now.ToString("yyMMdd") + "0001" + "D"); } else { int i = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString().Substring(6, 4)); i++; string newcode = i.ToString(); for (int j = 0; j < 4 - i.ToString().Length; j++) { newcode = "0" + newcode; } return(System.DateTime.Now.ToString("yyMMdd") + newcode + "D"); } } }