Exemple #1
0
        public int InsertFreightManArea(FreightManAreaInfo oParam)
        {
            string sql = @"INSERT INTO FreightMan_Area
                            (
                            FreightUserSysNo, AreaSysNo
                            )
                            VALUES (
                            @FreightUserSysNo, @AreaSysNo
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramFreightUserSysNo = new SqlParameter("@FreightUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramAreaSysNo = new SqlParameter("@AreaSysNo", SqlDbType.Int, 4);
            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.FreightUserSysNo != AppConst.IntNull)
                paramFreightUserSysNo.Value = oParam.FreightUserSysNo;
            else
                paramFreightUserSysNo.Value = System.DBNull.Value;
            if (oParam.AreaSysNo != AppConst.IntNull)
                paramAreaSysNo.Value = oParam.AreaSysNo;
            else
                paramAreaSysNo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramFreightUserSysNo);
            cmd.Parameters.Add(paramAreaSysNo);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Exemple #2
0
        public void InsertFreightManArea(string FreightMenList, string AreaSysNoList)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                string[] FreightMen = FreightMenList.Split(',');
                string[] AreaSysNo = AreaSysNoList.Split(',');

                for (int i = 0; i < FreightMen.Length; i++)
                {
                    for (int j = 0; j < AreaSysNo.Length; j++)
                    {
                        string sql = "select * from FreightMan_Area where FreightUserSysNo = " + Int32.Parse(FreightMen[i]) + " and AreaSysNo = " + Int32.Parse(AreaSysNo[j]);
                        DataSet ds = SqlHelper.ExecuteDataSet(sql);
                        if (!Util.HasMoreRow(ds))
                        {
                            FreightManAreaInfo oParam = new FreightManAreaInfo();
                            oParam.FreightUserSysNo = Int32.Parse(FreightMen[i]);
                            oParam.AreaSysNo = Int32.Parse(AreaSysNo[j]);
                            int result = new ASPDac().InsertFreightManArea(oParam);
                            SyncManager.GetInstance().SetDbLastVersion((int)AppEnum.Sync.ASP);

                            if (freightManAreaHash == null)
                                freightManAreaHash = new Hashtable(10);
                            freightManAreaHash.Add(oParam.SysNo, oParam);

                        }

                    }
                }
                scope.Complete();

            }
        }
Exemple #3
0
 private void Map(FreightManAreaInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.FreightUserSysNo = Util.TrimIntNull(tempdr["FreightUserSysNo"]);
     oParam.AreaSysNo = Util.TrimIntNull(tempdr["AreaSysNo"]);
 }
Exemple #4
0
        public void InitFreightManArea()
        {
            lock (freightManAreaLock)
            {
                freightManAreaHash.Clear();
                string sql = "select * from FreightMan_Area";
                DataSet ds = SqlHelper.ExecuteDataSet(sql);
                if (!Util.HasMoreRow(ds))
                    return;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    FreightManAreaInfo item = new FreightManAreaInfo();

                    Map(item, dr);
                    freightManAreaHash.Add(item.SysNo, item);
                }
            }
        }