当前位置: 首页>>代码示例>>C#>>正文


C# BindingSource.EndEdit方法代码示例

本文整理汇总了C#中System.Windows.Forms.BindingSource.EndEdit方法的典型用法代码示例。如果您正苦于以下问题:C# BindingSource.EndEdit方法的具体用法?C# BindingSource.EndEdit怎么用?C# BindingSource.EndEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.BindingSource的用法示例。


在下文中一共展示了BindingSource.EndEdit方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenericEditEvent

        public bool GenericEditEvent(IEditable _geditForm, BindingSource actualEvents, bool isNew = false)
        {
            ulog = UserLog.Instance;

            try
            {
                DataRowView eventDataRowView;
                eventDataRowView = (isNew == false) ? (DataRowView)actualEvents.Current : (DataRowView)actualEvents.AddNew();
                if (eventDataRowView == null)
                    throw new Exception("Нет записей для редактирования.");

                using (IEditable editForm = _geditForm)
                {
                    if (editForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        actualEvents.EndEdit();

                        DateTime dt;
                        string _edit = (isNew == false) ? "Изменено " : "Добавлено ";

                        if (eventDataRowView.Row.Table.Columns.Contains("ActionDate"))
                        {
                            dt = Convert.ToDateTime(eventDataRowView["ActionDate"]);
                            _edit += "мероприятие на " + dt.ToShortDateString() + ".";
                        }
                        else if (eventDataRowView.Row.Table.Columns.Contains("DayID"))
                        {
                            _edit += "календарное мероприятие. День недели: " + DatabaseConstant.LocalDayOfWeek[Convert.ToInt32(eventDataRowView["DayID"]) - 1] + ".";
                        }

                        ulog.Message(_edit, UserLogMessageLevel.Warning);
                        return true;
                    }
                    else
                    {
                        actualEvents.CancelEdit();
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                ulog.Message(ex.Message, UserLogMessageLevel.Error);
                return false;
            }
        }
开发者ID:hprog,项目名称:exchange,代码行数:46,代码来源:CustomForm.cs

示例2: SelectData

        /// <summary>
        /// 选择导入数据
        /// </summary>
        /// <param name="dsDetail">导入目标数据源</param>
        /// <param name="reportno">查询编号</param>
        /// <param name="fields">导入的字段,e.g: a=b,c=d 其中a和c为目标数据源中的字段,b和d为选择数据源中的字段,多个用英文逗号“,”进行分割</param>
        /// <param name="where">选择数据源的过滤条件</param>
        /// <param name="isautoselect">是否默认选中所有数据</param>
        public void SelectData(BindingSource dsDetail, string reportno, string fields, string where,bool isautoselect)
        {
            //数据选择窗体
            frmCommSelectForm frm = new frmCommSelectForm(reportno, where, isautoselect);
            frm.StartPosition = FormStartPosition.CenterParent;
            frm.WindowState = FormWindowState.Normal;
            frm.ReportNo = reportno;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                //解析需要设置值的字段
                string[] fieldstring = Public.GetSplitString(fields, ",");
                List<string> ValueFields = new List<string>();
                List<string> DataFields = new List<string>();
                foreach (string s in fieldstring)
                {
                    string[] ss = Public.GetSplitString(s, "=");
                    DataFields.Add(ss[0]);
                    ValueFields.Add(ss[1]);
                }

                //插入数据
                foreach (DataRow dr in frm.ResultData)
                {
                    dsDetail.AddNew();
                    for (int i = 0; i < DataFields.Count; i++)
                    {
                        ((DataRowView)dsDetail.Current).Row[DataFields[i]] = dr[ValueFields[i]];
                    }
                    dsDetail.EndEdit();
                }
            }
        }
开发者ID:itmpanda,项目名称:sunrise-erp,代码行数:40,代码来源:frmCommSelectForm.cs

示例3: SaveDate

        private void SaveDate()
        {
            gv_RoleFormSet.CloseEditor();
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_RoleFormSet.DataSource);
            gc_RoleFormSet.DataSource = binding;
            binding.EndEdit();
            if (DT.GetChanges() != null)
            {

                ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "Sys_RoleFormSet");
            }
            LoadData();
        }
开发者ID:BGCX262,项目名称:zxerp2013-svn-to-git,代码行数:14,代码来源:Form_Main_RoleFormSet.cs

