Exemple #1
0
        public int InsertShipPay(ShipPayInfo oParam)
        {
            string sql = @"INSERT INTO ShipType_PayType_Un
                            (
                            ShipTypeSysNo, PayTypeSysNo
                            )
                            VALUES (
                            @ShipTypeSysNo, @PayTypeSysNo
                            );
                            set @SysNo = SCOPE_IDENTITY();";

            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramShipTypeSysNo = new SqlParameter("@ShipTypeSysNo", SqlDbType.Int, 4);
            SqlParameter paramPayTypeSysNo = new SqlParameter("@PayTypeSysNo", SqlDbType.Int, 4);

            paramSysNo.Direction = ParameterDirection.Output;
            paramShipTypeSysNo.Value = oParam.ShipTypeSysNo;
            paramPayTypeSysNo.Value = oParam.PayTypeSysNo;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramShipTypeSysNo);
            cmd.Parameters.Add(paramPayTypeSysNo);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Exemple #2
0
 private void Map(ShipPayInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.ShipTypeSysNo = Util.TrimIntNull(tempdr["ShipTypeSysNo"]);
     oParam.PayTypeSysNo = Util.TrimIntNull(tempdr["PayTypeSysNo"]);
 }
Exemple #3
0
 public void InitShipPayUn()
 {
     lock (shipPayLock)
     {
         shipPayHash.Clear();
         string sql = "select * from shiptype_paytype_un";
         DataSet ds = SqlHelper.ExecuteDataSet(sql);
         if (!Util.HasMoreRow(ds))
             return;
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             ShipPayInfo item = new ShipPayInfo();
             Map(item, dr);
             shipPayHash.Add(item.SysNo, item);
         }
     }
 }
Exemple #4
0
        public int InsertShipPayUn(ShipPayInfo oParam)
        {
            string sql = "select * from shiptype_paytype_un where ShipTypeSysNo = " + oParam.ShipTypeSysNo + " and PayTypeSysNo = " + oParam.PayTypeSysNo;
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if (Util.HasMoreRow(ds))
                throw new BizException("this shiptype_paytype_un record exists");

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

            if (shipPayHash == null)
                shipPayHash = new Hashtable(10);
            shipPayHash.Add(oParam.SysNo, oParam);
            return result;
        }
Exemple #5
0
        public void ImportShipPayUn()
        {
            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_PayType_Un";
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if (Util.HasMoreRow(ds))
                throw new BizException("the table ShipType_PayType_Un 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 shiptype_convert.newsysno as ShipTypeSysNo, paytype_convert.newsysno as PayTypeSysNo from
                            ipp2003..ship_pay as old,
                            ippconvert..shiptype as shiptype_convert,
                            ippconvert..paytype as paytype_convert
                            where
                            old.shiptypesysno = shiptype_convert.oldsysno
                            and old.paytypesysno = paytype_convert.oldsysno";
                DataSet ds1 = SqlHelper.ExecuteDataSet(sql1);
                foreach (DataRow dr1 in ds1.Tables[0].Rows)
                {
                    ShipPayInfo oShipPay = new ShipPayInfo();

                    oShipPay.ShipTypeSysNo = Util.TrimIntNull(dr1["ShipTypeSysNo"]);
                    oShipPay.PayTypeSysNo = Util.TrimIntNull(dr1["PayTypeSysNo"]);

                    this.InsertShipPayUn(oShipPay);

                }
                scope.Complete();
            }
        }