Exemplo n.º 1
0
 protected static void Init()
 {
     if (FishEntity.Variable.DictList == null)
     {
         FishBll.Bll.DictBll bll = new FishBll.Bll.DictBll();
         FishEntity.Variable.DictList = bll.GetModelList("isdelete=0");
     }
 }
Exemplo n.º 2
0
        protected void InitDataGridViewColumns()
        {
            dataGridView1.Columns.Clear();
            if (FishEntity.Variable.ProductDataTypeList == null)
            {
                return;
            }
            FishEntity.SystemDataType checkType = FishEntity.Variable.ProductDataTypeList.Find((i) => { return(i.Code == FishEntity.Constant.CheckItem); });
            if (checkType == null)
            {
                return;
            }

            FishBll.Bll.DictBll bll = new FishBll.Bll.DictBll();
            _columns = bll.GetModelList(string.Format(" isdelete=0 and issystem=0 and pcode='{0}' order by pcode asc,orderid asc", checkType.Code));
            if (_columns == null || _columns.Count < 1)
            {
                return;
            }

            try
            {
                DataGridViewColumn col = null;

                foreach (FishEntity.DictEntity item in _columns)
                {
                    col            = new DataGridViewTextBoxColumn();
                    col.HeaderText = item.name;
                    col.Name       = item.code;
                    col.Width      = 80;
                    dataGridView1.Columns.Add(col);

                    col            = new DataGridViewTextBoxColumn();
                    col.HeaderText = item.name + "_id";
                    col.Name       = item.code + "_id";
                    col.Visible    = false;
                    dataGridView1.Columns.Add(col);
                }

                col            = new DataGridViewTextBoxColumn();
                col.Name       = "id";
                col.HeaderText = "id";
                dataGridView1.Columns.Add(col);
                col.Visible = false;

                col            = new DataGridViewTextBoxColumn();
                col.Name       = "line";
                col.HeaderText = "line";
                col.Visible    = false;
                dataGridView1.Columns.Add(col);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
            }
        }
Exemplo n.º 3
0
        public override int Query()
        {
            FishBll.Bll.DictBll          bll  = new FishBll.Bll.DictBll();
            List <FishEntity.DictEntity> list = bll.GetModelList("isdelete=0 and issystem=1 order by pcode asc ,orderid asc");

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = list;

            return(1);
        }
Exemplo n.º 4
0
        public override int Delete()
        {
            //return base.Delete();
            if (dataGridView1.SelectedRows == null)
            {
                MessageBox.Show("请选择要删除的行记录");
                return(0);
            }

            string ids = string.Empty;

            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                if (string.IsNullOrEmpty(ids) == false)
                {
                    ids += ",";
                }
                ids += row.Cells["id"].Value.ToString();
            }
            if (string.IsNullOrEmpty(ids))
            {
                MessageBox.Show("请选择要删除的行记录");
                return(0);
            }

            if (MessageBox.Show("您确定要删除选中的记录吗?", "询问", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
            {
                return(0);
            }


            FishBll.Bll.DictBll bll = new FishBll.Bll.DictBll();
            if (bll.DeleteList(ids))
            {
                FishEntity.Variable.DictList = null;
                Query();
            }
            return(1);
        }
Exemplo n.º 5
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (Check() == false)
            {
                this.DialogResult = System.Windows.Forms.DialogResult.None;
                return;
            }

            bool isAdd = false;

            if (_entity == null)
            {
                _entity          = new FishEntity.DictEntity();
                _entity.isdelete = 0;
                _entity.issystem = _dataType == FishEntity.DataTypeEnum.SYSTEM ? 1 : 0;
                isAdd            = true;
            }
            else
            {
                string code = txtCode.Text.Trim();
                if (_entity.code.Equals(code) == false)
                {
                    FishBll.Bll.DictBll bll = new FishBll.Bll.DictBll();
                    if (bll.Exists(code, cmbType.SelectedValue.ToString(), _entity.issystem))
                    {
                        MessageBox.Show("代码已经存在,请修改其他值。");
                        this.DialogResult = System.Windows.Forms.DialogResult.None;
                        return;
                    }
                }
            }

            _entity.code    = txtCode.Text.Trim();
            _entity.name    = txtName.Text.Trim();
            _entity.pcode   = cmbType.SelectedValue.ToString();
            _entity.orderid = (int)numericUpDown1.Value;
            _entity.remark  = txtRemark.Text.Trim();

            if (_entity.pcode.Equals(FishEntity.Constant.Area))
            {
                _entity.pid = int.Parse(cmbPid.SelectedValue.ToString());
            }
            else if (_entity.pcode.Equals(FishEntity.Constant.Brand))
            {
                _entity.pid = int.Parse(cmbPid.SelectedValue.ToString());
            }
            else
            {
                _entity.pid = 0;
            }

            if (isAdd)
            {
                FishBll.Bll.DictBll bll = new FishBll.Bll.DictBll();
                if (bll.Exists(_entity.code, _entity.pcode, _entity.issystem))
                {
                    MessageBox.Show("代码已经存在,请修改其他值。");
                    this.DialogResult = System.Windows.Forms.DialogResult.None;
                    return;
                }

                bool isOk = bll.Add(_entity);
                if (isOk)
                {
                    OnRefresh();
                }
            }
            else
            {
                FishBll.Bll.DictBll bll = new FishBll.Bll.DictBll();
                bool isOk = bll.Update(_entity);
                if (isOk)
                {
                    OnRefresh();
                }
            }

            InitDataUtil.DictList = null;
        }