/// <summary> /// 操作流水 /// </summary> /// <returns></returns> /// #region public static decimal getSerialNo() { decimal dSerialNo = 0; SeqSerialNo serial = new SeqSerialNo(); serial.cnvcFill = "0"; dSerialNo = EntityMapping.Create(serial); return(dSerialNo); }
public void LoginLog(OperLogin login) { try { conn = ConnectionPool.BorrowConnection(); trans = conn.BeginTransaction(); string strHostName = Environment.MachineName; IPHostEntry oIPHost = Dns.GetHostEntry(Environment.MachineName);//Dns.Resolve(Environment.MachineName); string strHostIP = ""; if (oIPHost.AddressList.Length > 0) { strHostIP = oIPHost.AddressList[0].ToString(); } login.cnvcHostName = strHostName; login.cnvcHostAddress = strHostIP; SeqSerialNo serialNo = new SeqSerialNo(); serialNo.cnvcFill = "0"; login.cnnSerialNp = EntityMapping.Create(serialNo, trans); EntityMapping.Create(login, trans); //折扣上限 trans.Commit(); } catch (BusinessException bex) //业务异常 { trans.Rollback(); //LogAdapter.WriteBusinessException(bex); throw new BusinessException(bex.Type, bex.Message); } catch (SqlException sex) //数据库异常 { //事务回滚 trans.Rollback(); //LogAdapter.WriteDatabaseException(sex); throw new BusinessException("数据库异常", sex.Message); } catch (Exception ex) //其他异常 { //事务回滚 trans.Rollback(); //LogAdapter.WriteFeaturesException(ex); throw new BusinessException("其它异常", ex.Message); } finally { ConnectionPool.ReturnConnection(conn); } }
public string OperCardCallBack(string strOperName) { string strRet3 = ""; try { conn = ConnectionPool.BorrowConnection(); trans = conn.BeginTransaction(); CardM1 m1 = new CardM1(); string strCardNo = ""; string strRet = m1.ReadCard(out strCardNo); //,out dtemp,out itemp); if (strRet != ConstMsg.RFOK) { strRet3 += " 读卡失败"; } DataTable dtOper = SqlHelper.ExecuteDataTable(trans, CommandType.Text, "select * from tbOper where cnvcCardNo is not null and cnvcCardNo='" + strCardNo + "'"); if (dtOper.Rows.Count == 0) { strRet3 += " 操作员不存在"; } else { Oper oldOper = new Oper(dtOper); oldOper.cnvcCardNo = ""; EntityMapping.Update(oldOper, trans); //流水 SeqSerialNo serial = new SeqSerialNo(); serial.cnvcFill = "0"; decimal dSerialNo = EntityMapping.Create(serial, trans); //操作日志 OperLog operLog = new OperLog(); operLog.cnnSerialNo = dSerialNo; operLog.cnvcOperName = strOperName; //member.cnvcOperName; operLog.cndOperDate = DateTime.Now; operLog.cnvcOperFlag = ConstApp.Oper_Flag_OperInCallBack; EntityMapping.Create(operLog, trans); } trans.Commit(); string strRet2 = m1.RecycleCard(); if (strRet != ConstMsg.RFOK) { strRet3 += " 操作员卡回收失败"; } } catch (BusinessException bex) //业务异常 { //事务回滚 trans.Rollback(); //LogAdapter.WriteBusinessException(bex); throw new BusinessException(bex.Type, bex.Message); } catch (SqlException sex) //数据库异常 { //事务回滚 trans.Rollback(); //LogAdapter.WriteDatabaseException(sex); throw new BusinessException("数据库异常", sex.Message); } catch (Exception ex) //其他异常 { //事务回滚 trans.Rollback(); //LogAdapter.WriteFeaturesException(ex); throw new BusinessException("其它异常", ex.Message); } finally { ConnectionPool.ReturnConnection(conn); } return(strRet3); }