示例4: GenericEditAction

        public bool GenericEditAction(IEditable _geditForm, BindingSource actualActions, BindingSource groupHeadersList, bool isNew = false)
        {
            ulog = UserLog.Instance;
            try
            {
                DataRowView actionDataRowView;
                actionDataRowView = (isNew == false) ? (DataRowView)actualActions.Current : (DataRowView)actualActions.AddNew();
                if (actionDataRowView == null)
                    throw new Exception("Нет записей для редактирования.");

                using (IEditable editActForm = _geditForm)
                {//открываем форму и сохраняем изменения
                    if (editActForm.ShowDialog() == DialogResult.OK)
                    {
                        actualActions.EndEdit();
                        return true;
                    }
                    else
                    {
                        actualActions.CancelEdit();
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                actualActions.CancelEdit();
                ulog.Message(ex.Message, UserLogMessageLevel.Error);
                return false;
            }
            finally
            {
                groupHeadersList.RemoveFilter();
                groupHeadersList.Filter = "[InList] = 1";
            }
        }
开发者ID:hprog,项目名称:exchange,代码行数:36,代码来源:CustomForm.cs

示例5: DepartmentStockInExtra_Load

        private void DepartmentStockInExtra_Load(object sender, EventArgs e)
        {
            timer1.Start();
            cbbStockOutType.Enabled = false;
            btnReset.Enabled = false;
            cboProductMasters.Enabled = false;

            rdoFastStockOut.Checked = true;
            rdoRetail.Checked = true;
            IList list = new ArrayList();
            if (ClientSetting.IsSubStock())
            {
                list.Add(new StockDefectStatus {DefectStatusId = 7, DefectStatusName = "Xuất đi cửa hàng khác"});
            }
            else
            {
                list.Add(new StockDefectStatus { DefectStatusId = 4, DefectStatusName = "Xuất tạm để sửa hàng" });
                list.Add(new StockDefectStatus { DefectStatusId = 6, DefectStatusName = "Xuất trả về kho chính" });

            }
            DepartmentStockOutEventArgs eventArgs = new DepartmentStockOutEventArgs();
            EventUtility.fireEvent(LoadAllDepartments,this,eventArgs);
            string directDept = "";
            string marketDept = "";
            if(eventArgs.DepartmentsList!= null && eventArgs.DepartmentsList.Count > 0)
            {
                BindingSource bdsDepartment = new BindingSource();
                bdsDepartment.DataSource = typeof (Department);
                cboDepartment.DataSource = bdsDepartment;
                cboDepartment.DisplayMember = "DepartmentName";
                foreach (Department department in eventArgs.DepartmentsList)
                {
                    if (department.DepartmentId != CurrentDepartment.Get().DepartmentId)
                    {
                        /*if (!ClientSetting.IsSubStock())
                        {*/
                            bdsDepartment.Add(department);
                        /*}
                        else
                        {
                            string departmentId = department.DepartmentId.ToString();
                            string currentSubStock = CurrentDepartment.Get().DepartmentId.ToString();
                            if(currentSubStock.StartsWith(departmentId))
                            {
                                bdsDepartment.Add(department);
                                directDept = department.DepartmentName;
                            }
                            if(ClientSetting.MarketDept.Equals(departmentId))
                            {
                                bdsDepartment.Add(department);
                                marketDept = department.DepartmentName;
                            }
                        }*/

                    }
                }
                bdsDepartment.EndEdit();
                cboDepartment.Refresh();
                cboDepartment.Invalidate();
            }

            cbbStockOutType.DataSource = list;
            cbbStockOutType.DisplayMember = "DefectStatusName";
            /*if(!string.IsNullOrEmpty(directDept))
            {
                rdoFastStockOut.Text = " Xuất đến " + directDept;
            }*/
            /*foreach (Department department in cboDepartment.Items)
            {
                string departmentId = department.DepartmentId.ToString();
                string currentSubStock = CurrentDepartment.Get().DepartmentId.ToString();
                if (currentSubStock.StartsWith(departmentId))
                {
                    cboDepartment.SelectedItem = department;
                    cboDepartment.Enabled = false;
                    break;
                }
            }*/

            rdoFastStockOut_CheckedChanged(null, null);
            rdoStockOut_CheckedChanged(null, null);
            deptSODetailList = new DepartmentStockOutDetailCollection(bdsStockIn);
            bdsStockIn.DataSource = deptSODetailList;
            dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError);

            // create DepartmentStockIn
            if (deptSO == null)
            {
                deptSO = new DepartmentStockOut();
                deptSO.CreateDate = DateTime.Now;
                deptSO.UpdateDate = DateTime.Now;
                deptSO.CreateId = ClientInfo.getInstance().LoggedUser.Name;
                deptSO.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                deptSO.ExclusiveKey = 0;
                CreateNewStockInDetail();
            //                btnBarcode.Visible = false;
            //                numericUpDownBarcode.Visible = false;
            //                btnPreview.Visible = false;
                // load products to extra combo box
                LoadProductMasterToComboBox();
//.........这里部分代码省略.........
开发者ID:DelLitt,项目名称:opmscoral,代码行数:101,代码来源:DepartmentFastStockOutForm.cs

示例6: SaveDate

        private void SaveDate()
        {
            if (gv_Common.Editable)
            {
                gv_Common.CloseEditor();
            }
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_Common.DataSource);
            gc_Common.DataSource = binding;
            binding.EndEdit();

            try
            {
                if (DT.GetChanges() != null)
                {

                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "Bas_FormulaByWorking");
                }

            }
            catch (Exception)
            {

                throw;
            }

            LoadData();
        }
开发者ID:BGCX262,项目名称:zxerp2013-svn-to-git,代码行数:28,代码来源:Form_Main_FormulaByWorking.cs

示例7: fillTableAlunos

        private void fillTableAlunos(String turma)
        {
            using (SqlConnection myConnection = new SqlConnection(strConn))
            {
                myConnection.Open();
                String query2 = "select Nome, BI, Nif, DataNascimento as 'Data Nascimento', Email, Morada from GET_ALUNOS where Turma='" + turma + "';";
                SqlDataAdapter dAdapter = new SqlDataAdapter(query2, myConnection);
                SqlCommandBuilder cBuilder = new SqlCommandBuilder(dAdapter);

                DataTable dTable = new DataTable();
                dAdapter.Fill(dTable);

                BindingSource bSource = new BindingSource();
                bSource.DataSource = dTable;

                dataGridViewAlunos.DataSource = bSource;
                dataGridViewAlunos.EndEdit();
                bSource.EndEdit();
                myConnection.Close();
            }
        }
开发者ID:ruineto,项目名称:portfolio,代码行数:21,代码来源:Form1.cs

示例8: SaveDate

        private void SaveDate()
        {
            gv_UpLoad.CloseEditor();
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_UpLoad.DataSource);
            gc_UpLoad.DataSource = binding;
            binding.EndEdit();

            if (DT.GetChanges() != null)
            {
                try
                {
                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "SYS_DOC");
                }
                catch (Exception)
                {

                    throw;
                }

            }
            LoadData();
        }
