Example #1
0
        public void IsEdit()
        {
            DataTable dt = DataProvider.CreateParentDataTable();
            DataView  dv = new DataView(dt);

            DataRowView drv = dv[0];

            // default value
            Assert.False(drv.IsEdit);

            // after BeginEdit
            drv.BeginEdit();
            Assert.True(drv.IsEdit);

            // after CancelEdit
            drv.CancelEdit();
            Assert.False(drv.IsEdit);

            // after BeginEdit again
            drv.BeginEdit();
            Assert.True(drv.IsEdit);

            // after EndEdit
            drv.EndEdit();
            Assert.False(drv.IsEdit);
        }
        private void dgvPayments_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
        {
            this.dgvPayments.SuspendLayout();
            this.dgvPayments.DataBindingComplete -= new DataGridViewBindingCompleteEventHandler(dgvPayments_DataBindingComplete);

            foreach (DataGridViewRow dgr in dgvPayments.Rows)
            {
                DataRowView drv = (DataRowView)dgr.DataBoundItem;
                drv.BeginEdit();
                double dblRemainingBalance = 0;

                if (Double.TryParse(drv["remaining"].ToString(), out dblRemainingBalance))
                {
                    if (dblRemainingBalance == 0)
                    {
                        drv.BeginEdit();
                        drv["apply"] = 0;
                        drv.EndEdit();
                        dgr.DefaultCellStyle.BackColor = System.Drawing.SystemColors.ControlLight;
                        dgr.Cells["apply"].ReadOnly    = true;
                    }
                }
                drv.EndEdit();
            }
            this.dgvPayments.DataBindingComplete += new DataGridViewBindingCompleteEventHandler(dgvPayments_DataBindingComplete);
            this.dgvPayments.ResumeLayout(false);
            dgvPayments_CreateTotalAmount(this, new DataGridViewCellEventArgs(1, 0));
        }
Example #3
0
        [Test] public void IsEdit()
        {
            DataTable dt = DataProvider.CreateParentDataTable();
            DataView  dv = new DataView(dt);

            DataRowView drv = dv[0];

            // default value
            Assert.AreEqual(false, drv.IsEdit, "DRV30");

            // after BeginEdit
            drv.BeginEdit();
            Assert.AreEqual(true, drv.IsEdit, "DRV31");

            // after CancelEdit
            drv.CancelEdit();
            Assert.AreEqual(false, drv.IsEdit, "DRV32");

            // after BeginEdit again
            drv.BeginEdit();
            Assert.AreEqual(true, drv.IsEdit, "DRV33");

            // after EndEdit
            drv.EndEdit();
            Assert.AreEqual(false, drv.IsEdit, "DRV34");
        }
Example #4
0
        //Activate This Construntor to log All To Standard output
        //public TestClass():base(true){}

        //Activate this constructor to log Failures to a log file
        //public TestClass(System.IO.TextWriter tw):base(tw, false){}


        //Activate this constructor to log All to a log file
        //public TestClass(System.IO.TextWriter tw):base(tw, true){}

        //BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

        public void run()
        {
            Exception exp = null;
            DataTable dt  = GHTUtils.DataProvider.CreateParentDataTable();
            DataView  dv  = new DataView(dt);

            DataRowView drv = dv[0];

            try
            {
                BeginCase("default value");
                Compare(drv.IsEdit, false);
            }
            catch (Exception ex)     { exp = ex; }
            finally { EndCase(exp); exp = null; }

            try
            {
                BeginCase("after BeginEdit");
                drv.BeginEdit();
                Compare(drv.IsEdit, true);
            }
            catch (Exception ex)     { exp = ex; }
            finally { EndCase(exp); exp = null; }

            try
            {
                BeginCase("after CancelEdit");
                drv.CancelEdit();
                Compare(drv.IsEdit, false);
            }
            catch (Exception ex)     { exp = ex; }
            finally { EndCase(exp); exp = null; }

            try
            {
                BeginCase("after BeginEdit again");
                drv.BeginEdit();
                Compare(drv.IsEdit, true);
            }
            catch (Exception ex)     { exp = ex; }
            finally { EndCase(exp); exp = null; }

            try
            {
                BeginCase("after EndEdit ");
                drv.EndEdit();
                Compare(drv.IsEdit, false);
            }
            catch (Exception ex)     { exp = ex; }
            finally { EndCase(exp); exp = null; }
        }
