Beispiel #1
0
        public Form2(DataTable tableOne, MaterileEntity.MaterielPDCEntity _pdc, string ContrNum, string productNum, string productName)
        {
            InitializeComponent( );

            this._pdc = new MaterileEntity.MaterielPDCEntity( );
            _pdd      = new MaterileEntity.MaterielPDDEntity( );
            _bll      = new MaterielBll.Bll.MaterielTwoBll( );

            toolQuery.Visibility  = DevExpress.XtraBars.BarItemVisibility.Never;
            toolAdd.Visibility    = DevExpress.XtraBars.BarItemVisibility.Never;
            toolDelete.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
            toolEdit.Visibility   = DevExpress.XtraBars.BarItemVisibility.Never;
            toolSave.Visibility   = DevExpress.XtraBars.BarItemVisibility.Always;
            toolCancel.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
            toolProv.Visibility   = DevExpress.XtraBars.BarItemVisibility.Never;
            toolNext.Visibility   = DevExpress.XtraBars.BarItemVisibility.Never;
            toolPrint.Visibility  = DevExpress.XtraBars.BarItemVisibility.Never;
            toolExport.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;

            this.txtContrNum.Text = ContrNum;
            this.txtCusNum.Tag    = productNum;
            this.txtCusNum.Text   = productName;

            this.table = tableOne;
            this._pdc  = _pdc;

            query( );
        }
Beispiel #2
0
        bool Exists_pdc(MaterileEntity.MaterielPDCEntity _pdc)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("SELECT COUNT(1) FROM TENPDC ");
            strSql.AppendFormat("WHERE PDC001='{0}' AND PDC005='{1}'", _pdc.PDC001, _pdc.PDC005);

            return(SqlHelper.Exists(strSql.ToString( )));
        }
Beispiel #3
0
        void add_pdd(Hashtable SQLString, StringBuilder strSql, Hashtable table_one_pdc, Hashtable table_two_pdc)
        {
            foreach (string key in table_two_pdc.Keys)
            {
                MaterileEntity.MaterielPDCEntity _pdc = (MaterileEntity.MaterielPDCEntity)table_two_pdc [key];
                MaterileEntity.MaterielPDDEntity _pdd = new MaterileEntity.MaterielPDDEntity( );
                _pdd.PDD001 = _pdc.PDC002;
                _pdd.PDD011 = _pdc.PDC005;
                _pdd.PDD012 = _pdc.PDC001;
                DataTable     tableTre = ( DataTable )table_one_pdc [key];
                DataTable     dt       = dtpdd(_pdd.PDD011, _pdd.PDD012);
                List <string> strList  = new List <string> ( );
                for (int i = 0; i < tableTre.Rows.Count; i++)
                {
                    _pdd.PDD002 = tableTre.Rows [i] ["PDD002"].ToString( );
                    _pdd.PDD003 = tableTre.Rows [i] ["PDD003"].ToString( );
                    _pdd.PDD004 = tableTre.Rows [i] ["PDD004"].ToString( );
                    _pdd.PDD005 = tableTre.Rows [i] ["PDD005"].ToString( );
                    _pdd.PDD006 = string.IsNullOrEmpty(tableTre.Rows [i] ["PDD006"].ToString( )) == true ? 0 : Convert.ToInt32(tableTre.Rows [i] ["PDD006"].ToString( ));
                    _pdd.PDD007 = tableTre.Rows [i] ["PDD007"].ToString( );
                    _pdd.PDD008 = tableTre.Rows [i] ["PDD008"].ToString( );
                    _pdd.PDD009 = tableTre.Rows [i] ["PDD009"].ToString( );

                    if (dt.Select("PDD002='" + _pdd.PDD002 + "'").Length > 0)
                    {
                        //if ( dt . Select ( "PDD002='" + _pdd . PDD002 + "' AND PDD003='" + _pdd . PDD003 + "' AND PDD004='" + _pdd . PDD004 + "' AND PDD005='" + _pdd . PDD005 + "' AND PDD006='" + _pdd . PDD006 + "' AND PDD007='" + _pdd . PDD007 + "' AND PDD008='" + _pdd . PDD008 + "' AND PDD009='" + _pdd . PDD009 + "' AND PDD011='" + _pdd . PDD011 + "' AND PDD012='" + _pdd . PDD012 + "'" ) . Length < 1 )
                        //{
                        //    _pdd . PDD002 = dt . Compute ( "max(PDD002)" ,null ) . ToString ( );
                        //    _pdd . PDD002 = ( Convert . ToInt32 ( _pdd . PDD002 ) + 1 ) . ToString ( );
                        //    _pdd . PDD002 = _pdd . PDD002 . PadLeft ( 3 ,'0' );
                        //    if ( strList . Contains ( _pdd . PDD002 ) == false )
                        //        strList . Add ( _pdd . PDD002 );
                        //    else
                        //    {
                        //        _pdd . PDD002 = strList . Max ( );
                        //        _pdd . PDD002 = ( Convert . ToInt32 ( _pdd . PDD002 ) + 1 ) . ToString ( );
                        //        _pdd . PDD002 = _pdd . PDD002 . PadLeft ( 3 ,'0' );
                        //        strList . Add ( _pdd . PDD002 );
                        //    }
                        //    add_pdd_one ( SQLString ,strSql ,_pdd );
                        //}
                        //else
                        edit_pdd(SQLString, strSql, _pdd);
                    }
                    else
                    {
                        add_pdd_one(SQLString, strSql, _pdd);
                    }
                }
            }
        }