예제 #1
0
 void Edit(Hashtable SQLString, StringBuilder strSql, LineProductMesEntityu.MainEntity model)
 {
     strSql = new StringBuilder( );
     strSql.Append("update MIKFOR set ");
     strSql.Append("FOR003=@FOR003,");
     strSql.Append("FOR004=@FOR004,");
     strSql.Append("FOR005=@FOR005,");
     strSql.Append("FOR006=@FOR006 ");
     strSql.Append(" WHERE FOR001=@FOR001 AND ");
     strSql.Append("FOR002=@FOR002");
     SqlParameter [] parameters =
     {
         new SqlParameter("@FOR001", SqlDbType.Int,        4),
         new SqlParameter("@FOR002", SqlDbType.Int,        4),
         new SqlParameter("@FOR003", SqlDbType.NVarChar,  50),
         new SqlParameter("@FOR004", SqlDbType.NVarChar,  50),
         new SqlParameter("@FOR005", SqlDbType.NVarChar, 100),
         new SqlParameter("@FOR006", SqlDbType.VarChar, 10)
     };
     parameters [0].Value = model.FOR001;
     parameters [1].Value = model.FOR002;
     parameters [2].Value = model.FOR003;
     parameters [3].Value = model.FOR004;
     parameters [4].Value = model.FOR005;
     parameters [5].Value = model.FOR006;
     SQLString.Add(strSql, parameters);
 }
예제 #2
0
파일: MainDao.cs 프로젝트: icprog/MiKe
 public LineProductMesEntityu.MainEntity getModel(DataRow row)
 {
     LineProductMesEntityu.MainEntity model = new LineProductMesEntityu.MainEntity( );
     if (row != null)
     {
         if (row ["FOR001"] != null && row ["FOR001"].ToString( ) != "")
         {
             model.FOR001 = int.Parse(row ["FOR001"].ToString( ));
         }
         if (row ["FOR002"] != null && row ["FOR002"].ToString( ) != "")
         {
             model.FOR002 = int.Parse(row ["FOR002"].ToString( ));
         }
         if (row ["FOR003"] != null)
         {
             model.FOR003 = row ["FOR003"].ToString( );
         }
         if (row ["FOR004"] != null)
         {
             model.FOR004 = row ["FOR004"].ToString( );
         }
         if (row ["FOR005"] != null)
         {
             model.FOR005 = row ["FOR005"].ToString( );
         }
     }
     return(model);
 }
예제 #3
0
        protected override int Edit( )
        {
            if (model == null)
            {
                XtraMessageBox.Show("请选择需要编辑的内容");
                return(0);
            }
            ProControlChild form = new ProControlChild("编辑", model);

            form.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            if (form.ShowDialog( ) == System.Windows.Forms.DialogResult.OK)
            {
                model = form.getModel;
                if (model == null)
                {
                    return(0);
                }
                DataRow row = tableView.Rows [selectIndex];
                row.BeginEdit( );
                setValue(row);
                row.EndEdit( );
                gridControl1.RefreshDataSource( );
            }

            return(base.Edit( ));
        }
예제 #4
0
 void Add(Hashtable SQLString, StringBuilder strSql, LineProductMesEntityu.MainEntity model)
 {
     strSql = new StringBuilder( );
     strSql.Append("insert into MIKFOR(");
     strSql.Append("FOR001,FOR002,FOR003,FOR004,FOR005,FOR006)");
     strSql.Append(" values (");
     strSql.Append("@FOR001,@FOR002,@FOR003,@FOR004,@FOR005,@FOR006)");
     strSql.Append(";select @@IDENTITY");
     SqlParameter [] parameters =
     {
         new SqlParameter("@FOR001", SqlDbType.Int,        4),
         new SqlParameter("@FOR002", SqlDbType.Int,        4),
         new SqlParameter("@FOR003", SqlDbType.NVarChar,  50),
         new SqlParameter("@FOR004", SqlDbType.NVarChar,  50),
         new SqlParameter("@FOR005", SqlDbType.NVarChar, 100),
         new SqlParameter("@FOR006", SqlDbType.VarChar, 10)
     };
     parameters [0].Value = model.FOR001;
     parameters [1].Value = model.FOR002;
     parameters [2].Value = model.FOR003;
     parameters [3].Value = model.FOR004;
     parameters [4].Value = model.FOR005;
     parameters [5].Value = model.FOR006;
     SQLString.Add(strSql, parameters);
 }
예제 #5
0
        /// <summary>
        /// 是否存在节点和父节点
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        bool Exists(LineProductMesEntityu.MainEntity model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.AppendFormat("SELECT COUNT(1) FROM MIKFOR WHERE FOR001={0} AND FOR002={1}", model.FOR001, model.FOR002);

            return(SqlHelper.Exists(strSql.ToString( )));
        }
예제 #6
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Save(LineProductMesEntityu.MainEntity model)
        {
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );

            if (Exists(model))
            {
                Edit(SQLString, strSql, model);
            }
            else
            {
                Add(SQLString, strSql, model);
            }

            return(SqlHelper.ExecuteSqlTran(SQLString));
        }