Example #5
0
 private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (e.Column.Caption == "特征值")
     {
         ComboBoxSoucer soucer = e.Value as ComboBoxSoucer;
         DataRowView    drv    = this.bindingSource1.Current as DataRowView;
         if (soucer.DEBH != null)
         {
             if (soucer.DEBH["TZDEH"] != null)
             {
                 if (!string.IsNullOrEmpty(soucer.DEBH["TZDEH"].ToString()))
                 {
                     if (!DE.Contains(drv))
                     {
                         DE.Add(drv);
                     }
                 }
                 soucer.DEBH["TZMC"] = drv["TEZMC"] + ":" + soucer.TZname;
             }
         }
         drv.BeginEdit();
         drv["Remark"] = soucer.TZname;
         drv.EndEdit();
     }
     BindDE();
 }
Example #6
0
 private void treeList2_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     DevExpress.XtraTreeList.TreeList        gv = sender as DevExpress.XtraTreeList.TreeList;
     DevExpress.XtraTreeList.TreeListHitInfo hi = gv.CalcHitInfo(e.Location);
     if (hi.Node != null)
     {
         object      o    = gv.GetDataRecordByNode(hi.Node);
         DataRowView info = o as DataRowView;
         string      str  = string.Empty;
         if (info["LB"].Equals("清单"))
         {
             str = info["XMMC"].ToString();
         }
         else
         {
             if (info["SSLB"].Equals(0))
             {
                 str = "分部分项";
             }
         }
         if (str != string.Empty)
         {
             DataRowView view = this.bindingSource1.Current as DataRowView;
             if (view != null)
             {
                 view.BeginEdit();
                 view["location"] = str;
                 view.EndEdit();
                 this.treeList1.HideEditor();
             }
         }
     }
 }
Example #7
0
        /// <summary>
        /// Добавляет отношения Оператор-Организация,которых не хватает до полноты
        /// </summary>
        /// <param name="operRow">Строка с данными об опрераторе</param>
        /// <param name="orgBS"> Биндинг сорс с привязкой к таблице организацый</param>
        /// <param name="operOrgRelationBS">Биндинг сорс с привязкой к к таблице с данными отношения Операторов и Организаций</param>
        private void AddRelationsIfNeed(DataRowView operRow, BindingSource orgBS, BindingSource operOrgRelationBS)
        {
            string oldFilter = operOrgRelationBS.Filter;
            int    oldPos    = operOrgRelationBS.Position;

            operOrgRelationBS.Filter = string.Format("{0} = {1}", OperatorOrg.operatorID, operRow[Operator.id]);
            string priveledgeCode = IsAdminCurrent(operRow) ? _adminCode : new string('0', CodeLength);

            foreach (DataRowView orgRow in orgBS)
            {
                if (operOrgRelationBS.Find(OperatorOrg.orgID, orgRow[Org.id]) <= -1)
                {
                    long id = GetMaxID(operOrgRelationBS.DataSource as DataTable, OperatorOrg.id);
                    id = (id == -1) ? 1 : id + 1;
                    DataRowView newRow = operOrgRelationBS.AddNew() as DataRowView;
                    newRow.BeginEdit();
                    newRow[OperatorOrg.id]         = id;
                    newRow[OperatorOrg.operatorID] = operRow[Operator.id];
                    newRow[OperatorOrg.orgID]      = orgRow[Org.id];
                    newRow[OperatorOrg.code]       = priveledgeCode;
                    newRow.EndEdit();
                }
            }
            operOrgRelationBS.Filter   = oldFilter;
            operOrgRelationBS.Position = oldPos;
        }
Example #8
0
        public void EndEdit()
        {
            DataTable dt = DataProvider.CreateParentDataTable();
            DataView  dv = new DataView(dt);

            DataRowView drv = dv[0];

            drv.BeginEdit();
            drv["String1"] = "ChangeValue";

            //the row should be stay in edit mode event if changing other rows
            // check IsEdit - change another row
            dv[1]["String1"] = "something";
            Assert.True(drv.IsEdit);

            // check if has Proposed version
            drv.EndEdit();
            Assert.False(dt.Rows[0].HasVersion(DataRowVersion.Proposed));

            // check Current value
            Assert.Equal("ChangeValue", dt.Rows[0]["String1", DataRowVersion.Current]);

            // check IsEdit
            Assert.False(drv.IsEdit);
        }
