Exemple #1
0
        public int CompareTo(object obj)
        {
            ShipTypeInfo b = obj as ShipTypeInfo;

            if (String.Compare(this.OrderNumber, b.OrderNumber) >= 0)
            {
                return(1);
            }
            else
            {
                return(-1);
            }
        }
Exemple #2
0
 private void Map(ShipTypeInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.ShipTypeID = Util.TrimNull(tempdr["ShipTypeID"]);
     oParam.ShipTypeName = Util.TrimNull(tempdr["ShipTypeName"]);
     oParam.ShipTypeDesc = Util.TrimNull(tempdr["ShipTypeDesc"]);
     oParam.Period = Util.TrimNull(tempdr["Period"]);
     oParam.Provider = Util.TrimNull(tempdr["Provider"]);
     oParam.PremiumRate = Util.TrimDecimalNull(tempdr["PremiumRate"]);
     oParam.PremiumBase = Util.TrimDecimalNull(tempdr["PremiumBase"]);
     oParam.FreeShipBase = Util.TrimDecimalNull(tempdr["FreeShipBase"]);
     oParam.OrderNumber = Util.TrimNull(tempdr["OrderNumber"]);
     oParam.IsOnlineShow = Util.TrimIntNull(tempdr["IsOnlineShow"]);
     oParam.IsWithPackFee = Util.TrimIntNull(tempdr["IsWithPackFee"]);
     oParam.StatusQueryType = Util.TrimIntNull(tempdr["StatusQueryType"]);
     oParam.StatusQueryUrl = Util.TrimNull(tempdr["StatusQueryUrl"]);
 }
Exemple #3
0
        public int UpdateShipType(ShipTypeInfo oParam)
        {
            string sql = @"UPDATE ShipType SET
                            ShipTypeID=@ShipTypeID,
                            ShipTypeName=@ShipTypeName, ShipTypeDesc=@ShipTypeDesc,
                            Period=@Period, Provider=@Provider,
                            PremiumRate=@PremiumRate, PremiumBase=@PremiumBase,
                            FreeShipBase=@FreeShipBase, OrderNumber=@OrderNumber,
                            IsOnlineShow=@IsOnlineShow, IsWithPackFee=@IsWithPackFee,
                            StatusQueryType=@StatusQueryType,StatusQueryUrl=@StatusQueryUrl
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramShipTypeID = new SqlParameter("@ShipTypeID", SqlDbType.NVarChar, 20);
            SqlParameter paramShipTypeName = new SqlParameter("@ShipTypeName", SqlDbType.NVarChar, 50);
            SqlParameter paramShipTypeDesc = new SqlParameter("@ShipTypeDesc", SqlDbType.NVarChar, 500);
            SqlParameter paramPeriod = new SqlParameter("@Period", SqlDbType.NVarChar, 50);
            SqlParameter paramProvider = new SqlParameter("@Provider", SqlDbType.NVarChar, 50);
            SqlParameter paramPremiumRate = new SqlParameter("@PremiumRate", SqlDbType.Decimal, 9);
            SqlParameter paramPremiumBase = new SqlParameter("@PremiumBase", SqlDbType.Decimal, 9);
            SqlParameter paramFreeShipBase = new SqlParameter("@FreeShipBase", SqlDbType.Decimal, 9);
            SqlParameter paramOrderNumber = new SqlParameter("@OrderNumber", SqlDbType.NVarChar, 10);
            SqlParameter paramIsOnlineShow = new SqlParameter("@IsOnlineShow", SqlDbType.Int, 4);
            SqlParameter paramIsWithPackFee = new SqlParameter("@IsWithPackFee", SqlDbType.Int, 4);
            SqlParameter paramStatusQueryType = new SqlParameter("@StatusQueryType", SqlDbType.Int, 4);
            SqlParameter paramStatusQueryUrl = new SqlParameter("@StatusQueryUrl", SqlDbType.NVarChar, 500);

            paramSysNo.Value = oParam.SysNo;
            paramShipTypeID.Value = oParam.ShipTypeID;
            paramShipTypeName.Value = oParam.ShipTypeName;
            paramShipTypeDesc.Value = oParam.ShipTypeDesc;
            paramPeriod.Value = oParam.Period;
            paramProvider.Value = oParam.Provider;
            paramPremiumRate.Value = oParam.PremiumRate;
            paramPremiumBase.Value = oParam.PremiumBase;
            paramFreeShipBase.Value = oParam.FreeShipBase;
            paramOrderNumber.Value = oParam.OrderNumber;
            paramIsOnlineShow.Value = oParam.IsOnlineShow;
            paramIsWithPackFee.Value = oParam.IsWithPackFee;
            paramStatusQueryType.Value = oParam.StatusQueryType;
            paramStatusQueryUrl.Value = oParam.StatusQueryUrl;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramShipTypeID);
            cmd.Parameters.Add(paramShipTypeName);
            cmd.Parameters.Add(paramShipTypeDesc);
            cmd.Parameters.Add(paramPeriod);
            cmd.Parameters.Add(paramProvider);
            cmd.Parameters.Add(paramPremiumRate);
            cmd.Parameters.Add(paramPremiumBase);
            cmd.Parameters.Add(paramFreeShipBase);
            cmd.Parameters.Add(paramOrderNumber);
            cmd.Parameters.Add(paramIsOnlineShow);
            cmd.Parameters.Add(paramIsWithPackFee);
            cmd.Parameters.Add(paramStatusQueryType);
            cmd.Parameters.Add(paramStatusQueryUrl);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Exemple #4
