Beispiel #1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public bool Save(DataTable table)
        {
            Hashtable SQLString = new Hashtable( );

            LineProductMesEntityu.PowerEntity _model = new LineProductMesEntityu.PowerEntity( );

            foreach (DataRow row in table.Rows)
            {
                _model.idx    = string.IsNullOrEmpty(row ["idx"].ToString( )) == true ? 0 : Convert.ToInt32(row ["idx"]);
                _model.POW002 = row ["POW002"].ToString( );
                _model.POW003 = row ["POW003"].ToString( );
                _model.POW004 = string.IsNullOrEmpty(row ["POW004"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW004"]);
                _model.POW005 = string.IsNullOrEmpty(row ["POW005"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW005"]);
                _model.POW006 = string.IsNullOrEmpty(row ["POW006"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW006"]);
                _model.POW007 = string.IsNullOrEmpty(row ["POW007"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW007"]);
                _model.POW008 = string.IsNullOrEmpty(row ["POW008"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW008"]);
                _model.POW009 = string.IsNullOrEmpty(row ["POW009"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW009"]);
                _model.POW010 = string.IsNullOrEmpty(row ["POW010"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW010"]);
                _model.POW011 = string.IsNullOrEmpty(row ["POW011"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW011"]);
                _model.POW012 = string.IsNullOrEmpty(row ["POW012"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW012"]);
                _model.POW013 = string.IsNullOrEmpty(row ["POW013"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW013"]);
                _model.POW016 = string.IsNullOrEmpty(row ["POW016"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW016"]);
                _model.POW017 = string.IsNullOrEmpty(row ["POW017"].ToString( )) == true ? false : Convert.ToBoolean(row ["POW017"]);
                if (_model.idx > 0)
                {
                    edit(SQLString, _model);
                }
                else
                {
                    add(SQLString, _model);
                }
            }

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }
Beispiel #2
0
        public PowerEdit(string text, LineProductMesEntityu.PowerEntity entity, string nameOfPerson, string nameOfProgram, string sign)
        {
            InitializeComponent( );

            _bll   = new LineProductMesBll.Bll.PowerBll( );
            _model = new LineProductMesEntityu.PowerEntity( );

            this.Text          = text;
            this.sign          = sign;
            this._model        = entity;
            this.nameOfPerson  = nameOfPerson;
            this.nameOfProgram = nameOfProgram;


            if (sign.Equals("edit"))
            {
                lupNamePerson.Enabled = lupNamePro.Enabled = false;
            }
            else
            {
                lupNamePerson.Enabled = lupNamePro.Enabled = true;
            }
            lupNamePerson.Properties.DataSource    = _bll.GetPerson( );
            lupNamePerson.Properties.DisplayMember = "EMP002";
            lupNamePerson.Properties.ValueMember   = "EMP001";
            lupNamePro.Properties.DataSource       = _bll.GetProgram( );
            lupNamePro.Properties.DisplayMember    = "FOR004";
            lupNamePro.Properties.ValueMember      = "FOR003";
        }
Beispiel #3
0
        void edit(Hashtable SQLString, LineProductMesEntityu.PowerEntity _model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("UPDATE MIKPOW SET ");
            strSql.Append("POW002=@POW002,");
            strSql.Append("POW003=@POW003,");
            strSql.Append("POW004=@POW004,");
            strSql.Append("POW005=@POW005,");
            strSql.Append("POW006=@POW006,");
            strSql.Append("POW007=@POW007,");
            strSql.Append("POW008=@POW008,");
            strSql.Append("POW009=@POW009,");
            strSql.Append("POW010=@POW010,");
            strSql.Append("POW011=@POW011,");
            strSql.Append("POW012=@POW012,");
            strSql.Append("POW013=@POW013,");
            strSql.Append("POW016=@POW016,");
            strSql.Append("POW017=@POW017 ");
            strSql.Append("WHERE idx=@idx");
            SqlParameter [] parameter =
            {
                new SqlParameter("@POW002", SqlDbType.NVarChar, 20),
                new SqlParameter("@POW003", SqlDbType.NVarChar, 50),
                new SqlParameter("@POW004", SqlDbType.Bit),
                new SqlParameter("@POW005", SqlDbType.Bit),
                new SqlParameter("@POW006", SqlDbType.Bit),
                new SqlParameter("@POW007", SqlDbType.Bit),
                new SqlParameter("@POW008", SqlDbType.Bit),
                new SqlParameter("@POW009", SqlDbType.Bit),
                new SqlParameter("@POW010", SqlDbType.Bit),
                new SqlParameter("@POW011", SqlDbType.Bit),
                new SqlParameter("@POW012", SqlDbType.Bit),
                new SqlParameter("@POW013", SqlDbType.Bit),
                new SqlParameter("@POW016", SqlDbType.Bit),
                new SqlParameter("@POW017", SqlDbType.Bit),
                new SqlParameter("@idx",    SqlDbType.Int)
            };
            parameter [0].Value  = _model.POW002;
            parameter [1].Value  = _model.POW003;
            parameter [2].Value  = _model.POW004;
            parameter [3].Value  = _model.POW005;
            parameter [4].Value  = _model.POW006;
            parameter [5].Value  = _model.POW007;
            parameter [6].Value  = _model.POW008;
            parameter [7].Value  = _model.POW009;
            parameter [8].Value  = _model.POW010;
            parameter [9].Value  = _model.POW011;
            parameter [10].Value = _model.POW012;
            parameter [11].Value = _model.POW013;
            parameter [12].Value = _model.POW016;
            parameter [13].Value = _model.POW017;
            parameter [14].Value = _model.idx;
            SQLString.Add(strSql, parameter);
        }
Beispiel #4
0
        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="_model"></param>
        /// <returns></returns>
        public bool Exsits(LineProductMesEntityu.PowerEntity _model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("SELECT COUNT(1) COUN FROM MIKPOW ");
            strSql.Append("WHERE POW002=@POW002 AND POW003=@POW003");
            SqlParameter [] parameter =
            {
                new SqlParameter("@POW002", SqlDbType.NVarChar, 50),
                new SqlParameter("@POW003", SqlDbType.NVarChar, 50)
            };
            parameter [0].Value = _model.POW002;
            parameter [1].Value = _model.POW003;

            return(SqlHelper.Exists(strSql.ToString( ), parameter));
        }
Beispiel #5
0
        /// <summary>
        /// 增加一条记录
        /// </summary>
        /// <param name="_model"></param>
        /// <returns></returns>
        public int Add(LineProductMesEntityu.PowerEntity _model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("INSERT INTO MIKPOW (");
            strSql.Append("POW002,POW003,POW004,POW005,POW006,POW007,POW008,POW009,POW010,POW011,POW012,POW013,POW016,POW017) ");
            strSql.Append("VALUES (");
            strSql.Append("@POW002,@POW003,@POW004,@POW005,@POW006,@POW007,@POW008,@POW009,@POW010,@POW011,@POW012,@POW013,@POW016,@POW017);");
            strSql.Append("SELECT SCOPE_IDENTITY();");
            SqlParameter [] parameter =
            {
                new SqlParameter("@POW002", SqlDbType.NVarChar, 20),
                new SqlParameter("@POW003", SqlDbType.NVarChar, 50),
                new SqlParameter("@POW004", SqlDbType.Bit),
                new SqlParameter("@POW005", SqlDbType.Bit),
                new SqlParameter("@POW006", SqlDbType.Bit),
                new SqlParameter("@POW007", SqlDbType.Bit),
                new SqlParameter("@POW008", SqlDbType.Bit),
                new SqlParameter("@POW009", SqlDbType.Bit),
                new SqlParameter("@POW010", SqlDbType.Bit),
                new SqlParameter("@POW011", SqlDbType.Bit),
                new SqlParameter("@POW012", SqlDbType.Bit),
                new SqlParameter("@POW013", SqlDbType.Bit),
                new SqlParameter("@POW016", SqlDbType.Bit),
                new SqlParameter("@POW017", SqlDbType.Bit)
            };
            parameter [0].Value  = _model.POW002;
            parameter [1].Value  = _model.POW003;
            parameter [2].Value  = _model.POW004;
            parameter [3].Value  = _model.POW005;
            parameter [4].Value  = _model.POW006;
            parameter [5].Value  = _model.POW007;
            parameter [6].Value  = _model.POW008;
            parameter [7].Value  = _model.POW009;
            parameter [8].Value  = _model.POW010;
            parameter [9].Value  = _model.POW011;
            parameter [10].Value = _model.POW012;
            parameter [11].Value = _model.POW013;
            parameter [12].Value = _model.POW016;
            parameter [13].Value = _model.POW017;

            return(SqlHelper.ExecuteSqlReturnId(strSql.ToString( ), parameter));
        }
Beispiel #6
0
        public FormPower( )
        {
            InitializeComponent( );

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

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

            _bll   = new LineProductMesBll.Bll.PowerBll( );
            _model = new LineProductMesEntityu.PowerEntity( );

            ToolBarContain.ToolbarsC(barTool, new DevExpress.XtraBars.BarItem [] { toolExport, toolPrint, toolCancellation, toolExamin });

            lookUpEdit1.Properties.DataSource    = _bll.GetPerson( );
            lookUpEdit1.Properties.DisplayMember = "EMP002";
            lookUpEdit1.Properties.ValueMember   = "EMP001";
            tablePro = _bll.GetProgram( );
            lookUpEdit2.Properties.DataSource    = tablePro;
            lookUpEdit2.Properties.DisplayMember = "FOR004";
            lookUpEdit2.Properties.ValueMember   = "FOR003";

            gridView1.OptionsBehavior.Editable = false;
        }
Beispiel #7
0
 public LineProductMesEntityu.PowerEntity getModelPow(DataRow row)
 {
     LineProductMesEntityu.PowerEntity model = new LineProductMesEntityu.PowerEntity( );
     if (row != null)
     {
         if (row ["POW002"] != null)
         {
             model.POW002 = row ["POW002"].ToString( );
         }
         if (row ["POW003"] != null)
         {
             model.POW003 = row ["POW003"].ToString( );
         }
         if (row ["POW004"] != null && row ["POW004"].ToString( ) != "")
         {
             if ((row ["POW004"].ToString( ) == "1") || (row ["POW004"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW004 = true;
             }
             else
             {
                 model.POW004 = false;
             }
         }
         if (row ["POW005"] != null && row ["POW005"].ToString( ) != "")
         {
             if ((row ["POW005"].ToString( ) == "1") || (row ["POW005"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW005 = true;
             }
             else
             {
                 model.POW005 = false;
             }
         }
         if (row ["POW006"] != null && row ["POW006"].ToString( ) != "")
         {
             if ((row ["POW006"].ToString( ) == "1") || (row ["POW006"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW006 = true;
             }
             else
             {
                 model.POW006 = false;
             }
         }
         if (row ["POW007"] != null && row ["POW007"].ToString( ) != "")
         {
             if ((row ["POW007"].ToString( ) == "1") || (row ["POW007"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW007 = true;
             }
             else
             {
                 model.POW007 = false;
             }
         }
         if (row ["POW009"] != null && row ["POW009"].ToString( ) != "")
         {
             if ((row ["POW009"].ToString( ) == "1") || (row ["POW009"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW009 = true;
             }
             else
             {
                 model.POW009 = false;
             }
         }
         if (row ["POW010"] != null && row ["POW010"].ToString( ) != "")
         {
             if ((row ["POW010"].ToString( ) == "1") || (row ["POW010"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW010 = true;
             }
             else
             {
                 model.POW010 = false;
             }
         }
         if (row ["POW011"] != null && row ["POW011"].ToString( ) != "")
         {
             if ((row ["POW011"].ToString( ) == "1") || (row ["POW011"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW011 = true;
             }
             else
             {
                 model.POW011 = false;
             }
         }
         if (row ["POW012"] != null && row ["POW012"].ToString( ) != "")
         {
             if ((row ["POW012"].ToString( ) == "1") || (row ["POW012"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW012 = true;
             }
             else
             {
                 model.POW012 = false;
             }
         }
         if (row ["POW013"] != null && row ["POW013"].ToString( ) != "")
         {
             if ((row ["POW013"].ToString( ) == "1") || (row ["POW013"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW013 = true;
             }
             else
             {
                 model.POW013 = false;
             }
         }
         if (row ["POW016"] != null && row ["POW016"].ToString( ) != "")
         {
             if ((row ["POW016"].ToString( ) == "1") || (row ["POW016"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW016 = true;
             }
             else
             {
                 model.POW016 = false;
             }
         }
         if (row ["POW017"] != null && row ["POW017"].ToString( ) != "")
         {
             if ((row ["POW017"].ToString( ) == "1") || (row ["POW017"].ToString( ).ToLower( ) == "true"))
             {
                 model.POW017 = true;
             }
             else
             {
                 model.POW017 = false;
             }
         }
     }
     return(model);
 }
Beispiel #8
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(sign))
            {
                XtraMessageBox.Show("请重新选择新增或编辑");
                return;
            }
            errorProvider1.Clear( );
            bool isOk = true;

            if (string.IsNullOrEmpty(lupNamePerson.Text))
            {
                errorProvider1.SetError(lupNamePerson, "人员姓名不可为空");
                isOk = false;
            }
            if (string.IsNullOrEmpty(lupNamePro.Text))
            {
                errorProvider1.SetError(lupNamePro, "程序名称不可为空");
                isOk = false;
            }
            if (isOk == false)
            {
                return;
            }

            _model        = new LineProductMesEntityu.PowerEntity( );
            _model.idx    = cekRun.Tag == null ? 0 : int.Parse(cekRun.Tag.ToString( ));
            _model.POW002 = lupNamePerson.EditValue.ToString( );
            _model.POW003 = lupNamePro.EditValue.ToString( );
            _model.POW013 = cekRun.Checked == true ? true : false;
            _model.POW004 = cekQuery.Checked == true ? true : false;
            _model.POW005 = cekAdd.Checked == true ? true : false;
            _model.POW006 = cekDelete.Checked == true ? true : false;
            _model.POW007 = cekEdit.Checked == true ? true : false;
            _model.POW008 = cekReview.Checked == true ? true : false;
            _model.POW009 = cekExamin.Checked == true ? true : false;
            _model.POW010 = cekSave.Checked == true ? true : false;
            _model.POW011 = cekCancel.Checked == true ? true : false;
            _model.POW012 = cekCancell.Checked == true ? true : false;
            _model.POW016 = cekPrint.Checked == true ? true : false;
            _model.POW017 = cekExample.Checked == true ? true : false;

            if (sign.Equals("add"))
            {
                isOk = _bll.Exsits(_model);
                if (isOk == true)
                {
                    XtraMessageBox.Show("" + lupNamePerson.Text + "已经存在" + lupNamePro.Text + "的权限分配记录");
                    return;
                }
                _model.idx = _bll.Add(_model);
                if (_model.idx > 0)
                {
                    XtraMessageBox.Show("新增成功");
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    XtraMessageBox.Show("新增失败,请重试");
                }
            }
            else if (sign.Equals("edit"))
            {
                //int idx = _bll . EditIdx ( _model );
                //if ( _model . idx != idx )
                //{
                //    XtraMessageBox . Show ( "" + lupNamePerson . Text + "已经存在" + lupNamePro . Text + "的权限分配记录" );
                //    return;
                //}
                isOk = _bll.Edit(_model);
                if (isOk == true)
                {
                    XtraMessageBox.Show("编辑成功");
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    XtraMessageBox.Show("编辑失败,请重试");
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// 编辑一条记录
        /// </summary>
        /// <param name="_model"></param>
        /// <returns></returns>
        public bool Edit(LineProductMesEntityu.PowerEntity _model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("UPDATE MIKPOW SET ");
            strSql.Append("POW002=@POW002,");
            strSql.Append("POW003=@POW003,");
            strSql.Append("POW004=@POW004,");
            strSql.Append("POW005=@POW005,");
            strSql.Append("POW006=@POW006,");
            strSql.Append("POW007=@POW007,");
            strSql.Append("POW008=@POW008,");
            strSql.Append("POW009=@POW009,");
            strSql.Append("POW010=@POW010,");
            strSql.Append("POW011=@POW011,");
            strSql.Append("POW012=@POW012,");
            strSql.Append("POW013=@POW013,");
            strSql.Append("POW016=@POW016,");
            strSql.Append("POW017=@POW017 ");
            strSql.Append("WHERE idx=@idx");
            SqlParameter [] parameter =
            {
                new SqlParameter("@POW002", SqlDbType.NVarChar, 20),
                new SqlParameter("@POW003", SqlDbType.NVarChar, 50),
                new SqlParameter("@POW004", SqlDbType.Bit),
                new SqlParameter("@POW005", SqlDbType.Bit),
                new SqlParameter("@POW006", SqlDbType.Bit),
                new SqlParameter("@POW007", SqlDbType.Bit),
                new SqlParameter("@POW008", SqlDbType.Bit),
                new SqlParameter("@POW009", SqlDbType.Bit),
                new SqlParameter("@POW010", SqlDbType.Bit),
                new SqlParameter("@POW011", SqlDbType.Bit),
                new SqlParameter("@POW012", SqlDbType.Bit),
                new SqlParameter("@POW013", SqlDbType.Bit),
                new SqlParameter("@POW016", SqlDbType.Bit),
                new SqlParameter("@POW017", SqlDbType.Bit),
                new SqlParameter("@idx",    SqlDbType.Int)
            };
            parameter [0].Value  = _model.POW002;
            parameter [1].Value  = _model.POW003;
            parameter [2].Value  = _model.POW004;
            parameter [3].Value  = _model.POW005;
            parameter [4].Value  = _model.POW006;
            parameter [5].Value  = _model.POW007;
            parameter [6].Value  = _model.POW008;
            parameter [7].Value  = _model.POW009;
            parameter [8].Value  = _model.POW010;
            parameter [9].Value  = _model.POW011;
            parameter [10].Value = _model.POW012;
            parameter [11].Value = _model.POW013;
            parameter [12].Value = _model.POW016;
            parameter [13].Value = _model.POW017;
            parameter [14].Value = _model.idx;

            int row = SqlHelper.ExecuteNonQuery(strSql.ToString( ), parameter);

            if (row > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #10
0
 /// <summary>
 /// 编辑一条记录
 /// </summary>
 /// <param name="_model"></param>
 /// <returns></returns>
 public bool Edit ( LineProductMesEntityu . PowerEntity _model )
 {
     return dal . Edit ( _model );
 }
Beispiel #11
0
 /// <summary>
 /// 增加一条记录
 /// </summary>
 /// <param name="_model"></param>
 /// <returns></returns>
 public int Add ( LineProductMesEntityu . PowerEntity _model )
 {
     return dal . Add ( _model );
 }
Beispiel #12
0
 /// <summary>
 /// 是否存在
 /// </summary>
 /// <param name="_model"></param>
 /// <returns></returns>
 public bool Exsits ( LineProductMesEntityu . PowerEntity _model )
 {
     return dal . Exsits ( _model );
 }