Example #9
0
        private void ChangeDECJ(DataRowView view)
        {
            if (view != null)
            {
                string   _caj   = view["DECJ"].ToString();
                string   Str    = "";
                string[] _CaiBh = _caj.Split('|');
                for (int i = 0; i < _CaiBh.Length; i++)
                {
                    DataRow row = dt.Rows.Find(_CaiBh[i].Split(',')[0]);
                    if (row != null)
                    {
                        //_CaiBh[i].Split(',')[2] = row["SCDJ"].ToString();
                        decimal d = ToolKit.ParseDecimal(row["fl"]) * 0.01m;
                        Str += _CaiBh[i].Split(',')[0] + "," + d + "," + row["SCDJ"].ToString() + "|";
                        //row["fl"] = _CaiBh[i].Split(',')[1];
                        //Fiter += "'" + _CaiBh[i].Split(',')[0] + "',";
                    }
                }

                if (!string.IsNullOrEmpty(Str))
                {
                    view.BeginEdit();
                    view["DECJ"] = Str;
                    view.EndEdit();
                }
            }
        }
Example #10
0
 private void RowEditEndingSpl(Object selecteditem)
 {
     try
     {
         if (selecteditem != null)
         {
             SelectedItemSpl = (DataRowView)selecteditem;
             if (SelectedItemSpl["FEATURE"].ToString() != "" || SelectedItemSpl["ISR_NO"].ToString() != "" || SelectedItemSpl["SPEC_CHAR"].ToString() != "")
             {
                 if (CPGModel.SplCharacteristcsDetails[CPGModel.SplCharacteristcsDetails.Count - 1]["FEATURE"].ToString() != "" || CPGModel.SplCharacteristcsDetails[CPGModel.SplCharacteristcsDetails.Count - 1]["ISR_NO"].ToString() != "" || CPGModel.SplCharacteristcsDetails[CPGModel.SplCharacteristcsDetails.Count - 1]["SPEC_CHAR"].ToString() != "")
                 {
                     DataRowView drv = CPGModel.SplCharacteristcsDetails.AddNew();
                     drv.BeginEdit();
                     drv["SNO"] = CPGModel.SplCharacteristcsDetails.Count;
                     drv.EndEdit();
                     NotifyPropertyChanged("CPGModel");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex.LogException();
     }
 }
    private void dtGrid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
    {
        myBuilder = new MySqlCommandBuilder(myDataAdapter);
        DataRowView myDRV = (DataRowView)dtGrid.SelectedItem;

        myDRV.BeginEdit();
    }
Example #12
0
        /// <summary>
        /// 重新设置所有行的顺序

        /// </summary>
        internal void m_mthSetAllOrderSort()
        {
            if (m_objViewer.m_dtvCurrentView == null)
            {
                return;
            }

            int         intRowsCount = m_objViewer.m_dtvCurrentView.Count;
            string      strHeader    = m_strGetOrderIDHeader();
            DataRowView drvTemp      = null;

            for (int iRow = 0; iRow < intRowsCount; iRow++)
            {
                drvTemp = m_objViewer.m_dtvCurrentView[iRow];
                string strOrderID = drvTemp["checkmedicineorder_chr"].ToString();   //当前保存顺序号

                string strRightOrder = strHeader + (iRow + 1).ToString("00000000"); //正确的顺序号
                if (strOrderID != strRightOrder)
                {
                    drvTemp.BeginEdit();
                    drvTemp["checkmedicineorder_chr"] = strRightOrder;
                    drvTemp.EndEdit();
                }
            }

            m_lngSaveMedicinOrder();
        }
Example #13
0
        public void CopyFromTo(DataRowView drvfrom, DataRowView drvto)
        {
            if (drvfrom == null || drvto == null)
            {
                return;
            }
            if (!drvfrom.Row.GetType().Equals(drvto.Row.GetType()))
            {
                return;
            }

            DataRow   row_from = drvfrom.Row;
            DataRow   row_to   = drvto.Row;
            DataTable table    = row_from.Table;

            drvto.BeginEdit();
            for (int i = 0; i < drvto.Row.ItemArray.Length; i++)
            {
                if (table.Columns[i].ReadOnly)
                {
                    continue;
                }
                if (table.Columns[i].AutoIncrement)
                {
                    continue;
                }
                drvto[i] = row_to[i];
            }
            drvto.EndEdit();
        }
Example #14
0
        private bool DoEdit()
        {
            if ((this.OptMain == OperateType.optNew) || (this.OptMain == OperateType.optEdit))
            {
                MessageBox.Show("对不起,当前正处于编辑状态!");
                return(false);
            }
            if (this.bindingSource_Main.Count == 0)
            {
                MessageBox.Show("对不起,无数据可修改!");
                return(false);
            }
            DataRowView current = (DataRowView)this.bindingSource_Main.Current;

            if (current == null)
            {
                MessageBox.Show("对不起,无数据可修改!");
                return(false);
            }
            this.OptMain = OperateType.optEdit;
            current.BeginEdit();
            this.CtrlOptButtons(this.tlbMain, this.panel_Edit, this.OptMain, base.DBDataSet.Tables[this.strTbNameMain]);
            this.CtrlControlReadOnly(this.panel_Edit, true);
            this.textBox_cMAName.SelectAll();
            this.textBox_cMAName.Focus();
            return(false);
        }
Example #15
0
        [Test] public void CancelEdit()
        {
            DataTable dt = DataProvider.CreateParentDataTable();
            DataView  dv = new DataView(dt);

            DataRowView drv = dv[0];

            drv.BeginEdit();
            drv["String1"] = "ChangeValue";

            // check Proposed value
            Assert.AreEqual("ChangeValue", dt.Rows[0]["String1", DataRowVersion.Proposed], "DRV5");

            // check IsEdit
            Assert.AreEqual(true, drv.IsEdit, "DRV6");

            // check Proposed value
            drv.CancelEdit();
            Assert.AreEqual(false, dt.Rows[0].HasVersion(DataRowVersion.Proposed), "DRV7");

            // check current value
            Assert.AreEqual("1-String1", dt.Rows[0]["String1", DataRowVersion.Current], "DRV8");

            // check IsEdit after cancel edit
            Assert.AreEqual(false, drv.IsEdit, "DRV9");
        }
Example #16
0
        private void updateButton_Click(object sender, RoutedEventArgs e)
        {
            DataSet _dc = dc.Copy();

            if (peopleDataGrid.SelectedItem != null)
            {
                DataRowView newRow = (DataRowView)peopleDataGrid.SelectedItem;

                newRow.BeginEdit();
                ChildWindow childWindow = new ChildWindow(newRow.Row, _dc);
                childWindow.ShowDialog();
                if (childWindow.DialogResult.HasValue && childWindow.DialogResult.Value)
                {
                    newRow.EndEdit();
                    adapter.Update(dt);
                }
                else
                {
                    newRow.CancelEdit();
                }
            }
            else
            {
                MessageBox.Show("Выберите строку");
            }
        }
Example #17
0
 private void btnSP_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try {
         int[] rowIndexs = gridView1.GetSelectedRows();
         if (rowIndexs.Length > 0)
         {
             splash.ShowWaitForm();
             splash.SetWaitFormCaption("审批中");
             splash.SetWaitFormDescription("正在审批……");
             foreach (int i in rowIndexs)
             {
                 DataRowView rv = gridView1.GetRow(i) as DataRowView;
                 rv.BeginEdit();
                 rv["审核人"]  = Security.UserName;
                 rv["审核时间"] = DateTime.Now;
                 rv["是否审核"] = true;
                 rv.EndEdit();
             }
             proceedsDataSet.SaveDataSet();
         }
     }
     catch (Exception ex)
     {
         UserMessages.ShowErrorBox(ex.Message);
     }
     finally
     {
         this.Cursor = Cursors.Default;
         if (splash.IsSplashFormVisible)
         {
             splash.CloseWaitForm();
         }
     }
 }
Example #18
0
 private void btnUpdateData_Click(object sender, EventArgs e)
 {
     if (dgvPeople.SelectedRows != null && dgvPeople.SelectedRows.Count > 0)
     {
         string selectedName = dgvPeople.SelectedRows[0].Cells["Name"].Value.ToString();
         m_dsADO.Tables["tblPeople"].DefaultView.Sort = "Name";//Find로 조회하려면 정렬기준 설정 필요.
         int idx = m_dsADO.Tables["tblPeople"].DefaultView.Find(selectedName);
         if (idx != -1)
         {
             DataRowView row = m_dsADO.Tables["tblPeople"].DefaultView[idx];
             row.BeginEdit();
             row["Name"] = tbxNewName.Text;
             row["Age"]  = nudNewAge.Value;
             row["Male"] = cbxNewMale.Checked;
             if (MessageBox.Show("데이터를 변경하시겠습니까?", "데이터수정", MessageBoxButtons.OKCancel) == DialogResult.OK)
             {
                 row.EndEdit();
             }
             else
             {
                 row.CancelEdit();
             }
         }
     }
 }
Example #19
0
        private void addOrgStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                EditOrgForm tmpForm = new EditOrgForm(_connection);
                tmpForm.Owner = this;
                DialogResult dRes = tmpForm.ShowDialog(this);
                if (dRes == DialogResult.OK)
                {
                    DataRowView row = _orgBS.AddNew() as DataRowView;
                    if (row != null)
                    {
                        row.BeginEdit();
                        row[Org.regnum]     = tmpForm.RegnumOrg;
                        row[Org.name]       = tmpForm.NameOrg;
                        row[Org.chief_post] = tmpForm.ChiefpostOrg;
                        row[Org.chief_fio]  = tmpForm.ChieffioOrg;
                        row[Org.booker_fio] = tmpForm.BookerfioOrg;
                        row.EndEdit();

                        int pos = _orgBS.Position;
                        _orgAdapter.Update(_orgTable);
                        _orgTable.Clear();
                        _orgAdapter.Fill(_orgTable);
                        _orgBS.Position = pos;
                        MainForm.ShowInfoMessage("Организация успешно добавлена!", "Добавление организации");
                        _dialogResult = DialogResult.OK;
                    }
                }
            }
            catch (Exception ex)
            {
                MainForm.ShowErrorMessage(ex.Message, "Ошибка добавления организации");
            }
        }