开发者ID:BGCX262,项目名称:zxerp2013-svn-to-git,代码行数:23,代码来源:Form_Main_UpLoad.cs

示例9: DepartmentStockInExtra_Load

        private void DepartmentStockInExtra_Load(object sender, EventArgs e)
        {
            rdoFastStockIn.Checked = true;

            DepartmentStockInEventArgs eventArgs = new DepartmentStockInEventArgs();
            EventUtility.fireEvent(LoadAllDepartments,this,eventArgs);
            if(eventArgs.DepartmentsList!= null && eventArgs.DepartmentsList.Count > 0)
            {
                BindingSource bdsDepartment = new BindingSource();
                bdsDepartment.DataSource = typeof (Department);
                cboDepartment.DataSource = bdsDepartment;
                cboDepartment.DisplayMember = "DepartmentName";
                foreach (Department department in eventArgs.DepartmentsList)
                {
                    if (department.DepartmentId != CurrentDepartment.Get().DepartmentId)
                    {
                        string deptId = department.DepartmentId.ToString();
                        string currId = CurrentDepartment.Get().DepartmentId.ToString();
                        if(currId.StartsWith(deptId))
                        {
                            bdsDepartment.Add(department);
                        }
                    }
                    if (ClientSetting.MarketDept.Equals(department.DepartmentId.ToString()))
                    {
                        bdsDepartment.Add(department);
                    }
                }
                bdsDepartment.EndEdit();
                cboDepartment.Refresh();
                cboDepartment.Invalidate();
            }

            foreach (Department department in cboDepartment.Items)
            {
                string departmentId = department.DepartmentId.ToString();
                string currentSubStock = CurrentDepartment.Get().DepartmentId.ToString();
                if (currentSubStock.StartsWith(departmentId))
                {
                    cboDepartment.SelectedItem = department;
                    cboDepartment.Enabled = false;
                    break;
                }
            }

            deptSODetailList = new DepartmentStockInDetailCollection(bdsStockIn);
            bdsStockIn.DataSource = deptSODetailList;
            dgvDeptStockIn.DataError += new DataGridViewDataErrorEventHandler(dgvDeptStockIn_DataError);
            UpdateStockOutDescription();
            GlobalMessage message = (GlobalMessage)GlobalUtility.GetObject("GlobalMessage");
            message.HasNewMessageEvent += new EventHandler<GlobalMessageEventArgs>(Instance_HasNewMessageEvent);
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:52,代码来源:DepartmentFastStockInForm.cs

示例10: SaveDate

        private void SaveDate()
        {
            this.gv_CustomerMaster.CloseEditor();
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_Customer.DataSource);
            gc_Customer.DataSource = binding;
            binding.EndEdit();

            if (DTCustomer.GetChanges() != null)
            {
                try
                {
                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DTCustomer.GetChanges(), "Bas_Customer");
                }
                catch (Exception)
                {

                    throw;
                }

            }
            LoadData();
        }
