Example #1
0
        /// <summary>保存明细表
        ///
        /// </summary>
        private void DoSaveDetail()
        {
            switch (m_detailStatus)
            {
            case EntityOperationType.新增明细:
                OrderDetail model = EntityOperateManager.AddEntity <OrderDetail>(this.grpDetail);
                model.OrderId = m_orderMaster.OrderId;
                int intReturn = m_orderDetailDAL.Add(model);
                if (intReturn > 0)
                {
                    model.DetailId = intReturn;
                    m_lstOrderDetail.Add(model);
                    ListOrderDetail = m_lstOrderDetail;
                    objListViewDetail.SetObjects(m_lstOrderDetail);
                    objListViewDetail.Refresh();
                    objListViewDetail.SelectedIndex = m_lstOrderDetail.Count - 1;
                }
                break;

            case EntityOperationType.修改明细:
                OrderDetail modelDetail = this.objListViewDetail.SelectedObjects[0] as OrderDetail;
                EntityOperateManager.EditEntity(this.grpDetail, modelDetail);
                bool blnReturn = m_orderDetailDAL.Update(modelDetail);
                if (blnReturn)
                {
                    ListOrderDetail = m_lstOrderDetail;
                }
                break;
            }
            SetMode(EntityOperationType.只读明细);
        }
Example #2
0
        /// <summary>保存主表
        ///
        /// </summary>
        private void DoSave()
        {
            switch (m_masterStatus)
            {
            case EntityOperationType.新增:
                OrderMaster model     = EntityOperateManager.AddEntity <OrderMaster>(this.grpMaster);
                int         intReturn = m_orderMasterDAL.Add(model);
                if (intReturn > 0)
                {
                    m_orderMaster = model;
                    model.OrderId = intReturn;
                    m_lstOrderMaster.Add(model);
                    ListOrderMaster = m_lstOrderMaster;
                    //清空明细列表
                    m_lstOrderDetail.Clear();
                    objListViewDetail.SetObjects(m_lstOrderDetail);
                    objListViewDetail.Refresh();
                }
                break;

            case EntityOperationType.修改:
                m_orderMaster = EntityOperateManager.EditEntity(this.grpMaster, m_orderMaster);
                bool blnReturn = m_orderMasterDAL.Update(m_orderMaster);
                if (blnReturn)
                {
                    ListOrderMaster = m_lstOrderMaster;
                }
                break;
            }
            SetMode(EntityOperationType.只读);
        }
        /// <summary>保存主表
        ///
        /// </summary>
        private void DoSave()
        {
            switch (m_masterStatus)
            {
            case EntityOperationType.新增:
                string strOrderNumberValueNew = txtEditOrderNumber.Text.Trim();
                if (m_OrderMasterDAL.CalcCount("OrderNumber='" + strOrderNumberValueNew + "'") > 0)
                {
                    MessageBox.Show(@"单号已经存在");
                    return;
                }

                OrderMaster model     = EntityOperateManager.AddEntity <OrderMaster>(this.grpMaster);
                int         intReturn = m_OrderMasterDAL.Add(model);
                if (intReturn > 0)
                {
                    m_OrderMaster = model;
                    model.OrderId = intReturn;
                    m_lstOrderMaster.Add(model);
                    ListOrderMaster = m_lstOrderMaster;
                    //清空明细列表
                    m_lstOrderDetail.Clear();
                    objListViewDetail.SetObjects(m_lstOrderDetail);
                    objListViewDetail.Refresh();
                }
                break;

            case EntityOperationType.修改:
                string strOrderNumberValue = txtEditOrderNumber.Text.Trim()
                ;
                if (m_OrderMasterDAL.CalcCount(" OrderId !=" + m_OrderMaster.OrderId + "   and  OrderNumber='" + strOrderNumberValue + "'") > 0)
                {
                    MessageBox.Show(@"单号已经存在");
                    return;
                }

                m_OrderMaster = EntityOperateManager.EditEntity(this.grpMaster, m_OrderMaster);
                bool blnReturn = m_OrderMasterDAL.Update(m_OrderMaster);
                if (blnReturn)
                {
                    ListOrderMaster = m_lstOrderMaster;
                }
                break;
            }
            SetMode(EntityOperationType.只读);
        }
