Beispiel #1
0
        public FormTestResultRecord( )
        {
            InitializeComponent( );

            _cr          = new MulaolaoLibrary.TestResultRecordCREntity( );
            _cs          = new MulaolaoLibrary.TestResultRecordCSEntity( );
            _ct          = new MulaolaoLibrary.TestResultRecordCTEntity( );
            _bll         = new MulaolaoBll.Bll.TestResultRecordBll( );
            tableView    = new DataTable( );
            tableViewOne = new DataTable( );

            GridViewMoHuSelect.SetFilter(secView);
            GridViewMoHuSelect.SetFilter(gridView1);
            GridViewMoHuSelect.SetFilter(gridView2);
            GrivColumnStyle.setColumnStyle(new DevExpress.XtraGrid.Views.Grid.GridView [] { gridView1, gridView2 });
            MulaolaoBll.UserInfoMation.tableName = this.Name;

            Power(this);
            UnEnable( );

            secPro.Properties.DataSource    = _bll.getProInfo( );
            secPro.Properties.DisplayMember = "PQF04";
            secPro.Properties.ValueMember   = "PQF01";

            reCheckBox.DataSource    = _bll.getTableOfNum( );
            reCheckBox.DisplayMember = "CT";

            tableViewOne            = _bll.getTableViewOne( );
            gridControl2.DataSource = tableViewOne;
        }
Beispiel #2
0
        void delete_cs(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.TestResultRecordCSEntity model)
        {
            strSql = new StringBuilder( );
            strSql.Append("delete from R_PQCS ");
            strSql.Append(" where idx=@idx");
            SqlParameter [] parameters =
            {
                new SqlParameter("@idx", SqlDbType.Int, 4)
            };
            parameters [0].Value = model.idx;

            SQLString.Add(strSql, parameters);
        }
Beispiel #3
0
        void edit_cs(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.TestResultRecordCSEntity model)
        {
            strSql = new StringBuilder( );
            strSql.Append("update R_PQCS set ");
            strSql.Append("CS001=@CS001,");
            strSql.Append("CS002=@CS002,");
            strSql.Append("CS003=@CS003,");
            strSql.Append("CS004=@CS004,");
            strSql.Append("CS005=@CS005,");
            strSql.Append("CS006=@CS006,");
            strSql.Append("CS007=@CS007,");
            strSql.Append("CS008=@CS008,");
            strSql.Append("CS009=@CS009,");
            strSql.Append("CS010=@CS010,");
            strSql.Append("CS011=@CS011 ");
            strSql.Append(" where idx=@idx");
            SqlParameter [] parameters =
            {
                new SqlParameter("@CS001", SqlDbType.NVarChar,  20),
                new SqlParameter("@CS002", SqlDbType.Date,       3),
                new SqlParameter("@CS003", SqlDbType.NVarChar,  50),
                new SqlParameter("@CS004", SqlDbType.NVarChar,  50),
                new SqlParameter("@CS005", SqlDbType.NVarChar,  20),
                new SqlParameter("@CS006", SqlDbType.Date,       3),
                new SqlParameter("@CS007", SqlDbType.Int,        4),
                new SqlParameter("@CS008", SqlDbType.Int,        4),
                new SqlParameter("@CS009", SqlDbType.NVarChar,  50),
                new SqlParameter("@CS010", SqlDbType.NVarChar,  20),
                new SqlParameter("@CS011", SqlDbType.NVarChar, 100),
                new SqlParameter("@idx",   SqlDbType.Int, 4)
            };
            parameters [0].Value  = model.CS001;
            parameters [1].Value  = model.CS002;
            parameters [2].Value  = model.CS003;
            parameters [3].Value  = model.CS004;
            parameters [4].Value  = model.CS005;
            parameters [5].Value  = model.CS006;
            parameters [6].Value  = model.CS007;
            parameters [7].Value  = model.CS008;
            parameters [8].Value  = model.CS009;
            parameters [9].Value  = model.CS010;
            parameters [10].Value = model.CS011;
            parameters [11].Value = model.idx;

            SQLString.Add(strSql, parameters);
        }
