Example #1
0
        public FormArtPower( )
        {
            InitializeComponent( );

            _model      = new ProductionErpEntity.ArtPowerEntity( );
            _bll        = new ProductionErpBll.Bll.ArtPowerBll( );
            tableView   = new DataTable( );
            tablePerson = new DataTable( );
            tableArt    = new DataTable( );
            strList     = new List <string> ( );

            Utility.GridViewMoHuSelect.SetFilter(gridView1);
            Utility.GridViewMoHuSelect.SetFilter(repositoryItemSearchLookUpEdit1View);
            FieldInfo fi = typeof(XPaint).GetField("graphics", BindingFlags.Static | BindingFlags.NonPublic);

            fi.SetValue(null, new DrawXPaint( ));

            barMenu.LinksPersistInfo.RemoveAt(toolExport.Id);
            barMenu.LinksPersistInfo.RemoveAt(toolPrint.Id);

            wait.Hide( );
            gridView1.OptionsBehavior.Editable = false;

            tablePerson = _bll.tablePerson( );
            lupPerson.Properties.DataSource    = tablePerson;
            lupPerson.Properties.DisplayMember = "ARP002";
            lupPerson.Properties.ValueMember   = "ARP001";

            getPerson( );

            tableArt             = _bll.getArt( );
            resArt.DataSource    = tableArt;
            resArt.DisplayMember = "ARP003";
            resArt.ValueMember   = "idx";
        }
Example #2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public bool Save(DataTable table, List <string> strList)
        {
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );

            ProductionErpEntity.ArtPowerEntity model = new ProductionErpEntity.ArtPowerEntity( );
            DataRow row;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row          = table.Rows [i];
                model.ARP001 = row ["ARP001"].ToString( );
                model.ARP002 = row ["ARP002"].ToString( );
                model.ARP003 = row ["ARP003"].ToString( );
                model.ARP004 = row ["ARP004"].ToString( );
                if (!Exists(model))
                {
                    add(SQLString, strSql, model);
                }
            }
            if (strList != null && strList.Count > 0)
            {
                foreach (string s in strList)
                {
                    model.idx = Convert.ToInt32(s);
                    delete(SQLString, strSql, model);
                }
            }

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }
Example #3
0
        void delete(Hashtable SQLString, StringBuilder strSql, ProductionErpEntity.ArtPowerEntity model)
        {
            strSql = new StringBuilder( );
            strSql.Append("DELETE FROM MOXARP ");
            strSql.AppendFormat("WHERE idx={0}", model.idx);

            SQLString.Add(strSql, null);
        }
Example #4
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public bool Delete(DataTable table)
        {
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );

            ProductionErpEntity.ArtPowerEntity _model = new ProductionErpEntity.ArtPowerEntity( );
            for (int i = 0; i < table.Rows.Count; i++)
            {
                _model.idx = string.IsNullOrEmpty(table.Rows [i] ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["idx"].ToString( ));
                strSql     = new StringBuilder( );
                strSql.AppendFormat("DELETE FROM MOXARP WHERE idx={0}", _model.idx);
                SQLString.Add(strSql, null);
            }

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }
Example #5
0
        bool Exists(ProductionErpEntity.ArtPowerEntity model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("SELECT COUNT(1) FROM MOXARP ");
            strSql.Append("WHERE ARP001=@ARP001 AND ARP003=@ARP003 AND ARP004=@ARP004");
            SqlParameter [] parameter =
            {
                new SqlParameter("@ARP001", SqlDbType.NVarChar, 50),
                new SqlParameter("@ARP003", SqlDbType.NVarChar, 50),
                new SqlParameter("@ARP004", SqlDbType.NVarChar, 50)
            };
            parameter [0].Value = model.ARP001;
            parameter [1].Value = model.ARP003;
            parameter [2].Value = model.ARP004;

            return(SqlHelper.Exists(strSql.ToString( ), parameter));
        }
Example #6
0
 void add(Hashtable SQLString, StringBuilder strSql, ProductionErpEntity.ArtPowerEntity model)
 {
     strSql = new StringBuilder( );
     strSql.Append("INSERT INTO MOXARP (");
     strSql.Append("ARP001,ARP002,ARP003,ARP004) ");
     strSql.Append("VALUES (");
     strSql.Append("@ARP001,@ARP002,@ARP003,@ARP004) ");
     SqlParameter [] parameter =
     {
         new SqlParameter("@ARP001", SqlDbType.NVarChar, 50),
         new SqlParameter("@ARP002", SqlDbType.NVarChar, 50),
         new SqlParameter("@ARP003", SqlDbType.NVarChar, 50),
         new SqlParameter("@ARP004", SqlDbType.NVarChar, 50)
     };
     parameter [0].Value = model.ARP001;
     parameter [1].Value = model.ARP002;
     parameter [2].Value = model.ARP003;
     parameter [3].Value = model.ARP004;
     SQLString.Add(strSql, parameter);
 }