Example #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string strReturnMsg = CheckInput();

            if (strReturnMsg != string.Empty)
            {
                MessageBox.Show(strReturnMsg);
                return;
            }
            //新增
            if (m_TreeListDemo == null)
            {
                TreeListDemo model = EntityOperateManager.AddEntity <TreeListDemo>(this.tabPage);
                model.ParentId = m_intParentId;
                int intReturn = m_TreeListDemoDAL.Add(model);
                if (intReturn > 0)
                {
                    MessageBox.Show(@"添加成功");
                    model.Id = intReturn;
                    m_lstTreeListDemo.Add(model);
                    ListTreeListDemo  = m_lstTreeListDemo;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"添加失败");
                }
            }
            //修改
            else
            {
                m_TreeListDemo = EntityOperateManager.EditEntity(this.tabPage, m_TreeListDemo);
                bool blnReturn = m_TreeListDemoDAL.Update(m_TreeListDemo);
                if (blnReturn)
                {
                    MessageBox.Show(@"修改成功");
                    ListTreeListDemo  = m_lstTreeListDemo;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"修改失败");
                }
            }
        }
Example #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string strReturnMsg = CheckInput();

            if (strReturnMsg != string.Empty)
            {
                MessageBox.Show(strReturnMsg);
                return;
            }
            //新增
            if (m_Sys_Roles == null)
            {
                Sys_Roles model     = EntityOperateManager.AddEntity <Sys_Roles>(this.tabPage);
                int       intReturn = m_Sys_RolesDAL.Add(model);
                if (intReturn > 0)
                {
                    MessageBox.Show(@"添加成功");
                    model.KeyId = intReturn;
                    m_lstSys_Roles.Add(model);
                    ListSys_Roles     = m_lstSys_Roles;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"添加失败");
                }
            }
            //修改
            else
            {
                m_Sys_Roles = EntityOperateManager.EditEntity(this.tabPage, m_Sys_Roles);
                bool blnReturn = m_Sys_RolesDAL.Update(m_Sys_Roles);
                if (blnReturn)
                {
                    MessageBox.Show(@"修改成功");
                    ListSys_Roles     = m_lstSys_Roles;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"修改失败");
                }
            }
        }
Example #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string strReturnMsg = CheckInput();

            if (strReturnMsg != string.Empty)
            {
                MessageBox.Show(strReturnMsg);
                return;
            }
            //新增
            if (m_TreeListDemo == null)
            {
                string strNameValue = txtEditName.Text.Trim()
                ;
                if (m_TreeListDemoDAL.CalcCount("Name='" + strNameValue + "'") > 0)
                {
                    MessageBox.Show(@"名称已经存在");
                    return;
                }

                TreeListDemo model = EntityOperateManager.AddEntity <TreeListDemo>(this.tabPage);
                model.ParentId = m_intParentId;
                int intReturn = m_TreeListDemoDAL.Add(model);
                if (intReturn > 0)
                {
                    MessageBox.Show(@"添加成功");
                    model.Id = intReturn;
                    m_lstTreeListDemo.Add(model);
                    ListTreeListDemo  = m_lstTreeListDemo;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"添加失败");
                }
            }
            //修改
            else
            {
                string strNameValue = txtEditName.Text.Trim()
                ;
                if (m_TreeListDemoDAL.CalcCount(" Id !=" + m_TreeListDemo.Id + "   and  Name='" + strNameValue + "'") > 0)
                {
                    MessageBox.Show(@"名称已经存在");
                    return;
                }

                m_TreeListDemo = EntityOperateManager.EditEntity(this.tabPage, m_TreeListDemo);
                bool blnReturn = m_TreeListDemoDAL.Update(m_TreeListDemo);
                if (blnReturn)
                {
                    MessageBox.Show(@"修改成功");
                    ListTreeListDemo  = m_lstTreeListDemo;
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show(@"修改失败");
                }
            }
        }