Beispiel #4
0
        void add_cs(Hashtable SQLString, StringBuilder strSql, MulaolaoLibrary.TestResultRecordCSEntity model)
        {
            strSql = new StringBuilder( );
            strSql.Append("insert into R_PQCS(");
            strSql.Append("CS001,CS002,CS003,CS004,CS005,CS006,CS007,CS008,CS009,CS010,CS011)");
            strSql.Append(" values (");
            strSql.Append("@CS001,@CS002,@CS003,@CS004,@CS005,@CS006,@CS007,@CS008,@CS009,@CS010,@CS011)");

            SqlParameter [] parameters =
            {
                new SqlParameter("@CS001", SqlDbType.NVarChar, 20),
                new SqlParameter("@CS002", SqlDbType.Date,      3),
                new SqlParameter("@CS003", SqlDbType.NVarChar, 50),
                new SqlParameter("@CS004", SqlDbType.NVarChar, 50),
                new SqlParameter("@CS005", SqlDbType.NVarChar, 20),
                new SqlParameter("@CS006", SqlDbType.Date,      3),
                new SqlParameter("@CS007", SqlDbType.Int,       4),
                new SqlParameter("@CS008", SqlDbType.Int,       4),
                new SqlParameter("@CS009", SqlDbType.NVarChar, 50),
                new SqlParameter("@CS010", SqlDbType.NVarChar, 20),
                new SqlParameter("@CS011", SqlDbType.NVarChar, 100)
            };
            parameters [0].Value  = model.CS001;
            parameters [1].Value  = model.CS002;
            parameters [2].Value  = model.CS003;
            parameters [3].Value  = model.CS004;
            parameters [4].Value  = model.CS005;
            parameters [5].Value  = model.CS006;
            parameters [6].Value  = model.CS007;
            parameters [7].Value  = model.CS008;
            parameters [8].Value  = model.CS009;
            parameters [9].Value  = model.CS010;
            parameters [10].Value = model.CS011;

            SQLString.Add(strSql, parameters);
        }