0
        public int UpdateShipType(ShipTypeInfo oParam)
        {
            string sql = "select * from shiptype where shiptypeid=" + Util.ToSqlString(oParam.ShipTypeID) + " and sysno <>" + oParam.SysNo;
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if (Util.HasMoreRow(ds))
                throw new BizException("the same ship type id exists");

            if (shipTypeHash == null || !shipTypeHash.ContainsKey(oParam.SysNo))
                throw new BizException("the ship type does not exist, update failed");

            int result = new ASPDac().UpdateShipType(oParam);
            SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.ASP);

            shipTypeHash.Remove(oParam.SysNo);
            shipTypeHash.Add(oParam.SysNo, oParam);

            return result;
        }
Exemple #5
0
        public int InsertShipType(ShipTypeInfo oParam)
        {
            string sql = "select * from shiptype where shiptypeid = " + Util.ToSqlString(oParam.ShipTypeID);
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if (Util.HasMoreRow(ds))
                throw new BizException("the same ship type id exists");

            oParam.SysNo = SequenceDac.GetInstance().Create("ShipType_Sequence");
            int result = new ASPDac().InsertShipType(oParam);
            SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.ASP);

            if (shipTypeHash == null)
                shipTypeHash = new Hashtable(10);
            shipTypeHash.Add(oParam.SysNo, oParam);
            return result;
        }
Exemple #6
0
 public void InitShipType()
 {
     lock (shipTypeLock)
     {
         if (shipTypeHash != null)
             shipTypeHash.Clear();
         string sql = "select * from shiptype";
         DataSet ds = SqlHelper.ExecuteDataSet(sql);
         if (!Util.HasMoreRow(ds))
             return;
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             ShipTypeInfo item = new ShipTypeInfo();
             Map(item, dr);
             shipTypeHash.Add(item.SysNo, item);
         }
     }
 }
Exemple #7
0
        public void ImportShipType()
        {
            if (!AppConfig.IsImportable)
                throw new BizException("Is Importable is false");
            /*  do not  use the following code after Data Pour in */
            string sql = @"select * from ShipType";
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if (Util.HasMoreRow(ds))
                throw new BizException("the table ship type 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 st.*, st.withpackfee as iswithpackfee, stl.shiptypename, stl.company, stl.period from ipp2003..ship_type as st, ipp2003..ship_type_language as stl
                            where st.sysno = stl.shiptypesysno and stl.languageid = 'cn'";
                DataSet ds1 = SqlHelper.ExecuteDataSet(sql1);
                foreach (DataRow dr1 in ds1.Tables[0].Rows)
                {
                    ShipTypeInfo oShipType = new ShipTypeInfo();

                    oShipType.ShipTypeID = Util.TrimNull(dr1["ShipTypeID"]);
                    oShipType.ShipTypeName = Util.TrimNull(dr1["ShipTypeName"]);
                    oShipType.ShipTypeDesc = "";
                    oShipType.Period = Util.TrimNull(dr1["Period"]);
                    oShipType.Provider = Util.TrimNull(dr1["Company"]);
                    oShipType.PremiumRate = Util.TrimDecimalNull(dr1["PremiumRate"]);
                    oShipType.PremiumBase = Util.TrimDecimalNull(dr1["PremiumBase"]);
                    oShipType.FreeShipBase = 0;
                    oShipType.OrderNumber = "zzz";
                    oShipType.IsOnlineShow = Util.TrimIntNull(dr1["sstatus"]);
                    oShipType.IsWithPackFee = Util.TrimIntNull(dr1["IsWithPackFee"]);
                    oShipType.StatusQueryType = Util.TrimIntNull(dr1["StatusQueryType"]);
                    oShipType.StatusQueryUrl = Util.TrimNull(dr1["StatusQueryUrl"]);

                    this.InsertShipType(oShipType);

                    //insert into convert table
                    ImportInfo oImport = new ImportInfo();
                    oImport.OldSysNo = Util.TrimIntNull(dr1["SysNo"]);
                    oImport.NewSysNo = oShipType.SysNo;
                    new ImportDac().Insert(oImport, "ShipType");

                }
                scope.Complete();
            }
        }
Exemple #8
0
        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");
                }
            }
        }