コード例 #1
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            DataRow newFriend = friendsTable.NewRow();

            newFriend["name"]   = txtName.Text.Trim().Replace(" ", "");
            newFriend["mobile"] = txtPhone.Text.Trim().Replace(" ", "");
            newFriend["addr"]   = txtAddr.Text.Trim();

            friendsTable.Rows.Add(newFriend);   //새로 만들어진 DataRow를 DataTable에 넣기

            try
            {
                adapter.Update(friendsSet, "tblFriends");
                MessageBox.Show("친구 저장이 되었습니다");
                friendsSet.AcceptChanges(); // commit

                UpdateGridView();

                ClearFields();
            }
            catch (SqlException)
            {
                friendsSet.RejectChanges(); // rollback
                MessageBox.Show("친구 저장에 실패 했습니다");
            }
        }
コード例 #2
0
        // constructor para grabar ediciones de registros
        public static void GrabarVentas(DataSet dtVentas, ref int?codigoError,
                                        DataView viewDetalleOriginal, DataTable tblActual, bool grabarFallidas)
        {
            MySqlTransaction tr = null;

            try
            {
                MySqlConnection SqlConnection1 = DALBase.GetConnection();
                tr = SqlConnection1.BeginTransaction();
                DAL.VentasDAL.GrabarDB(dtVentas, SqlConnection1, tr);
                DAL.VentasDetalleDAL.GrabarDB(dtVentas, SqlConnection1, tr);
                tr.Commit();
                SqlConnection1.Close();
            }
            catch (MySqlException ex)
            {
                if (ex.Number == 1042) //no se pudo abrir la conexion por falta de internet
                {
                    dtVentas.RejectChanges();
                    codigoError = 1042;
                }
                else
                {
                    dtVentas.RejectChanges();
                    if (tr != null)
                    {
                        tr.Rollback();
                    }
                    codigoError = ex.Number;
                }
            }
        }
