示例#1
0
文件: WagesDao.cs 项目: icprog/MLL
        /*
         * public bool Save ( )
         * {
         *  Hashtable SQLString = new Hashtable ( );
         *  StringBuilder strSql = new StringBuilder ( );
         *
         *  MulaolaoLibrary . WagesEntity _model = new MulaolaoLibrary . WagesEntity ( );
         *
         #region 白坯
         *
         #endregion
         *
         #region 后段
         *
         #endregion
         *
         #region 检验
         *
         #endregion
         *
         #region 包装
         *
         #endregion
         *
         #region 承揽
         *
         #endregion
         *
         * }
         *
         * DataTable getBP ( )
         * {
         *  StringBuilder strSql = new StringBuilder ( );
         *  strSql . Append ( "" );
         * }
         *
         */


        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public bool Edit(DataTable table)
        {
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );

            MulaolaoLibrary.WagesEntity _model = new MulaolaoLibrary.WagesEntity( );

            if (table != null && table.Rows.Count > 0)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    _model.EC002 = table.Rows [i] ["EC002"].ToString( );
                    _model.EC024 = string.IsNullOrEmpty(table.Rows [i] ["EC024"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["EC024"].ToString( ));
                    _model.EC025 = string.IsNullOrEmpty(table.Rows [i] ["EC025"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["EC025"].ToString( ));
                    _model.EC026 = string.IsNullOrEmpty(table.Rows [i] ["EC026"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["EC026"].ToString( ));
                    _model.EC027 = string.IsNullOrEmpty(table.Rows [i] ["EC027"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["EC027"].ToString( ));
                    _model.EC028 = string.IsNullOrEmpty(table.Rows [i] ["EC028"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["EC028"].ToString( ));
                    _model.EC029 = table.Rows [i] ["EC029"].ToString( );
                    _model.EC030 = table.Rows [i] ["EC030"].ToString( );

                    editAll(SQLString, strSql, _model);
                }
            }
            else
            {
                return(false);
            }

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }
示例#2
0
文件: WagesDao.cs 项目: icprog/MLL
        void editAll(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.WagesEntity _model)
        {
            strSql = new StringBuilder( );
            strSql.Append("UPDATE R_PQEC SET ");
            strSql.Append("EC024=@EC024,");
            strSql.Append("EC025=@EC025,");
            strSql.Append("EC026=@EC026,");
            strSql.Append("EC027=@EC027,");
            strSql.Append("EC028=@EC028,");
            strSql.Append("EC029=@EC029,");
            strSql.Append("EC030=@EC030 ");
            strSql.Append("WHERE EC002=@EC002");
            SqlParameter [] parametre =
            {
                new SqlParameter("@EC002", SqlDbType.NVarChar, 50),
                new SqlParameter("@EC024", SqlDbType.Decimal,  18),
                new SqlParameter("@EC025", SqlDbType.Decimal,  18),
                new SqlParameter("@EC026", SqlDbType.Decimal,  18),
                new SqlParameter("@EC027", SqlDbType.Decimal,  18),
                new SqlParameter("@EC028", SqlDbType.Decimal,  18),
                new SqlParameter("@EC029", SqlDbType.NVarChar, 50),
                new SqlParameter("@EC030", SqlDbType.NVarChar, 255)
            };
            parametre [0].Value = _model.EC002;
            parametre [1].Value = _model.EC024;
            parametre [2].Value = _model.EC025;
            parametre [3].Value = _model.EC026;
            parametre [4].Value = _model.EC027;
            parametre [5].Value = _model.EC028;
            parametre [6].Value = _model.EC029;
            parametre [7].Value = _model.EC030;

            SQLString.Add(strSql, parametre);
        }
示例#3
0
文件: WagesDao.cs 项目: icprog/MLL
        void addPack(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.WagesEntity _model)
        {
            strSql = new StringBuilder( );
            strSql.Append("INSERT INTO R_PQEC (");
            strSql.Append("EC001,EC002,EC003,EC004,EC005,EC015,EC016,EC017) ");
            strSql.Append("VALUES (");
            strSql.Append("@EC001,@EC002,@EC003,@EC004,@EC005,@EC015,@EC016,@EC017) ");
            SqlParameter [] parameter =
            {
                new SqlParameter("@EC001", SqlDbType.NVarChar, 50),
                new SqlParameter("@EC002", SqlDbType.NVarChar, 50),
                new SqlParameter("@EC003", SqlDbType.NVarChar, 50),
                new SqlParameter("@EC004", SqlDbType.Int,       4),
                new SqlParameter("@EC005", SqlDbType.Date,      3),
                new SqlParameter("@EC015", SqlDbType.Decimal,  18),
                new SqlParameter("@EC016", SqlDbType.Decimal,  18),
                new SqlParameter("@EC017", SqlDbType.Decimal, 18)
            };
            parameter [0].Value = _model.EC001;
            parameter [1].Value = _model.EC002;
            parameter [2].Value = _model.EC003;
            parameter [3].Value = _model.EC004;
            parameter [4].Value = _model.EC005;
            parameter [5].Value = _model.EC015;
            parameter [6].Value = _model.EC016;
            parameter [7].Value = _model.EC017;

            SQLString.Add(strSql, parameter);
        }
示例#4
0
文件: WagesDao.cs 项目: icprog/MLL
        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="_model"></param>
        /// <returns></returns>
        bool Exists(MulaolaoLibrary.WagesEntity _model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.AppendFormat("SELECT COUNT(1) FROM R_PQEC WHERE EC002='{0}'", _model.EC002);

            return(SqlHelper.Exists(strSql.ToString( )));
        }
示例#5
0
        public FormWages( )
        {
            InitializeComponent( );

            _model = new MulaolaoLibrary.WagesEntity( );
            _bll   = new MulaolaoBll.Bll.WagesBll( );

            toolSave.Enabled   = true;
            toolExport.Enabled = true;
            GridViewMoHuSelect.SetFilter(bandedGridView1);
            GrivColumnStyle.setColumnStyle(new DevExpress.XtraGrid.Views.Grid.GridView [] { this.bandedGridView1 });
            MulaolaoBll.UserInfoMation.tableName = this.Name;
        }
示例#6
0
文件: WagesDao.cs 项目: icprog/MLL
        void editPack(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.WagesEntity _model)
        {
            strSql = new StringBuilder( );
            strSql.Append("UPDATE R_PQEC SET ");
            strSql.Append("EC015=@EC015,");
            strSql.Append("EC016=@EC016,");
            strSql.Append("EC017=@EC017 ");
            strSql.Append("WHERE EC002=@EC002");
            SqlParameter [] parameter =
            {
                new SqlParameter("@EC002", SqlDbType.NVarChar, 50),
                new SqlParameter("@EC015", SqlDbType.Decimal,  18),
                new SqlParameter("@EC016", SqlDbType.Decimal,  18),
                new SqlParameter("@EC017", SqlDbType.Decimal, 18)
            };
            parameter [0].Value = _model.EC002;
            parameter [1].Value = _model.EC015;
            parameter [2].Value = _model.EC016;
            parameter [3].Value = _model.EC017;

            SQLString.Add(strSql, parameter);
        }
示例#7
0
文件: WagesDao.cs 项目: icprog/MLL
        void editH(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.WagesEntity _model)
        {
            strSql = new StringBuilder( );
            strSql.Append("UPDATE R_PQEC SET ");
            strSql.Append("EC009=@EC009,");
            strSql.Append("EC010=@EC010,");
            strSql.Append("EC011=@EC011 ");
            strSql.Append("WHERE EC002=@EC002");
            SqlParameter [] parameter =
            {
                new SqlParameter("@EC002", SqlDbType.NVarChar, 50),
                new SqlParameter("@EC009", SqlDbType.Decimal,  18),
                new SqlParameter("@EC010", SqlDbType.Decimal,  18),
                new SqlParameter("@EC011", SqlDbType.Decimal, 18)
            };
            parameter [0].Value = _model.EC002;
            parameter [1].Value = _model.EC009;
            parameter [2].Value = _model.EC010;
            parameter [3].Value = _model.EC011;

            SQLString.Add(strSql, parameter);
        }
示例#8
0
文件: WagesDao.cs 项目: icprog/MLL
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public bool Save(string strWhere)
        {
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );

            MulaolaoLibrary.WagesEntity _model = new MulaolaoLibrary.WagesEntity( );
            DataTable table = getW(strWhere);

            if (table != null && table.Rows.Count > 0)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    _model.EC001 = table.Rows [i] ["AM003"].ToString( );
                    _model.EC002 = table.Rows [i] ["AM002"].ToString( );
                    _model.EC003 = table.Rows [i] ["AM005"].ToString( );
                    _model.EC004 = string.IsNullOrEmpty(table.Rows [i] ["AM006"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["AM006"].ToString( ));
                    if (string.IsNullOrEmpty(table.Rows [i] ["PQF31"].ToString( )))
                    {
                        _model.EC005 = null;
                    }
                    else
                    {
                        _model.EC005 = Convert.ToDateTime(table.Rows [i] ["PQF31"].ToString( ));
                    }
                    _model.EC018 = 0;
                    _model.EC019 = string.IsNullOrEmpty(table.Rows [i] ["SWOODNOW"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["SWOODNOW"].ToString( ));
                    _model.EC020 = string.IsNullOrEmpty(table.Rows [i] ["YWOODNOW"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["YWOODNOW"].ToString( ));
                    if (Exists(_model))
                    {
                        editW(SQLString, strSql, _model);
                    }
                    else
                    {
                        addW(SQLString, strSql, _model);
                    }
                }
            }

            if (strWhere.Equals("A.AM002"))
            {
                strWhere = strWhere.Replace("A.AM002", "GZ01");
            }

            if (SqlHelper.ExecuteSqlTran(SQLString))
            {
                SQLString.Clear( );
                table = getQ(strWhere);
                if (table != null && table.Rows.Count > 0)
                {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        _model.EC001 = table.Rows [i] ["GZ22"].ToString( );
                        _model.EC002 = table.Rows [i] ["GZ01"].ToString( );
                        _model.EC003 = table.Rows [i] ["GZ23"].ToString( );
                        _model.EC004 = string.IsNullOrEmpty(table.Rows [i] ["GZ34"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["GZ34"].ToString( ));
                        if (string.IsNullOrEmpty(table.Rows [i] ["PQF31"].ToString( )))
                        {
                            _model.EC005 = null;
                        }
                        else
                        {
                            _model.EC005 = Convert.ToDateTime(table.Rows [i] ["PQF31"].ToString( ));
                        }
                        _model.EC006 = 0;
                        _model.EC007 = string.IsNullOrEmpty(table.Rows [i] ["GZ1"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["GZ1"].ToString( ));
                        _model.EC008 = string.IsNullOrEmpty(table.Rows [i] ["GZ"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["GZ"].ToString( ));
                        if (Exists(_model))
                        {
                            editQ(SQLString, strSql, _model);
                        }
                        else
                        {
                            addQ(SQLString, strSql, _model);
                        }
                    }
                }
            }
            else
            {
                return(false);
            }

            if (SqlHelper.ExecuteSqlTran(SQLString))
            {
                SQLString.Clear( );
                table = getH(strWhere);
                if (table != null && table.Rows.Count > 0)
                {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        _model.EC001 = table.Rows [i] ["GZ22"].ToString( );
                        _model.EC002 = table.Rows [i] ["GZ01"].ToString( );
                        _model.EC003 = table.Rows [i] ["GZ23"].ToString( );
                        _model.EC004 = string.IsNullOrEmpty(table.Rows [i] ["GZ34"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["GZ34"].ToString( ));
                        if (string.IsNullOrEmpty(table.Rows [i] ["PQF31"].ToString( )))
                        {
                            _model.EC005 = null;
                        }
                        else
                        {
                            _model.EC005 = Convert.ToDateTime(table.Rows [i] ["PQF31"].ToString( ));
                        }
                        _model.EC009 = 0;
                        _model.EC010 = string.IsNullOrEmpty(table.Rows [i] ["GZ1"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["GZ1"].ToString( ));
                        _model.EC011 = string.IsNullOrEmpty(table.Rows [i] ["GZ"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["GZ"].ToString( ));
                        if (Exists(_model))
                        {
                            editH(SQLString, strSql, _model);
                        }
                        else
                        {
                            addH(SQLString, strSql, _model);
                        }
                    }
                }
            }
            else
            {
                return(false);
            }

            if (SqlHelper.ExecuteSqlTran(SQLString))
            {
                SQLString.Clear( );
                table = getCheck(strWhere);
                if (table != null && table.Rows.Count > 0)
                {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        _model.EC001 = table.Rows [i] ["GZ22"].ToString( );
                        _model.EC002 = table.Rows [i] ["GZ01"].ToString( );
                        _model.EC003 = table.Rows [i] ["GZ23"].ToString( );
                        _model.EC004 = string.IsNullOrEmpty(table.Rows [i] ["GZ34"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["GZ34"].ToString( ));
                        if (string.IsNullOrEmpty(table.Rows [i] ["PQF31"].ToString( )))
                        {
                            _model.EC005 = null;
                        }
                        else
                        {
                            _model.EC005 = Convert.ToDateTime(table.Rows [i] ["PQF31"].ToString( ));
                        }
                        _model.EC012 = 0;
                        _model.EC013 = string.IsNullOrEmpty(table.Rows [i] ["GZ1"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["GZ1"].ToString( ));
                        _model.EC014 = string.IsNullOrEmpty(table.Rows [i] ["GZ"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["GZ"].ToString( ));
                        if (Exists(_model))
                        {
                            editCheck(SQLString, strSql, _model);
                        }
                        else
                        {
                            addCheck(SQLString, strSql, _model);
                        }
                    }
                }
            }
            else
            {
                return(false);
            }

            if (SqlHelper.ExecuteSqlTran(SQLString))
            {
                SQLString.Clear( );
                table = getCheck(strWhere);
                if (table != null && table.Rows.Count > 0)
                {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        _model.EC001 = table.Rows [i] ["GZ22"].ToString( );
                        _model.EC002 = table.Rows [i] ["GZ01"].ToString( );
                        _model.EC003 = table.Rows [i] ["GZ23"].ToString( );
                        _model.EC004 = string.IsNullOrEmpty(table.Rows [i] ["GZ34"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["GZ34"].ToString( ));
                        if (string.IsNullOrEmpty(table.Rows [i] ["PQF31"].ToString( )))
                        {
                            _model.EC005 = null;
                        }
                        else
                        {
                            _model.EC005 = Convert.ToDateTime(table.Rows [i] ["PQF31"].ToString( ));
                        }
                        _model.EC015 = 0;
                        _model.EC016 = string.IsNullOrEmpty(table.Rows [i] ["GZ1"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["GZ1"].ToString( ));
                        _model.EC017 = string.IsNullOrEmpty(table.Rows [i] ["GZ"].ToString( )) == true ? 0 : Convert.ToDecimal(table.Rows [i] ["GZ"].ToString( ));
                        if (Exists(_model))
                        {
                            editPack(SQLString, strSql, _model);
                        }
                        else
                        {
                            addPack(SQLString, strSql, _model);
                        }
                    }
                }
            }
            else
            {
                return(false);
            }

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }