Exemplo n.º 1
0
        /// <summary>
        /// add srv
        /// </summary>
        /// <param name="SQLString"></param>
        /// <param name="strSql"></param>
        /// <param name="_model"></param>
        void add_SRV(Hashtable SQLString, StringBuilder strSql, ProductionErpEntity.SingRowTableSRVEntity model)
        {
            strSql = new StringBuilder( );
            strSql.Append("INSERT INTO MOXSRV (");
            strSql.Append("SRV001,SRV002,SRV003,SRV004,SRV005,SRV006,SRV007) ");
            strSql.Append("VALUES (");
            strSql.Append("@SRV001,@SRV002,@SRV003,@SRV004,@SRV005,@SRV006,@SRV007) ");
            SqlParameter [] parameters =
            {
                new SqlParameter("@SRV001", SqlDbType.NVarChar, 50),
                new SqlParameter("@SRV002", SqlDbType.NVarChar, 50),
                new SqlParameter("@SRV003", SqlDbType.NVarChar, 50),
                new SqlParameter("@SRV004", SqlDbType.NVarChar, 50),
                new SqlParameter("@SRV005", SqlDbType.NVarChar, 50),
                new SqlParameter("@SRV006", SqlDbType.Int,       4),
                new SqlParameter("@SRV007", SqlDbType.VarChar, 50)
            };
            parameters [0].Value = model.SRV001;
            parameters [1].Value = model.SRV002;
            parameters [2].Value = model.SRV003;
            parameters [3].Value = model.SRV004;
            parameters [4].Value = model.SRV005;
            parameters [5].Value = model.SRV006;
            parameters [6].Value = model.SRV007;

            SQLString.Add(strSql, parameters);
        }
Exemplo n.º 2
0
        /// <summary>
        /// save data to srv
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public bool GenerMOXSRV(DataTable table)
        {
            ProductionErpEntity.SingRowTableSRVEntity _model = new ProductionErpEntity.SingRowTableSRVEntity( );
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );
            Hashtable     strList   = new Hashtable( );
            bool          check     = false;

            _model.SRV001 = getOddNum_SRU( );
            for (int i = 0; i < table.Rows.Count; i++)
            {
                check = string.IsNullOrEmpty(table.Rows [i] ["checkTre"].ToString( )) == true ? false : ( bool )table.Rows [i] ["checkTre"];
                if (check)
                {
                    _model.SRV002 = table.Rows [i] ["RAA001"].ToString( );
                    _model.SRV003 = table.Rows [i] ["RAA015"].ToString( );
                    if (Exists_SRV(_model))
                    {
                        _model.SRV004 = table.Rows [i] ["DEA002"].ToString( );
                        _model.SRV005 = table.Rows [i] ["DEA057"].ToString( );
                        _model.SRV006 = string.IsNullOrEmpty(table.Rows [i] ["RAA018"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["RAA018"].ToString( ));
                        _model.SRV007 = codeNum_SRV(_model.SRV002, table.Rows [i] ["DEA004"].ToString( ), strList);
                        add_SRV(SQLString, strSql, _model);
                    }
                }
            }

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }
Exemplo n.º 3
0
        /// <summary>
        /// does it exists job number and product num
        /// </summary>
        /// <param name="_model"></param>
        /// <returns></returns>
        bool Exists_SRV(ProductionErpEntity.SingRowTableSRVEntity _model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("SELECT COUNT(1) FROM MOXSRV ");
            strSql.AppendFormat("WHERE SRV002='{0}' AND SRV003='{1}'", _model.SRV002, _model.SRV003);

            return(SqlHelper.Exists(strSql.ToString( )));
        }