コード例 #3
0
 private void btnDelete_Click(object sender, System.EventArgs e)
 {
     if (selectedRowIndex >= 0)
     {
         DialogResult dr = MessageBox.Show("Bạn có chắc muốn xóa ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             DeletePunishCard();
             if (dsPunishCard.Tables[0].Rows.Count > 0)
             {
                 selectedRowIndex = 0;
             }
             PopulatePunishCardView();
             // kiểm tra sau khi xóa nếu dataset có dữ liệu thì bind hàng đầu tiên lên các textbox
             if (dsPunishCard.Tables[0].Rows.Count > 0)
             {
                 selectedRowIndex = 0;
                 LoadPunishCard();
             }
         }
         else
         {
             dsPunishCard.RejectChanges();
         }
     }
     else
     {
         MessageBox.Show("Bạn chưa kiểu ngày nào!", "Xóa kiểu ngày", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     SetEditStatus(false);
 }
コード例 #4
0
        private void btnEliminar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (currentRow != null)
            {
                string msg = currentRow["Descr"] + " eliminado..";

                if (MessageBox.Show("Esta seguro que desea eliminar el elemento: " + currentRow["Descr"].ToString(), _tituloVentana, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    currentRow.Delete();

                    try
                    {
                        TipoDAC.oAdaptador.Update(_dsSolicitud, "Data");
                        _dsSolicitud.AcceptChanges();

                        PopulateGrid();
                        //lblStatus.Caption = msg;
                        Application.DoEvents();
                    }
                    catch (System.Data.SqlClient.SqlException ex)
                    {
                        _dsSolicitud.RejectChanges();
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
コード例 #5
0
        public static void GrabarDB(DataSet dt, ref int?codigoError, bool grabarFallidas)
        {
            MySqlTransaction tr = null;

            try
            {
                MySqlConnection SqlConnection1 = DALBase.GetConnection();
                DAL.FondoCajaDAL.GrabarDB(dt, SqlConnection1);
                SqlConnection1.Close();
            }
            catch (MySqlException ex)
            {
                if (ex.Number == 1042) //no se pudo abrir la conexion por falta de internet
                {
                    dt.RejectChanges();
                    codigoError = 1042;
                }
                else
                {
                    dt.RejectChanges();
                    if (tr != null)
                    {
                        tr.Rollback();
                    }
                    codigoError = ex.Number;
                }
            }
        }
コード例 #6
0
ファイル: frmListPunish.cs プロジェクト: teppi210/HRMS_7Cua
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (selectedRowIndex >= 0)
            {
                string str  = WorkingContext.LangManager.GetString("frmListPunish_Xoa_Messa");
                string str1 = WorkingContext.LangManager.GetString("frmListPunish_Messa_Title");
                //comfirm xem có chắc muốn xóa ko?
                DialogResult dr = MessageBox.Show(str, str1, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    DeletePunish();
                    PopulateListPunish();
                }

                else
                {
                    dsPunish.RejectChanges();
                }
            }
            else
            {
                string str  = WorkingContext.LangManager.GetString("frmListPunish_Xoa_Messa1");
                string str1 = WorkingContext.LangManager.GetString("frmListPunish_Messa_Title");
                //MessageBox.Show("Bạn chưa chọn nhân viên cần xóa !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            selectedRowIndex = -1;
            tableModel1.Selections.Clear();
        }
コード例 #7
0
    static void Main()
    {
        string  xml = @"<set>
<table>
  <name>A</name>
  <value>1</value>
</table>
<table>
  <name>B</name>
  <value>2</value>
</table>
<table>
  <name>C</name>
  <value>3</value>
</table>
</set>";
        DataSet ds  = new DataSet();

        ds.ReadXml(new StringReader(xml));
        Print(ds);

        ds.AcceptChanges();
        Change(ds, 2);
        PrintChanges(ds);

        ds.RejectChanges();
        Print(ds);

        Change(ds, 3);
        ds.AcceptChanges();
        ds.RejectChanges();
        Print(ds);
        PrintChanges(ds);
        Console.WriteLine("<%END%>");
    }
コード例 #8
0
ファイル: frmPunish.cs プロジェクト: teppi210/HRMS_7Cua
        /// <summary>
        /// Thêm thẻ phạt cho nhân viên
        /// </summary>
        private void AddPunish()
        {
            int ret = 0;

            try
            {
                DataRow dr = dtPunish.NewRow();
                dtPunish.Rows.Add(SetData(dr));
                ret = punishD0.AddPunish(dsPunish);
            }
            catch
            {
            }
            if (ret != 0)
            {
                String str  = WorkingContext.LangManager.GetString("frmPunish_AddMessa1");
                String str1 = WorkingContext.LangManager.GetString("frmContract_Messa2");
                //MessageBox.Show("Thiết lập thẻ phạt thành công","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Information);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Information);
                dsPunish.AcceptChanges();
            }
            else
            {
                String str  = WorkingContext.LangManager.GetString("frmPunish_AddMessa2");
                String str1 = WorkingContext.LangManager.GetString("frmContract_Messa2");
                //MessageBox.Show("Thiết lập thẻ phạt thất bại","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Error);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dsPunish.RejectChanges();
            }
        }
コード例 #9
0
        void btnEliminar_Click(object sender, EventArgs e)
        {
            if (currentRow != null)
            {
                string msg = currentRow["IDProducto"] + " eliminado..";


                if (MessageBox.Show("Esta seguro que desea eliminar el elemento: " + currentRow["IDProducto"].ToString(), _tituloVentana, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    currentRow.Delete();

                    try
                    {
                        clsBoletaInvFisicoDAC.oAdaptador.Update(_dsBoleta, "Data");
                        _dsBoleta.AcceptChanges();

                        PopulateGrid();
                        lblStatus.Caption = msg;
                        Application.DoEvents();
                    }
                    catch (System.Data.SqlClient.SqlException ex)
                    {
                        _dsBoleta.RejectChanges();
                        lblStatus.Caption = "";
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
コード例 #10
0
ファイル: MyForm.cs プロジェクト: kamikazebr/Questionario
        public void newRow(Dictionary <String, Object> row)
        {
            // create a new row, populate it
            rowCurrent = dataTable.NewRow();
            try{
                rowCurrent.BeginEdit();
                foreach (String key in row.Keys.AsEnumerable <String>())
                {
                    rowCurrent[key] = row[key];
                }
                rowCurrent.EndEdit();
                dataTable.Rows.Add(rowCurrent);
                adapter.Update(dataSet, tableName);
                dataSet.AcceptChanges();


                //// inform the user
                //MessageBox.Show("Updated.");
                //Application.DoEvents();
            }
            catch (OleDbException ex)
            {
                dataSet.RejectChanges();
                MessageBox.Show(ex.Message);
                MessageBox.Show(ex.ErrorCode.ToString());
            }
        }
コード例 #11
0
        void btnEliminar_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (_currentRow != null)
            {
                if (MessageBox.Show("Esta seguro que desea eliminar el elemento: " + _currentRow["IdProducto"].ToString(), _tituloVentana, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    DataSet   _dsProductotmp = new DataSet();
                    DataTable _dtProductotmp = new DataTable();


                    //Validar las dependendicas
                    //ToDo Validar dependencias de los prodcutos
                    _currentRow.Delete();
                    try
                    {
                        clsProductoDAC.oAdaptador.Update(_dsProducto, "Data");
                        _dsProducto.AcceptChanges();


                        // PopulateGrid();
                        //lblStatus.Text = "El elemento se ha eliminado";
                        //MessageBox.Show("El asiento se ha eliminado correctamente.");
                    }
                    catch (System.Data.SqlClient.SqlException ex)
                    {
                        _dsProducto.RejectChanges();
                        MessageBox.Show("Han ocurrido errores al momento de eliminar el producto, por favor verifique: \n\r" + ex.Message);
                    }

                    this.Close();
                }
            }
        }
コード例 #12
0
ファイル: FrmUser.cs プロジェクト: teppi210/HRMS_7Cua
        /// <summary>
        /// Cập nhật thông tin người dùng vào cơ sở dữ liệu
        /// </summary>
        private void UpdateUser()
        {
            DataRow dr = dsUser.Tables[0].Rows[selectedUser];

            SetUserData(ref dr);
            string str = WorkingContext.LangManager.GetString("frmUser_Update_ThongBao_Title");
            int    ret = 0;

            try
            {
                ret = adminDO.UpdateUser(dsUser);
            }
            catch
            {
            }
            if (ret != 0)
            {
                string str1 = WorkingContext.LangManager.GetString("frmUser_Update_ThongBao_Messa");
                //MessageBox.Show("Cập nhật người dùng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show(str1, str, MessageBoxButtons.OK, MessageBoxIcon.Information);
                dsUser.AcceptChanges();
            }
            else
            {
                string str1 = WorkingContext.LangManager.GetString("frmUser_Update_ThongBao_Messa1");
                //MessageBox.Show("Cập nhật người dùng thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str1, str, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dsUser.RejectChanges();
            }
        }
コード例 #13
0
ファイル: frmAddTimeInOut.cs プロジェクト: teppi210/HRMS_7Cua
        /// <summary>
        /// Thêm thời gian vào ra
        /// </summary>
        private void AddTimeInOut()
        {
            DataRow dr = dsTimeInOut.Tables[0].NewRow();

            dsTimeInOut.Tables[0].Rows.Add(SetData(dr));
            int ret = 0;

            try
            {
                ret = timeInOutDO.AddTimeInOut(dsTimeInOut);
            }
            catch
            {
                ret = 0;
                string str1 = WorkingContext.LangManager.GetString("frmAddInOut_Them_ThongBao_Title");
                string str2 = WorkingContext.LangManager.GetString("frmAddInOut_Sua_ThongBao_Messa3");
                //MessageBox.Show("Có lỗi khi thêm thời gian vào ra ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                MessageBox.Show(str2, str1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            if (ret == 1)
            {
                string str1 = WorkingContext.LangManager.GetString("frmAddInOut_Them_ThongBao_Title");
                string str2 = WorkingContext.LangManager.GetString("frmAddInOut_Sua_ThongBao_Messa4");
                string str3 = WorkingContext.LangManager.GetString("frmAddInOut_Sua_ThongBao_Messa5");

                //MessageBox.Show("Nhân viên "+employeeName+" đã quẹt thẻ rồi.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                MessageBox.Show(str2 + employeeName + str3, str1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                dsTimeInOut.RejectChanges();
            }
            if (ret == 2)
            {
                string str1 = WorkingContext.LangManager.GetString("frmAddInOut_Them_ThongBao_Title");
                string str2 = WorkingContext.LangManager.GetString("frmAddInOut_Sua_ThongBao_Messa4");
                string str3 = WorkingContext.LangManager.GetString("frmAddInOut_Sua_ThongBao_Messa6");
                //MessageBox.Show("Nhân viên "+employeeName+" đã đăng ký công tác.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                MessageBox.Show(str2 + employeeName + str3, str1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                dsTimeInOut.RejectChanges();
            }
            if (ret == 3)
            {
                string str1 = WorkingContext.LangManager.GetString("frmAddInOut_Them_ThongBao_Title");
                string str2 = WorkingContext.LangManager.GetString("frmAddInOut_Sua_ThongBao_Messa4");
                string str3 = WorkingContext.LangManager.GetString("frmAddInOut_Sua_ThongBao_Messa7");
                //MessageBox.Show("Nhân viên "+employeeName+" đã đăng ký nghỉ.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                MessageBox.Show(str2 + employeeName + str3, str1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                dsTimeInOut.RejectChanges();
            }
            if (ret == 4)
            {
                string str  = WorkingContext.LangManager.GetString("frmAddInOut_Them_ThongBao_Messa");
                string str1 = WorkingContext.LangManager.GetString("frmAddInOut_Them_ThongBao_Title");
                //MessageBox.Show("Đã thêm thời gian vào ra thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Information);
                dsTimeInOut.AcceptChanges();
                this.Close();
            }
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: michaelt0123/BitsNPieces
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //- Check for changes in the DataSet and write the changes to the file:
     if (dsInventory.HasChanges())
     {
         dsInventory.GetChanges();
         dsInventory.WriteXml(filePath);
         getDataSource();
     }
     else
     {
         dsInventory.RejectChanges();
     }
 }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        public void RegLeaveSchedule()
        {
            int ret = 0;

            if (selectedLeaveSchedule >= 0)
            {
                DataRow dr = dsLeaveSchedule.Tables[0].Rows[selectedLeaveSchedule];
                dr  = SetData(dr);
                ret = leaveScheduleDO.UpdateLeaveSchedule(dsLeaveSchedule);
            }
            else
            {
                dr = dsLeaveSchedule.Tables[0].NewRow();
                dsLeaveSchedule.Tables[0].Rows.Add(SetData(dr));
                ret = leaveScheduleDO.AddLeaveSchedule(dsLeaveSchedule);
            }
            if (ret == 1)
            {
                string str  = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_DK_Messa1");
                string str1 = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Thongbao_Title");
                //MessageBox.Show("Đăng ký công tác cho nhân viên thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Information);
                dsLeaveSchedule.AcceptChanges();
            }
            else if (ret == 2)
            {
                string str  = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_DK_Messa2");
                string str1 = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Thongbao_Title");
                //MessageBox.Show("Ngày đăng ký trùng với ngày nghỉ đã đăng ký trước đây của nhân viên. Không thể cập nhật đăng ký công tác cho nhân viên này!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dsLeaveSchedule.RejectChanges();
            }
            else if (ret == 3)
            {
                string str  = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_DK_Messa3");
                string str1 = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Thongbao_Title");
                //MessageBox.Show("Ngày đăng ký trùng với ngày công tác đã đăng ký trước đây của nhân viên. Không thể cập nhật đăng ký công tác cho nhân viên này!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dsLeaveSchedule.RejectChanges();
            }
            else if (ret == 4)
            {
                string str  = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_DK_Messa4");
                string str1 = WorkingContext.LangManager.GetString("frmListLeaveSchedule_Thongbao_Title");
                //MessageBox.Show("Nhân viên này có đi làm (quẹt thẻ) trong khoảng thời gian đăng ký. Không thể cập nhật đăng ký công tác cho nhân viên này!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dsLeaveSchedule.RejectChanges();
            }
        }
コード例 #16
0
        /// <summary>
        /// 로우 선택이 변경
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gvSettingList_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            //저장하시 않는 내요은 날린다
            if (isNewRowAdded)
            {
                isNewRowAdded = false;
            }
            else
            {
                dsSetting.RejectChanges();
            }

            //새로운 로우 여부 확인
            DataRow dr = gvSettingList.GetFocusedDataRow();

            _currDr = dsSetting.Tables["Setting"].NewRow();

            _currDr.ItemArray = dr.ItemArray;

            isNewRow = Fnc.obj2String(dr["UpdateType"]).Equals(string.Empty);

            Application.DoEvents();


            InputBox_Collapes();
        }
コード例 #17
0
        /// <summary>
        /// This method is used to update/insert/delete
        /// records using the appropriate SQL Statements.
        /// The database will have an exclusive lock.
        ///
        ///
        ///
        /// </summary>
        ///
        /// <param name="vSQL">SQL Statement 2B executed</param>
        /// <param name="vCryptographyDetails">
        /// the parameters used to encrypt the sql statement</param>
        public void WriteDB(string vSQL)
        {
            DataSet vDS = new DataSet();

            try
            {
                vDS.EnforceConstraints = true;

                SQL_KCA.SqlDataAdapter vDA = new SQL_KCA.SqlDataAdapter
                                                 (vSQL, this.mConnectionString);

                vDA.AcceptChangesDuringFill = true;
                vDA.Fill(vDS);
            }
            catch (Exception)
            {
                vDS.RejectChanges();
                vDS.Dispose();
                throw;

                /*  bubble the error to the active document,
                 * where the error is caught and resolved */
            }
            finally
            {
                this.mDB.Close();
            }
        }
コード例 #18
0
ファイル: frmListDayType.cs プロジェクト: teppi210/HRMS_7Cua
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (selectedRow < 0)
     {
         string str  = WorkingContext.LangManager.GetString("frmDayType_Delete_Error_Messa");
         string str1 = WorkingContext.LangManager.GetString("frmDayType_Delete_Error_Title");
         //MessageBox.Show("Bạn chưa kiểu ngày nào!", "Xóa kiểu ngày", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     else
     {
         string str  = WorkingContext.LangManager.GetString("frmDayType_Delete_ThongBao_Messa1");
         string str1 = WorkingContext.LangManager.GetString("frmDayType_Delete_Error_Title");
         //confirm lại có chắc chắn muốn xóa kiểu ngày này ko?
         DialogResult dr = MessageBox.Show(str, str1, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             DeleteDayType();
             PopulateDayType();
         }
         else
         {
             dsDayType.RejectChanges();
         }
     }
     selectedRow = -1;            // sau khi xóa xong thì đưa vị trí con trỏ về -1
     tableModel1.Selections.Clear();
 }
コード例 #19
0
        public void ChangePass(string UserName, string Pass)
        {
            adminDO = new AdminDO();
            dsUser  = adminDO.GetUser(UserName);
            DataRow dr = dsUser.Tables[0].Rows[0];

            SetUserData(ref dr);
            string str = WorkingContext.LangManager.GetString("frmChangePass_Thongbao1");
            int    ret = 0;

            try
            {
                ret = adminDO.ChangePass(dsUser);
            }
            catch
            {
            }
            if (ret != 0)
            {
                string str1 = WorkingContext.LangManager.GetString("frmChangePass_Thongbao1_Title");
                //MessageBox.Show("Cập nhật mật khẩu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show(str1, str, MessageBoxButtons.OK, MessageBoxIcon.Information);
                dsUser.AcceptChanges();
                this.Close();
            }
            else
            {
                string str2 = WorkingContext.LangManager.GetString("frmChangePass_Thongbao2_Title");
                //MessageBox.Show("Cập nhật mật khẩu thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(str2, str, MessageBoxButtons.OK, MessageBoxIcon.Information);
                dsUser.RejectChanges();
                this.Close();
            }
        }
コード例 #20
0
        private void ClearFeilds()
        {
            txtWTCode.Text = string.Empty;
            cmbTWarehouse.SelectedValue = -1;
            cmbFWarehouse.SelectedValue = -1;
            txtRemarks.Text             = string.Empty;
            txtEmployeeCode.Text        = string.Empty;
            chkProcess.Checked          = false;
            txtProcessQty.Text          = string.Empty;
            txtSONo.Text    = string.Empty;
            txtBatchNo.Text = string.Empty;
            WTMasterId      = -1;
            dsMain.Tables["WTDetail"].Rows.Clear();
            dsMain.Tables["WTMaster"].Rows.Clear();

            dsMain.RejectChanges();
            drMaster = dsMain.Tables["WTMaster"].NewRow();
            dsMain.Tables["WTMaster"].Rows.Add(drMaster);
            GCDetail.DataSource = dsMain.Tables["WTDetail"];
            DeletedIds          = new List <int>();
            GridSetting();
            ButtonRights(true);
            btnNextInvioceNo.Enabled = false;
            btnPrevInvioceNo.Enabled = false;
            setupGrip();
            cmbFWarehouse.Focus();
            txtWTCode.Text = GetNewNextNumber();
        }
        protected void btnUndo_Click(object sender, EventArgs e)
        {
            if (Cache["DATA"] != null)
            {
                DataSet ds = new DataSet();
                ds = (DataSet)Cache["DATA"];

                if (ds.HasChanges())
                {
                    // Reject all modification to original data since last AcceptChanges()
                    ds.RejectChanges();

                    // Update the cache to reflec the cancellation of changes
                    Cache.Insert("DATA", ds, null, DateTime.Now.AddHours(24), System.Web.Caching.Cache.NoSlidingExpiration);

                    // Load the gridview from latest cache
                    GetAllStudentsFromCache();

                    lblMessage.ForeColor = Color.Green;
                    lblMessage.Text      = "Changes Undone";
                }
                else
                {
                    lblMessage.ForeColor = Color.Red;
                    lblMessage.Text      = "No Changes to Undo";
                }
            }
            else
            {
                lblMessage.ForeColor = Color.Red;
                lblMessage.Text      = "No Data Present";
            }
        }
コード例 #22
0
 private void btnDelete_Click(object sender, System.EventArgs e)
 {
     if (selectedRow < 0)
     {
         string str  = WorkingContext.LangManager.GetString("frmListContract_Xoa_Messa1");
         string str1 = WorkingContext.LangManager.GetString("frmListContract_Xoa_Title");
         //MessageBox.Show("Bạn chưa chọn kiểu hợp đồng nào!", "Xóa kiểu hợp đồng" ,MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     else
     {
         string str  = WorkingContext.LangManager.GetString("frmListContract_Xoa_Messa2");
         string str1 = WorkingContext.LangManager.GetString("frmListContract_Xoa_Title");
         //confirm lại có muốn xóa kiểu hợp đồng ko?
         DialogResult dr = MessageBox.Show(str, str1, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             DeleteContractType();
             PopulateContractType();
         }
         else
         {
             dsContractType.RejectChanges();
         }
     }
     selectedRow = -1;            // sau khi xóa xong thì đưa con trỏ về vị trí -1
     tableModel1.Selections.Clear();
 }
コード例 #23
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (sender == acceptButton)
     {
         IsEnabled = false;
         backgroundWorker.RunWorkerAsync(new object[] { "accept", null });
     }
     if (sender == rejectButton)
     {
         dataSet.RejectChanges();
     }
     if (sender == repeatButton)
     {
         MenuItem_Click(dbMenuItem, null);
     }
     if (sender == menuItemAddUser)
     {
         new AddUser(settings).ShowDialog();
         MenuItem_Click(dbMenuItem, null);
     }
     if (sender == advancedMode_ && advancedMode != advancedMode_.IsChecked)
     {
         advancedMode = advancedMode_.IsChecked;
         setLcok();
     }
 }
コード例 #24
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            DataSet ds = (DataSet)Cache["Dataset"];

            if (ds.HasChanges())
            {
                ds.RejectChanges();
                Cache.Insert("Dataset", ds, null, DateTime.Now.AddHours(24), System.Web.Caching.Cache.NoSlidingExpiration);
                getDataFromCache();
                Label1.Text      = "Changes Undone";
                Label1.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                Label1.Text      = "No changes made";
                Label1.ForeColor = System.Drawing.Color.Red;
            }



            /* for status of each row
             * foreach(DataRow dr in ds.Tables["Students"].Rows)
             * {
             *  if(dr.RowState==DataRowState.Deleted)
             *  {
             *      Response.Write(dr["Id",DataRowVersion.Original].ToString() + "-" + dr.RowState.ToString() + "<br/>");
             *  }
             *
             *  else{
             *      Response.Write(dr["Id"].ToString() + "-" + dr.RowState.ToString() + "<br/>");
             *  }
             * }*/
        }
コード例 #25
0
    private void ClearFeilds()
    {
        txtJVCode.Text              = string.Empty;
        txtNaration.Text            = string.Empty;
        dtpVoucher.Value            = DateTime.Now;
        dtpCheque.Value             = DateTime.Now;
        dtpBillDate.Value           = DateTime.Now;
        txtChequeAmount.Text        = string.Empty;
        txtBillNo.Text              = string.Empty;
        cmbChequeBank.SelectedIndex = 0;
        txtChequeNumber.Text        = string.Empty;
        this.VoucherMasterId        = -1;
        this.BankVoucherDetailId    = -1;
        dsMain.Tables["VoucherDetail"].Rows.Clear();
        dsMain.Tables["VoucherMaster"].Rows.Clear();
        dsMain.RejectChanges();
        drMaster = dsMain.Tables["VoucherMaster"].NewRow();
        dsMain.Tables["VoucherMaster"].Rows.Add(drMaster);
        GCDetail.DataSource = dsMain.Tables["VoucherDetail"];
        GridSetting();
        PostedControls(false);
        ButtonRights(true);
        btnNextInvioceNo.Enabled = false;
        btnPrevInvioceNo.Enabled = false;

        txtJVCode.Text = GetNewNextNumber();
        dtpVoucher.Focus();
    }
コード例 #26
0
 private void btnKhongLuu_Click(object sender, EventArgs e)
 {
     bsBoMon.EndEdit();
     dsBoMon.RejectChanges();
     blnThem = false;
     DieuKhienKhiBinhThuong();
 }
コード例 #27
0
        private void ClearFeilds()
        {
            txtRequisitionNo.Text       = string.Empty;
            dtp.Value                   = DateTime.Now;
            txtOrderByCode.Text         = string.Empty;
            txtOrderByName.Text         = string.Empty;
            txtDeliveredByCode.Text     = string.Empty;
            txtDeliveredByName.Text     = string.Empty;
            cmbFWarehouse.SelectedValue = -1;
            cmbTWarehouse.SelectedValue = -1;
            txtRemarks.Text             = string.Empty;
            StockReqMasterId            = -1;
            btnApproved.Enabled         = true;
            DeletedIds                  = new List <int>();
            dset.Tables["REQDetail"].Rows.Clear();
            dset.Tables["REQMaster"].Rows.Clear();

            dset.RejectChanges();

            drMaster = dset.Tables["REQMaster"].NewRow();
            dset.Tables["REQMaster"].Rows.Add(drMaster);
            GCDetail.DataSource = dset.Tables["REQDetail"];
            GridSetting();
            // txtRequisitionNo.Text = GetNewNextNumber();
            lblApproval.Visible = false;
            ButtonRights(true);
            btnNextInvioceNo.Enabled = false;
            btnPrevInvioceNo.Enabled = false;
        }
コード例 #28
0
ファイル: FmBookStock.cs プロジェクト: netrefugee/EMS-1
 private void toolStripButton9_Click(object sender, EventArgs e)//取消
 {
     source.CancelEdit();
     data.RejectChanges();
     ////////////////////////////////////////////
     this.ToolButtonEnabled(false);
 }
コード例 #29
0
 private void grabar()
 {
     Cursor.Current = Cursors.WaitCursor;
     rowView.EndEdit();
     try
     {
         BL.StockMovBLL.GrabarStockMovimientos(dsStockMov);
     }
     catch (ServidorMysqlInaccesibleException ex)
     {
         MessageBox.Show(ex.Message, "Trend Gestión",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
         dsStockMov.RejectChanges();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + '\r' + "Es posible que no se grabaran los datos.", "Trend Gestión",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         Cursor.Current = Cursors.Arrow;
     }
     ResetForm();
 }
コード例 #30
0
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     if (AgencyListDS != null)
     {
         AgencyListDS.RejectChanges();
     }
 }
コード例 #31
0
ファイル: DataSetTest.cs プロジェクト: dotnet/corefx
        public void RuleTest()
        {
            DataSet ds = new DataSet("testds");
            DataTable parent = ds.Tables.Add("parent");
            DataTable child = ds.Tables.Add("child");

            parent.Columns.Add("id", typeof(int));
            parent.Columns.Add("name", typeof(string));
            parent.PrimaryKey = new DataColumn[] { parent.Columns["id"] };

            child.Columns.Add("id", typeof(int));
            child.Columns.Add("parent", typeof(int));
            child.Columns.Add("name", typeof(string));
            child.PrimaryKey = new DataColumn[] { child.Columns["id"] };

            DataRelation relation = ds.Relations.Add("parent_child",
                                  parent.Columns["id"],
                                  child.Columns["parent"]);

            parent.Rows.Add(new object[] { 1, "mono test 1" });
            parent.Rows.Add(new object[] { 2, "mono test 2" });
            parent.Rows.Add(new object[] { 3, "mono test 3" });

            child.Rows.Add(new object[] { 1, 1, "mono child test 1" });
            child.Rows.Add(new object[] { 2, 2, "mono child test 2" });
            child.Rows.Add(new object[] { 3, 3, "mono child test 3" });

            ds.AcceptChanges();

            parent.Rows[0]["name"] = "mono changed test 1";

            Assert.Equal(DataRowState.Unchanged, parent.Rows[0].GetChildRows(relation)[0].RowState);

            ds.RejectChanges();
            parent.Rows[0]["id"] = "4";

            DataRow childRow = parent.Rows[0].GetChildRows(relation)[0];
            Assert.Equal(DataRowState.Modified, childRow.RowState);
            Assert.Equal(4, (int)childRow["parent"]);
        }
コード例 #32
0
ファイル: DataSetTest.cs プロジェクト: dotnet/corefx
        public void GetChanges_Relations_DifferentRowStatesTest()
        {
            DataSet ds = new DataSet("ds");
            DataTable parent = ds.Tables.Add("parent");
            DataTable child = ds.Tables.Add("child");

            parent.Columns.Add("id", typeof(int));
            parent.Columns.Add("name", typeof(string));


            child.Columns.Add("id", typeof(int));
            child.Columns.Add("parent", typeof(int));
            child.Columns.Add("name", typeof(string));

            parent.Rows.Add(new object[] { 1, "mono parent 1" });
            parent.Rows.Add(new object[] { 2, "mono parent 2" });
            parent.Rows.Add(new object[] { 3, "mono parent 3" });
            parent.Rows.Add(new object[] { 4, "mono parent 4" });
            parent.AcceptChanges();

            child.Rows.Add(new object[] { 1, 1, "mono child 1" });
            child.Rows.Add(new object[] { 2, 2, "mono child 2" });
            child.Rows.Add(new object[] { 3, 3, "mono child 3" });
            child.AcceptChanges();

            DataRelation relation = ds.Relations.Add("parent_child",
                                  parent.Columns["id"],
                                  child.Columns["parent"]);

            // modify the parent and get changes
            child.Rows[1]["parent"] = 4;
            DataSet changes = ds.GetChanges();
            DataRow row = changes.Tables["parent"].Rows[0];
            Assert.Equal((int)parent.Rows[3][0], (int)row[0]);
            Assert.Equal(1, changes.Tables["parent"].Rows.Count);
            ds.RejectChanges();

            // delete a child row and get changes.
            child.Rows[0].Delete();
            changes = ds.GetChanges();

            Assert.Equal(changes.Tables.Count, 2);
            Assert.Equal(1, changes.Tables["parent"].Rows.Count);
            Assert.Equal(1, (int)changes.Tables["parent"].Rows[0][0]);
        }
コード例 #33
-1
ファイル: DataSetTest2.cs プロジェクト: dotnet/corefx
        public void RejectChanges()
        {
            DataSet ds1, ds2 = new DataSet();
            ds2.Tables.Add(DataProvider.CreateParentDataTable());
            ds1 = ds2.Copy();

            //create changes
            ds2.Tables[0].Rows[0][0] = "70";
            ds2.Tables[0].Rows[1].Delete();
            ds2.Tables[0].Rows.Add(new object[] { 9, "string1", "string2" });

            // RejectChanges
            ds2.RejectChanges();
            Assert.Equal(ds2.GetXml(), ds1.GetXml());
        }