开发者ID:BGCX262,项目名称:zxerp2013-svn-to-git,代码行数:23,代码来源:Form_Main_Client.cs

示例11: SaveDate

        private void SaveDate()
        {
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)dgv_Common.DataSource);
            dgv_Common.DataSource = binding;
            binding.EndEdit();

            if (DT.GetChanges() != null)
            {

                ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "Bas_BoardQualityPrice");
            }
            LoadData();
        }
开发者ID:BGCX262,项目名称:zxerp2013-svn-to-git,代码行数:14,代码来源:Form_Main_BoardQualityPrice.cs

示例12: SaveDate

        private void SaveDate()
        {
            BindingSource binding=new BindingSource();
            binding.DataSource = ((DataTable)gc_Common.DataSource);
            gc_Common.DataSource = binding;
            binding.EndEdit();

            if (DT.GetChanges() != null)
            {
                try
                {
                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DT.GetChanges(), "Bas_PartType");
                }
                catch (Exception)
                {

                    throw;
                }

            }
            LoadData();
        }
开发者ID:BGCX262,项目名称:zxerp2013-svn-to-git,代码行数:22,代码来源:Form_Main_PartType.cs

示例13: SaveDateWStitch

        private void SaveDateWStitch()
        {
            this.gv_WStitch.CloseEditor();
            BindingSource binding = new BindingSource();
            binding.DataSource = ((DataTable)gc_WStitch.DataSource);
            gc_WStitch.DataSource = binding;
            binding.EndEdit();

            if (DTWStitch.GetChanges() != null)
            {
                try
                {
                    ZX.ZXSystem.DBUtility.DbHelperSQL.UpdateTable(DTWStitch.GetChanges(), "PP_WStitch");
                }
                catch (Exception)
                {

                    throw;
                }

            }
        }
开发者ID:BGCX262,项目名称:zxerp2013-svn-to-git,代码行数:22,代码来源:Form_Main_ProductProcess.cs

示例14: CreateNewBlankPurchaseOrderDetail

        private void CreateNewBlankPurchaseOrderDetail(BindingSource bill)
        {
            PurchaseOrderDetail orderDetail = (PurchaseOrderDetail)bill.AddNew();
            orderDetail.CreateId = ClientInfo.getInstance().LoggedUser.Name;
            orderDetail.CreateDate = DateTime.Now;
            orderDetail.UpdateDate = DateTime.Now;
            orderDetail.UpdateId = orderDetail.CreateId;
            orderDetail.DelFlg = 0;
            orderDetail.DepartmentId = CurrentDepartment.Get().DepartmentId;
            orderDetail.Quantity = 1;

            PurchaseOrderDetailPK purchaseOrderDetailPK = new PurchaseOrderDetailPK();
            purchaseOrderDetailPK.DepartmentId = CurrentDepartment.Get().DepartmentId;
            orderDetail.PurchaseOrderDetailPK = purchaseOrderDetailPK;

            // new product to test
            ProductMaster productMaster = new ProductMaster();
            orderDetail.ProductMaster = productMaster;
            Product product = new Product();
            product.ProductMaster = orderDetail.ProductMaster;
            orderDetail.Product = product;
            bill.EndEdit();
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:23,代码来源:GoodsSaleReturnForm.cs


注:本文中的System.Windows.Forms.BindingSource.EndEdit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。