Пример #1
0
        void edit_cm ( Hashtable SQLString ,StringBuilder strSql ,MulaolaoLibrary . StandardTestCMEntity model )
        {
            strSql = new StringBuilder ( );
            strSql . Append ( "update R_PQCM set " );
            strSql . Append ( "CM001=@CM001," );
            strSql . Append ( "CM002=@CM002," );
            strSql . Append ( "CM003=@CM003," );
            strSql . Append ( "CM004=@CM004," );
            strSql . Append ( "CM005=@CM005," );
            strSql . Append ( "CM006=@CM006," );
            strSql . Append ( "CM007=@CM007 " );
            strSql . Append ( " where idx=@idx" );
            SqlParameter [ ] parameters = {
                    new SqlParameter("@CM001", SqlDbType.Int,4),
                    new SqlParameter("@CM002", SqlDbType.Int,4),
                    new SqlParameter("@CM003", SqlDbType.Int,4),
                    new SqlParameter("@CM004", SqlDbType.Int,4),
                    new SqlParameter("@CM005", SqlDbType.Int,4),
                    new SqlParameter("@CM006", SqlDbType.Int,4),
                    new SqlParameter("@CM007", SqlDbType.Int,4),
                    new SqlParameter("@idx", SqlDbType.Int,4)
            };
            parameters [ 0 ] . Value = model . CM001;
            parameters [ 1 ] . Value = model . CM002;
            parameters [ 2 ] . Value = model . CM003;
            parameters [ 3 ] . Value = model . CM004;
            parameters [ 4 ] . Value = model . CM005;
            parameters [ 5 ] . Value = model . CM006;
            parameters [ 6 ] . Value = model . CM007;
            parameters [ 7 ] . Value = model . idx;

            SQLString . Add ( strSql ,parameters );
        }
Пример #2
0
        void add_cm ( Hashtable SQLString ,StringBuilder strSql ,MulaolaoLibrary . StandardTestCMEntity model )
        {
            strSql = new StringBuilder ( );
            strSql . Append ( "insert into R_PQCM(" );
            strSql . Append ( "CM001,CM002,CM003,CM004,CM005,CM006,CM007)" );
            strSql . Append ( " values (" );
            strSql . Append ( "@CM001,@CM002,@CM003,@CM004,@CM005,@CM006,@CM007)" );
            SqlParameter [ ] parameters = {
                    new SqlParameter("@CM001", SqlDbType.Int,4),
                    new SqlParameter("@CM002", SqlDbType.Int,4),
                    new SqlParameter("@CM003", SqlDbType.Int,4),
                    new SqlParameter("@CM004", SqlDbType.Int,4),
                    new SqlParameter("@CM005", SqlDbType.Int,4),
                    new SqlParameter("@CM006", SqlDbType.Int,4),
                    new SqlParameter("@CM007", SqlDbType.Int,4)
            };
            parameters [ 0 ] . Value = model . CM001;
            parameters [ 1 ] . Value = model . CM002;
            parameters [ 2 ] . Value = model . CM003;
            parameters [ 3 ] . Value = model . CM004;
            parameters [ 4 ] . Value = model . CM005;
            parameters [ 5 ] . Value = model . CM006;
            parameters [ 6 ] . Value = model . CM007;

            SQLString . Add ( strSql ,parameters );
        }
Пример #3
0
        void delete_cm ( Hashtable SQLString ,StringBuilder strSql ,MulaolaoLibrary . StandardTestCMEntity model )
        {
            strSql = new StringBuilder ( );
            strSql . Append ( "DELETE FROM R_PQCM " );
            strSql . AppendFormat ( "WHERE idx={0}" ,model . idx );

            SQLString . Add ( strSql ,null );
        }
Пример #4
0
        public FormStandardTest( )
        {
            InitializeComponent( );

            _cl          = new MulaolaoLibrary.StandardTestCLEntity( );
            _cm          = new MulaolaoLibrary.StandardTestCMEntity( );
            _bll         = new MulaolaoBll.Bll.StandardTestBll( );
            tableViewOne = new DataTable( );
            tableViewTwo = new DataTable( );
            MulaolaoBll.UserInfoMation.tableName = this.Name;

            gridView1.OptionsBehavior.Editable = false;
            gridView2.OptionsBehavior.Editable = false;

            GridViewMoHuSelect.SetFilter(gridView1);
            GridViewMoHuSelect.SetFilter(gridView2);
            GrivColumnStyle.setColumnStyle(new DevExpress.XtraGrid.Views.Grid.GridView [] { gridView1, gridView2 });
        }