예제 #7
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Delete(LineProductMesEntityu.MainEntity model)
        {
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("DELETE FROM MIKFOR ");
            strSql.Append("WHERE FOR001=@FOR001 AND FOR002=@FOR002");
            SqlParameter [] parameter =
            {
                new SqlParameter("@FOR001", SqlDbType.Int, 4),
                new SqlParameter("@FOR002", SqlDbType.Int, 4)
            };
            parameter [0].Value = model.FOR001;
            parameter [1].Value = model.FOR002;

            return(SqlHelper.ExecuteNonQueryResult(strSql.ToString( ), parameter));
        }
예제 #8
0
        private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            selectIndex = gridView1.FocusedRowHandle;
            DataRow row = gridView1.GetFocusedDataRow( );

            if (row == null)
            {
                return;
            }
            model        = new LineProductMesEntityu.MainEntity( );
            model.FOR001 = Convert.ToInt32(row ["FOR001"]);
            model.FOR002 = Convert.ToInt32(row ["FOR002"]);
            model.FOR003 = row ["FOR003"].ToString( );
            model.FOR004 = row ["FOR004"].ToString( );
            model.FOR005 = row ["FOR005"].ToString( );
            model.FOR006 = row ["FOR006"].ToString( );
        }
예제 #9
0
        public ProControlChild(string text, LineProductMesEntityu.MainEntity model)
        {
            InitializeComponent( );

            _bll = new LineProductMesBll.Bll.ProControlBll( );
            GridViewMoHuSelect.SetFilter(View);
            GrivColumnStyle.setColumnStyle(new DevExpress.XtraGrid.Views.Grid.GridView [] { this.View });
            FieldInfo fi = typeof(XPaint).GetField("graphics", BindingFlags.Static | BindingFlags.NonPublic);

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

            this.Text = this.Text + text;
            getTable( );

            this.model = model;
            setValue( );
        }
예제 #10
0
        protected override int Add( )
        {
            ProControlChild form = new ProControlChild("新增", model);

            form.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            if (form.ShowDialog( ) == System.Windows.Forms.DialogResult.OK)
            {
                model = form.getModel;
                if (model == null)
                {
                    return(0);
                }
                DataRow row = tableView.NewRow( );
                setValue(row);
                tableView.Rows.Add(row);
                gridControl1.RefreshDataSource( );
            }

            return(base.Add( ));
        }
예제 #11
0
파일: FormMain.cs 프로젝트: icprog/MiKe
 void findAllBtn(Control control)
 {
     foreach (Control btn in control.Controls)
     {
         if (btn.GetType( ) == typeof(Button))
         {
             if (btn.Tag != null)
             {
                 LineProductMesEntityu.MainEntity model = getModel.Find((x) =>
                 {
                     return(x.FOR003 == btn.Tag.ToString( ));
                 });
                 if (model == null)
                 {
                     btn.Enabled = false;
                 }
             }
         }
     }
 }
예제 #12
0
        protected bool getValue( )
        {
            if (string.IsNullOrEmpty(txtPid.Text))
            {
                XtraMessageBox.Show("请选择父节点");
                return(false);
            }
            if (string.IsNullOrEmpty(txtId.Text))
            {
                XtraMessageBox.Show("请选择子节点");
                return(false);
            }
            if (string.IsNullOrEmpty(txtType.Text))
            {
                XtraMessageBox.Show("请程序类别");
                return(false);
            }
            int outResult = 0;

            if (!string.IsNullOrEmpty(txtId.Text) && int.TryParse(txtId.Text, out outResult) == false)
            {
                XtraMessageBox.Show("节点为整数");
                return(false);
            }
            if (string.IsNullOrEmpty(txtProName.Text))
            {
                XtraMessageBox.Show("请填写程序名称");
                return(false);
            }
            model        = new LineProductMesEntityu.MainEntity( );
            model.FOR001 = Convert.ToInt32(txtId.Text);
            model.FOR002 = Convert.ToInt32(txtPid.EditValue);
            model.FOR003 = txtProId.Text;
            model.FOR004 = txtProName.Text;
            model.FOR005 = txtTable.Text;
            model.FOR006 = txtType.Text;

            return(true);
        }
예제 #13
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            if (model == null)
            {
                XtraMessageBox.Show("请选择需要编辑的内容");
                return;
            }
            ProControlChild form = new ProControlChild("编辑", model);

            form.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            if (form.ShowDialog( ) == System.Windows.Forms.DialogResult.OK)
            {
                model = form.getModel;
                if (model == null)
                {
                    return;
                }
                DataRow row = tableView.Rows [selectIndex];
                row.BeginEdit( );
                setValue(row);
                row.EndEdit( );
                gridControl1.RefreshDataSource( );
            }
        }
예제 #14
0
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Delete(LineProductMesEntityu.MainEntity model)
 {
     return(dal.Delete(model));
 }
예제 #15
0
 /// <summary>
 /// 保存数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Save(LineProductMesEntityu.MainEntity model)
 {
     return(dal.Save(model));
 }