Beispiel #5
0
        /// <summary>
        /// save data to databse
        /// </summary>
        /// <param name="table">单身</param>
        /// <param name="_cr">单头</param>
        /// <param name="tableOne">系数</param>
        /// <param name="coeList">系数删除</param>
        /// <param name="bodyList">单身删除</param>
        /// <param name="logins">登录人</param>
        /// <returns></returns>
        public bool Save(DataTable table, MulaolaoLibrary.TestResultRecordCREntity _cr, DataTable tableOne, List <string> coeList, List <string> bodyList, string logins)
        {
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );

            if (_cr.idx < 1)
            {
                _cr.CR001 = getOddNum( );
                add_cr(SQLString, strSql, _cr);
                SQLString.Add(Drity.DrityOfComparation("R_418", "产品粘接、组装人员牢固度安全常态抽测结果记录(R_418)", logins, Drity.GetDt( ), _cr.CR001, strSql.ToString( ).Replace("'", "''"), "新增", "新增表头"), null);
            }
            else
            {
                edit_cr(SQLString, strSql, _cr);
                SQLString.Add(Drity.DrityOfComparation("R_418", "产品粘接、组装人员牢固度安全常态抽测结果记录(R_418)", logins, Drity.GetDt( ), _cr.CR001, strSql.ToString( ).Replace("'", "''"), "编辑", "编辑表头"), null);
            }


            MulaolaoLibrary.TestResultRecordCSEntity _cs = new MulaolaoLibrary.TestResultRecordCSEntity( );
            _cs.CS001 = _cr.CR001;
            for (int i = 0; i < table.Rows.Count; i++)
            {
                if (string.IsNullOrEmpty(table.Rows [i] ["CS002"].ToString( )))
                {
                    _cs.CS002 = null;
                }
                else
                {
                    _cs.CS002 = Convert.ToDateTime(table.Rows [i] ["CS002"].ToString( ));
                }
                _cs.CS003 = table.Rows [i] ["CS003"].ToString( );
                _cs.CS004 = table.Rows [i] ["CS004"].ToString( );
                _cs.CS005 = table.Rows [i] ["CS005"].ToString( );
                if (string.IsNullOrEmpty(table.Rows [i] ["CS006"].ToString( )))
                {
                    _cs.CS006 = null;
                }
                else
                {
                    _cs.CS006 = Convert.ToDateTime(table.Rows [i] ["CS006"].ToString( ));
                }
                _cs.CS007 = string.IsNullOrEmpty(table.Rows [i] ["CS007"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["CS007"].ToString( ));
                _cs.CS008 = string.IsNullOrEmpty(table.Rows [i] ["CS008"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["CS008"].ToString( ));
                _cs.CS009 = table.Rows [i] ["CS009"].ToString( );
                _cs.CS010 = table.Rows [i] ["CS010"].ToString( );
                _cs.CS011 = table.Rows [i] ["CS011"].ToString( );
                _cs.idx   = string.IsNullOrEmpty(table.Rows [i] ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(table.Rows [i] ["idx"].ToString( ));
                if (_cs.idx < 1)
                {
                    add_cs(SQLString, strSql, _cs);
                    SQLString.Add(Drity.DrityOfComparation("R_418-" + i, "产品粘接、组装人员牢固度安全常态抽测结果记录(R_418)", logins, Drity.GetDt( ), _cr.CR001, strSql.ToString( ).Replace("'", "''"), "新增", "新增单身"), null);
                }
                else
                {
                    edit_cs(SQLString, strSql, _cs);
                    SQLString.Add(Drity.DrityOfComparation("R_418-" + i, "产品粘接、组装人员牢固度安全常态抽测结果记录(R_418)", logins, Drity.GetDt( ), _cr.CR001, strSql.ToString( ).Replace("'", "''"), "新增", "编辑单身"), null);
                }
            }

            if (bodyList.Count > 0)
            {
                foreach (string s in bodyList)
                {
                    delete_cs(SQLString, strSql, _cs);
                    SQLString.Add(Drity.DrityOfComparation("R_418-" + s, "产品粘接、组装人员牢固度安全常态抽测结果记录(R_418)", logins, Drity.GetDt( ), _cr.CR001, strSql.ToString( ).Replace("'", "''"), "新增", "删除单身"), null);
                }
            }

            MulaolaoLibrary.TestResultRecordCTEntity _ct = new MulaolaoLibrary.TestResultRecordCTEntity( );
            for (int i = 0; i < tableOne.Rows.Count; i++)
            {
                _ct.CT001 = tableOne.Rows [i] ["CT001"].ToString( );
                _ct.CT002 = tableOne.Rows [i] ["CT002"].ToString( );
                _ct.CT003 = tableOne.Rows [i] ["CT003"].ToString( );
                _ct.CT004 = tableOne.Rows [i] ["CT004"].ToString( );
                _ct.CT005 = tableOne.Rows [i] ["CT005"].ToString( );
                _ct.CT006 = tableOne.Rows [i] ["CT006"].ToString( );
                _ct.CT007 = tableOne.Rows [i] ["CT007"].ToString( );
                _ct.CT009 = tableOne.Rows [i] ["CT009"].ToString( );
                _ct.CT010 = tableOne.Rows [i] ["CT010"].ToString( );
                _ct.CT011 = tableOne.Rows [i] ["CT011"].ToString( );
                _ct.CT012 = tableOne.Rows [i] ["CT012"].ToString( );
                _ct.CT013 = tableOne.Rows [i] ["CT013"].ToString( );
                _ct.CT014 = tableOne.Rows [i] ["CT014"].ToString( );
                _ct.idx   = string.IsNullOrEmpty(tableOne.Rows [i] ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(tableOne.Rows [i] ["idx"].ToString( ));
                if (_ct.idx < 1)
                {
                    add_ct(SQLString, strSql, _ct);
                    SQLString.Add(Drity.DrityOfComparation("R_418-" + i, "产品粘接、组装人员牢固度安全常态抽测结果记录(R_418)", logins, Drity.GetDt( ), _cr.CR001, strSql.ToString( ).Replace("'", "''"), "新增", "新增系数"), null);
                }
                else
                {
                    edit_ct(SQLString, strSql, _ct);
                    SQLString.Add(Drity.DrityOfComparation("R_418-" + i, "产品粘接、组装人员牢固度安全常态抽测结果记录(R_418)", logins, Drity.GetDt( ), _cr.CR001, strSql.ToString( ).Replace("'", "''"), "新增", "编辑系数"), null);
                }
            }

            if (coeList.Count > 0)
            {
                foreach (string s in coeList)
                {
                    _ct.idx = Convert.ToInt32(s);
                    delete_dt(SQLString, strSql, _ct);
                    SQLString.Add(Drity.DrityOfComparation("R_418-" + s, "产品粘接、组装人员牢固度安全常态抽测结果记录(R_418)", logins, Drity.GetDt( ), _cr.CR001, strSql.ToString( ).Replace("'", "''"), "新增", "删除系数"), null);
                }
            }

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }