public int CompareTo(object obj) { PayTypeInfo b = obj as PayTypeInfo; if (String.Compare(this.OrderNumber, b.OrderNumber) >= 0) { return(1); } else { return(-1); } }
public int UpdatePayType(PayTypeInfo oParam) { string sql = @"UPDATE PayType SET PayTypeID=@PayTypeID, PayTypeName=@PayTypeName, PayTypeDesc=@PayTypeDesc, Period=@Period, PaymentPage=@PaymentPage, PayRate=@PayRate, IsNet=@IsNet, IsPayWhenRecv=@IsPayWhenRecv, OrderNumber=@OrderNumber, IsOnlineShow=@IsOnlineShow WHERE SysNo=@SysNo"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramPayTypeID = new SqlParameter("@PayTypeID", SqlDbType.NVarChar, 10); SqlParameter paramPayTypeName = new SqlParameter("@PayTypeName", SqlDbType.NVarChar, 50); SqlParameter paramPayTypeDesc = new SqlParameter("@PayTypeDesc", SqlDbType.NVarChar, 500); SqlParameter paramPeriod = new SqlParameter("@Period", SqlDbType.NVarChar, 50); SqlParameter paramPaymentPage = new SqlParameter("@PaymentPage", SqlDbType.NVarChar, 100); SqlParameter paramPayRate = new SqlParameter("@PayRate", SqlDbType.Decimal, 9); SqlParameter paramIsNet = new SqlParameter("@IsNet", SqlDbType.Int, 4); SqlParameter paramIsPayWhenRecv = new SqlParameter("@IsPayWhenRecv", SqlDbType.Int, 4); SqlParameter paramOrderNumber = new SqlParameter("@OrderNumber", SqlDbType.NVarChar, 10); SqlParameter paramIsOnlineShow = new SqlParameter("@IsOnlineShow", SqlDbType.Int, 4); paramSysNo.Value = oParam.SysNo; paramPayTypeID.Value = oParam.PayTypeID; paramPayTypeName.Value = oParam.PayTypeName; paramPayTypeDesc.Value = oParam.PayTypeDesc; paramPeriod.Value = oParam.Period; paramPaymentPage.Value = oParam.PaymentPage; paramPayRate.Value = oParam.PayRate; paramIsNet.Value = oParam.IsNet; paramIsPayWhenRecv.Value = oParam.IsPayWhenRecv; paramOrderNumber.Value = oParam.OrderNumber; paramIsOnlineShow.Value = oParam.IsOnlineShow; cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramPayTypeID); cmd.Parameters.Add(paramPayTypeName); cmd.Parameters.Add(paramPayTypeDesc); cmd.Parameters.Add(paramPeriod); cmd.Parameters.Add(paramPaymentPage); cmd.Parameters.Add(paramPayRate); cmd.Parameters.Add(paramIsNet); cmd.Parameters.Add(paramIsPayWhenRecv); cmd.Parameters.Add(paramOrderNumber); cmd.Parameters.Add(paramIsOnlineShow); return SqlHelper.ExecuteNonQuery(cmd); }
public void ImportPayType() { if (!AppConfig.IsImportable) throw new BizException("Is Importable is false"); /* do not use the following code after Data Pour in */ string sql = @"select * from PayType"; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) throw new BizException("the table paytype is not empty"); TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { string sql1 = @"select pt.*, ptl.paytypename, period, note from ipp2003..pay_type as pt, ipp2003..pay_type_language as ptl where pt.sysno = ptl.paytypesysno and ptl.languageid='cn'"; DataSet ds1 = SqlHelper.ExecuteDataSet(sql1); foreach (DataRow dr1 in ds1.Tables[0].Rows) { PayTypeInfo oPayType = new PayTypeInfo(); oPayType.PayTypeID = Util.TrimNull(dr1["PayTypeID"]); oPayType.PayTypeName = Util.TrimNull(dr1["PayTypeName"]); oPayType.PayTypeDesc = Util.TrimNull(dr1["Note"]); oPayType.Period = Util.TrimNull(dr1["Period"]); oPayType.PaymentPage = Util.TrimNull(dr1["PaymentPage"]); oPayType.PayRate = Util.TrimDecimalNull(dr1["ServiceRate"]); oPayType.IsNet = Util.TrimIntNull(dr1["IsNet"]); oPayType.IsPayWhenRecv = Util.TrimIntNull(dr1["IsPayWhenReceive"]); oPayType.OrderNumber = "zzz"; oPayType.IsOnlineShow = Util.TrimIntNull(dr1["sstatus"]); this.InsertPayType(oPayType); //insert into convert table ImportInfo oImport = new ImportInfo(); oImport.OldSysNo = Util.TrimIntNull(dr1["SysNo"]); oImport.NewSysNo = oPayType.SysNo; new ImportDac().Insert(oImport, "PayType"); } scope.Complete(); } }
private void Map(PayTypeInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.PayTypeID = Util.TrimNull(tempdr["PayTypeID"]); oParam.PayTypeName = Util.TrimNull(tempdr["PayTypeName"]); oParam.PayTypeDesc = Util.TrimNull(tempdr["PayTypeDesc"]); oParam.Period = Util.TrimNull(tempdr["Period"]); oParam.PaymentPage = Util.TrimNull(tempdr["PaymentPage"]); oParam.PayRate = Util.TrimDecimalNull(tempdr["PayRate"]); oParam.IsNet = Util.TrimIntNull(tempdr["IsNet"]); oParam.IsPayWhenRecv = Util.TrimIntNull(tempdr["IsPayWhenRecv"]); oParam.OrderNumber = Util.TrimNull(tempdr["OrderNumber"]); oParam.IsOnlineShow = Util.TrimIntNull(tempdr["IsOnlineShow"]); }
public int UpdatePayType(PayTypeInfo oParam) { string sql = "select * from paytype where paytypeid=" + Util.ToSqlString(oParam.PayTypeID) + " and sysno <>" + oParam.SysNo; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) throw new BizException("the same paytypeid exists"); if (payTypeHash == null || !payTypeHash.ContainsKey(oParam.SysNo)) throw new BizException("the pay type does not exist, update failed"); int result = new ASPDac().UpdatePayType(oParam); SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.ASP); payTypeHash.Remove(oParam.SysNo); payTypeHash.Add(oParam.SysNo, oParam); return result; }
public int InsertPayType(PayTypeInfo oParam) { string sql = "select * from paytype where paytypeid = " + Util.ToSqlString(oParam.PayTypeID); DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) throw new BizException("the same paytypeid exists"); oParam.SysNo = SequenceDac.GetInstance().Create("PayType_Sequence"); int result = new ASPDac().InsertPayType(oParam); SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.ASP); if (payTypeHash == null) payTypeHash = new Hashtable(10); payTypeHash.Add(oParam.SysNo, oParam); return result; }
public void InitPayType() { lock (payTypeLock) { payTypeHash.Clear(); string sql = "select * from PayType order by OrderNumber"; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (!Util.HasMoreRow(ds)) return; foreach (DataRow dr in ds.Tables[0].Rows) { PayTypeInfo item = new PayTypeInfo(); Map(item, dr); payTypeHash.Add(item.SysNo, item); } } }
private void GetLastOneSo() { DataSet ds = new DataSet(); ds = SaleManager.GetInstance().GetSOOnlineDs(oSession.sCustomer.SysNo, 1); if (Util.HasMoreRow(ds)) { if (ds.Tables[0].Rows.Count == 1) { DataRow dr = ds.Tables[0].Rows[0]; int soSysNo = int.Parse(dr["sysno"].ToString()); oldSoInfo = SaleManager.GetInstance().LoadSOMaster(soSysNo); shipTypeInfo = (ShipTypeInfo)ASPManager.GetInstance().GetShipTypeHash()[oldSoInfo.ShipTypeSysNo]; payTypeInfo = (PayTypeInfo)ASPManager.GetInstance().GetPayTypeHash()[oldSoInfo.PayTypeSysNo]; } else { Response.Redirect("ShoppingCart.aspx"); } } }