Пример #5
0
        /// <summary>
        /// save data to database for r_pqcl r_pqcm
        /// </summary>
        /// <param name="tableOne"></param>
        /// <param name="tableTwo"></param>
        /// <param name="strList"></param>
        /// <param name="strL"></param>
        /// <returns></returns>
        public bool Save ( DataTable tableOne ,DataTable tableTwo ,List<string> strList ,List<string> strL )
        {
            Hashtable SQLString = new Hashtable ( );
            StringBuilder strSql = new StringBuilder ( );

            MulaolaoLibrary . StandardTestCLEntity _cl = new MulaolaoLibrary . StandardTestCLEntity ( );
            for ( int i = 0 ; i < tableOne . Rows . Count ; i++ )
            {
                if ( string . IsNullOrEmpty ( tableOne . Rows [ i ] [ "CL001" ] . ToString ( ) ) )
                    _cl . CL001 = null;
                else
                    _cl . CL001 = int . Parse ( tableOne . Rows [ i ] [ "CL001" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableOne . Rows [ i ] [ "CL002" ] . ToString ( ) ) )
                    _cl . CL002 = null;
                else
                    _cl . CL002 = int . Parse ( tableOne . Rows [ i ] [ "CL002" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableOne . Rows [ i ] [ "CL003" ] . ToString ( ) ) )
                    _cl . CL003 = null;
                else
                    _cl . CL003 = int . Parse ( tableOne . Rows [ i ] [ "CL003" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableOne . Rows [ i ] [ "CL004" ] . ToString ( ) ) )
                    _cl . CL004 = null;
                else
                    _cl . CL004 = int . Parse ( tableOne . Rows [ i ] [ "CL004" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableOne . Rows [ i ] [ "CL005" ] . ToString ( ) ) )
                    _cl . CL005 = null;
                else
                    _cl . CL005 = int . Parse ( tableOne . Rows [ i ] [ "CL005" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableOne . Rows [ i ] [ "CL006" ] . ToString ( ) ) )
                    _cl . CL006 = null;
                else
                    _cl . CL006 = int . Parse ( tableOne . Rows [ i ] [ "CL006" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableOne . Rows [ i ] [ "CL007" ] . ToString ( ) ) )
                    _cl . CL007 = null;
                else
                    _cl . CL007 = int . Parse ( tableOne . Rows [ i ] [ "CL007" ] . ToString ( ) );
                _cl . idx = string . IsNullOrEmpty ( tableOne . Rows [ i ] [ "idx" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( tableOne . Rows [ i ] [ "idx" ] . ToString ( ) );
                if ( _cl . idx > 0 )
                    edit_cl ( SQLString ,strSql ,_cl );
                else
                    add_cl ( SQLString ,strSql ,_cl );
            }

            if ( strList . Count > 0 )
            {
                foreach ( string s in strList )
                {
                    _cl . idx = Convert . ToInt32 ( s );
                    delete_cl ( SQLString ,strSql ,_cl );
                }
            }

            MulaolaoLibrary . StandardTestCMEntity _cm = new MulaolaoLibrary . StandardTestCMEntity ( );
            for ( int i = 0 ; i < tableTwo . Rows . Count ; i++ )
            {
                if ( string . IsNullOrEmpty ( tableTwo . Rows [ i ] [ "CM001" ] . ToString ( ) ) )
                    _cm . CM001 = null;
                else
                    _cm . CM001 = int . Parse ( tableTwo . Rows [ i ] [ "CM001" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableTwo . Rows [ i ] [ "CM002" ] . ToString ( ) ) )
                    _cm . CM002 = null;
                else
                    _cm . CM002 = int . Parse ( tableTwo . Rows [ i ] [ "CM002" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableTwo . Rows [ i ] [ "CM003" ] . ToString ( ) ) )
                    _cm . CM003 = null;
                else
                    _cm . CM003 = int . Parse ( tableTwo . Rows [ i ] [ "CM003" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableTwo . Rows [ i ] [ "CM004" ] . ToString ( ) ) )
                    _cm . CM004 = null;
                else
                    _cm . CM004 = int . Parse ( tableTwo . Rows [ i ] [ "CM004" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableTwo . Rows [ i ] [ "CM005" ] . ToString ( ) ) )
                    _cm . CM005 = null;
                else
                    _cm . CM005 = int . Parse ( tableTwo . Rows [ i ] [ "CM005" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableTwo . Rows [ i ] [ "CM006" ] . ToString ( ) ) )
                    _cm . CM006 = null;
                else
                    _cm . CM006 = int . Parse ( tableTwo . Rows [ i ] [ "CM006" ] . ToString ( ) );
                if ( string . IsNullOrEmpty ( tableTwo . Rows [ i ] [ "CM007" ] . ToString ( ) ) )
                    _cm . CM007 = null;
                else
                    _cm . CM007 = int . Parse ( tableTwo . Rows [ i ] [ "CM007" ] . ToString ( ) );
                _cm . idx = string . IsNullOrEmpty ( tableTwo . Rows [ i ] [ "idx" ] . ToString ( ) ) == true ? 0 : Convert . ToInt32 ( tableTwo . Rows [ i ] [ "idx" ] . ToString ( ) );
                if ( _cm . idx > 0 )
                    edit_cm ( SQLString ,strSql ,_cm );
                else
                    add_cm ( SQLString ,strSql ,_cm );
            }

            if ( strL . Count > 0 )
            {
                foreach ( string s in strL )
                {
                    _cm . idx = Convert . ToInt32 ( s );
                    delete_cm ( SQLString ,strSql ,_cm );
                }
            }

            return SqlHelper . ExecuteSqlTran ( SQLString );
        }