Example #20
0
        public CategoryDetailForm(SymbolDataSet.LocalizedCategoryRow currentLocalizedCategoryRow)
        {
            InitializeComponent();

            // Set up the SoundPlayer object.
            player = new SoundPlayer();

            if (currentLocalizedCategoryRow.RowState == DataRowState.Added)
            {
                categoryId = 0;

                this.BindingContext[this.categoryDetailDataSet, CATEGORY].AddNew();
                DataRowView rowView = this.BindingContext[this.categoryDetailDataSet, CATEGORY].Current as DataRowView;
                CategoryDetailDataSet.CategoryRow currentCategoryRow = rowView.Row as CategoryDetailDataSet.CategoryRow;

                rowView.BeginEdit();
                currentCategoryRow.Name     = Guid.NewGuid();
                currentCategoryRow.IsActive = true;
                rowView.EndEdit();
            }
            else
            {
                categoryId = currentLocalizedCategoryRow.CategoryId;
            }

            this.categoryDetailDataSet.Merge(currentLocalizedCategoryRow.Table.DataSet.Tables[LOCALIZED_CATEGORY]);

            this.cultureName = Properties.Settings.Default.CultureName;
        }
        /// <summary>Обработка нажатия кнопки "редактировать департамент"</summary>
        /// <param name="sender">Объект</param>
        /// <param name="args">Параметры</param>
        private void BtnEditDep_Click(object sender, RoutedEventArgs e)
        {
            if (cbDepList.SelectedItem != null)
            {
                DataRowView editDepRow = (DataRowView)cbDepList.SelectedItem;
                editDepRow.BeginEdit();

                DepEditWindow depEditWindow = new DepEditWindow(editDepRow.Row);
                depEditWindow.ShowDialog();

                if (depEditWindow.DialogResult.HasValue && depEditWindow.DialogResult.Value)
                {
                    editDepRow.EndEdit();
                    adDep.Update(dtDep);
                    dtGeneral.Clear();
                    adGeneral.Fill(dtGeneral);
                }
                else
                {
                    editDepRow.CancelEdit();
                }
            }
            else
            {
                MessageBox.Show("Выберете отдел для редактирования!");
            }
        }
        public void Save()
        {
            try
            {
                if (SecurityUsers.Mode == "I" || SecurityUsers.Mode == "U")
                {
                    if (SecurityUsers.UserName.ToString() == "")
                    {
                        ShowInformationMessage(PDMsg.NotEmpty("User Name"));
                        //MessageBox.Show("User Name should not be empty.", "SmartPD", MessageBoxButton.OK, MessageBoxImage.Information);
                        return;
                    }

                    if (SecurityUsers.Password.ToString() == "")
                    {
                        ShowInformationMessage(PDMsg.NotEmpty("Password"));
                        //MessageBox.Show("Password should not be empty.", "SmartPD", MessageBoxButton.OK, MessageBoxImage.Information);
                        return;
                    }

                    _securityUserBll.UpdateSecurityUsers(SecurityUsers);
                    if (SecurityUsers.Status != "")
                    {
                        _selectedItem.BeginEdit();
                        _selectedItem.Row["USER_NAME"]   = SecurityUsers.UserName;
                        _selectedItem.Row["FULL_NAME"]   = SecurityUsers.FullName;
                        _selectedItem.Row["DESIGNATION"] = SecurityUsers.Designation;
                        _selectedItem.Row["IS_ADMIN"]    = SecurityUsers.IsAdmin;
                        _selectedItem.Row["PASSWORD"]    = "******";
                        _selectedItem.EndEdit();
                        MessageBox.Show(SecurityUsers.Status, "SmartPD", MessageBoxButton.OK, MessageBoxImage.Information);
                        if (SecurityUsers.Status != "Given user already exist.")
                        {
                            if (_closed == false)
                            {
                                _closed = true;
                                CloseAction();
                            }
                        }
                        if (_closed == false)
                        {
                            _closed = true;
                            CloseAction();
                        }
                    }
                }
                else if (SecurityUsers.Mode == "D")
                {
                    _securityUserBll.UpdateSecurityUsers(SecurityUsers);
                    if (SecurityUsers.Status != "")
                    {
                        MessageBox.Show(SecurityUsers.Status, "SmartPD", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
        }
Example #23
0
        private void Grd4FinishCommand()
        {
            pccsMast.PCCSDetails.Table.AcceptChanges();
            //for (int i = 0; i < pccsMast.PCCSDetails.Count; i++)
            //{
            //    pccsMast.PCCSDetails.Delete(0);
            //}
            foreach (DataRowView row in pccsMast.PCCSDetails)
            {
                row.Delete();
            }
            foreach (DataRowView row in CPGModel.Grd4CharacteristcsDetails)
            {
                pccsMast.PCCSDetails.Table.ImportRow(row.Row);
            }
            if (pccsMast.PCCSDetails[pccsMast.PCCSDetails.Count - 1]["FEATURE"].ToString() != "")
            {
                DataRowView drv = pccsMast.PCCSDetails.AddNew();
                drv.BeginEdit();
                drv["SNO"] = pccsMast.PCCSDetails.Count;
                drv.EndEdit();
            }
            ReNumber();

            CloseAction();
        }
Example #24
0
        public void CancelEdit()
        {
            DataTable dt = DataProvider.CreateParentDataTable();
            DataView  dv = new DataView(dt);

            DataRowView drv = dv[0];

            drv.BeginEdit();
            drv["String1"] = "ChangeValue";

            // check Proposed value
            Assert.Equal("ChangeValue", dt.Rows[0]["String1", DataRowVersion.Proposed]);

            // check IsEdit
            Assert.True(drv.IsEdit);

            // check Proposed value
            drv.CancelEdit();
            Assert.False(dt.Rows[0].HasVersion(DataRowVersion.Proposed));

            // check current value
            Assert.Equal("1-String1", dt.Rows[0]["String1", DataRowVersion.Current]);

            // check IsEdit after cancel edit
            Assert.False(drv.IsEdit);
        }
Example #25
0
        void b_Click(object sender, RoutedEventArgs e)
        {
            Button      b           = sender as Button;
            DataRowView dataRowView = b.DataContext as DataRowView;

            if (dataRowView.IsNew || dataRowView.Row.RowState == DataRowState.Detached || dataRowView.Row.RowState == DataRowState.Added)
            {
                MessageBox.Show("du måste spara användaren först");
            }
            else if (dataRowView != null)
            {
                object salt = dataRowView.Row.Field <int>("Salt");

                if (salt != null)
                {
                    SetPwWindow win = new SetPwWindow();
                    win.ShowDialog();
                    if (win.password != null)
                    {
                        dataRowView.BeginEdit();
                        byte[] binPw = Common.UserLoginHelper.ComputeHash(win.password, (int)salt);
                        dataRowView[PropertyName] = binPw;
                        dataRowView.EndEdit();
                    }
                }
            }
        }
Example #26
0
 public DataRow Add_Child(DataRowView drv)
 {
     if (drv != null)
     {
         drv["Calculation"] = "";
         drv["UnitPrice"]   = "0";
         DataView    dv  = this.treeList1.DataSource as DataView;
         DataRowView row = dv.AddNew();
         row.BeginEdit();
         row["Number"]      = GetChdName();
         row["ParentID"]    = drv["ID"];
         row["IsSys"]       = false;
         row["UnID"]        = this.Activitie.ID;
         row["EnID"]        = this.Activitie.PID;
         row["PKey"]        = drv["Key"];
         row["Key"]         = ++this.CurrentBusiness.Current.ObjectKey;
         row["Coefficient"] = "100";
         row.EndEdit();
         return(row.Row);
     }
     else
     {
         return(null);
     }
 }
Example #27
0
        private void button12_Click(object sender, EventArgs e)
        {
            // Обработка заказа

            if (listView1.SelectedIndices.Count > 0)
            {
                int n = listView1.SelectedIndices[0];


                DataRowView Drv = Base.classOrder.dataView[n];
                cOrder      cO  = new cOrder(Base.classOrder.dataView[n].Row);

                if (cO.Status == 0)
                {
                    cO.Process();

                    Drv.BeginEdit();
                    cO.ThisToRow(Drv.Row);
                    Drv.EndEdit();
                    Base.classOrder.UpdateTable();


                    listView1.VirtualListSize = Base.classOrder.dataView.Count;
                    listView1.Refresh();
                }
                else
                {
                    MessageBox.Show(this, "Обработка уже выполнена!", "Внимание!");
                }
            }
        }
Example #28
0
        /// <summary>
        /// 添加根部门节点事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AddDepartmentItem_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            try
            {
                DataRowView rv = TCOM_DEPTBindingSource.Current as DataRowView;
                rv.BeginEdit();
                //获取要添加根部门的信息。
                rv["DEPTID"]       = Guid.NewGuid().ToString();
                rv["PARENTDEPTID"] = "0".ToString();



                rv["DEPTNAME"] = "";
                gridView1.BestFitColumns();
            }
            catch (Exception ex)
            {
                UserMessages.ShowErrorBox(ex.Message);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Example #29
0
        private void Bot_Anular_Click(object sender, EventArgs e)
        {
            if (RA_DOCUMENT_STATUS.Checked)
            {
                MessageBox.Show("Este Documento ya esta anulado...");
                return;
            }

            DialogResult dr = MessageBox.Show("Esta seguro de Anular este documento (S/N)?",
                                              "Advertencia", MessageBoxButtons.YesNo);

            switch (dr)
            {
            case DialogResult.Yes:
                //actualizar la base de datos.
                manager.DisableDocument(TXT_NUMERO.Text);
                //actualizar la interfaz grafica.
                ParentRow = (DataRowView)bs.Current;
                ParentRow.BeginEdit();
                ParentRow["doc_status"] = true;
                ParentRow.EndEdit();
                //actualizar los inventarios
                UpdateInventory(false);
                break;

            case DialogResult.No:
                break;
            }
        }
        private void ButtonEdit_OnClick(object sender, RoutedEventArgs e)
        {
            DataRowView selectRow = (DataRowView)DataGridDepartments.SelectedItem;

            if (selectRow == null)
            {
                return;
            }
            selectRow.BeginEdit();
            DepartmentEditWindow departmentEditWindow = new DepartmentEditWindow(selectRow.Row);

            departmentEditWindow.ShowDialog();
            if (departmentEditWindow.DialogResult.HasValue && departmentEditWindow.DialogResult.Value)
            {
                selectRow.EndEdit();
                var _ = new SqlCommandBuilder(_adapter);
                try
                {
                    _adapter.Update(_table);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ошибка редактирования выбранного отдела\n" + ex.Message,
                                    "Ошибка редактирования отдела", MessageBoxButton.OK, MessageBoxImage.Hand);
                }
            }
            else
            {
                selectRow.CancelEdit();
            }
            RefreshDataDepartments();
        }