コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!checkData())
            {
                return;
            }
            else
            {
                String serviceTypeName = Utils.standardNamePerson(txtServiceTypeName.Text);
                serviceTypeObject = new DTOServicesType("LDV0000000", serviceTypeName);

                if (serviceTypeBUS.InsertServicesType(serviceTypeObject))
                {
                    XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    btnAdd.Enabled = true;
                    btnCancelAdd.Enabled = false;
                    btnCancelAdd.Visible = false;
                    btnSave.Enabled = false;
                }
                else
                {
                    XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Phương thức thêm mới một ServicesType vào csdl
        /// </summary>
        /// <returns>true: thêm mới thành công, false: thêm mới thất bại</returns>
        public bool InsertServicesType(DTOServicesType ServicesType)
        {
            try
            {
                DataExecute.Instance.createSqlCmd("sp_AddNewServicesTypeInsert"/*Truyen vao storeprocedure*/, new object[2] { ServicesType.ServicesTypeID, ServicesType.ServicesTypeName });
                return DataExecute.Instance.updateData(DataConnection.Instance.m_cmd) > 0;
            }
            catch (SqlException)
            {

                throw;
            }
        }
コード例 #3
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (servicesTypeMulitiSelect.Selection.Count == 0)
     {
         XtraCustomMessageBox.Show("Chưa có dòng dữ liệu nào được chọn!", "Thông báo", true, 1);
         return;
     }
     try
     {
         System.Collections.ArrayList _listservicesTypeObjectInDelibility = new System.Collections.ArrayList();
         foreach (object _rowObjectItem in servicesTypeMulitiSelect.Selection)
         {
             grdvListServicesType.FocusedRowHandle -= 1;
             DataRowView _rowObjectDetail = _rowObjectItem as DataRowView;
             servicesTypeObject = new DTOServicesType(_rowObjectDetail.Row["ServicesTypeID"].ToString(), _rowObjectDetail.Row["ServicesTypeName"].ToString());
             if (!servicesTypeBUS.DeleteServicesType(servicesTypeObject.ServicesTypeID))
             {
                 _listservicesTypeObjectInDelibility.Add(_rowObjectDetail.Row["ServicesTypeID"]);
             }
         }
         String _erroContent = "Không thể xóa thông tin các thế loại sách có mã số: \n";
         if (_listservicesTypeObjectInDelibility.Count != 0)
         {
             foreach (var item in _listservicesTypeObjectInDelibility)
             {
                 _erroContent += item.ToString() + "\n";
             }
             XtraCustomMessageBox.Show(_erroContent, "Lỗi", true, 4);
         }
         else
             XtraCustomMessageBox.Show("Xóa dữ liệu thành công", "Thông báo", true, 1);
     }
     catch (System.Exception)
     {
         XtraCustomMessageBox.Show("Xóa dữ liệu thất bại", "Lỗi", true, 4);
     }
     finally
     {
         updateEnableButtonAndResetValueOfControl(ref btnDelete);
     }
 }
コード例 #4
0
        /// <summary>
        /// Phương thức thêm mới một ServicesType vào csdl
        /// </summary>
        /// <returns>true: thêm mới thành công, false: thêm mới thất bại</returns>
        public bool InsertServicesType(DTOServicesType ServicesType)
        {
            try
            {
                return servicesTypeDAO.InsertServicesType(ServicesType);
            }
            catch (SqlException)
            {

                throw;
            }
        }
コード例 #5
0
        private void SaveDataToDatabase()
        {
            if (!checkData())
            {
                return;
            }
            try
            {
                if (m_IsAdd)
                {
                    String servicesTypeName = Utils.standardNamePerson(txtServicesTypeName.Text);
                    servicesTypeObject = new DTOServicesType("LDV0000000", servicesTypeName);

                    if (servicesTypeBUS.InsertServicesType(servicesTypeObject))
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Thêm dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }
                else
                {
                    String servicesTypeName = Utils.standardNamePerson(txtServicesTypeName.Text);
                    servicesTypeObject = new DTOServicesType(txtServicesTypeId.Text, servicesTypeName);

                    if (servicesTypeBUS.UpdateServicesType(servicesTypeObject))
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thành công!", "Thông báo", true, 1);
                    }
                    else
                    {
                        XtraCustomMessageBox.Show("Cập nhật dữ liệu thất bại!", "Lỗi", true, 4);
                    }
                }

            }
            catch (System.Exception ex)
            {
                XtraCustomMessageBox.Show(ex.ToString(), "Lỗi", true, 3);
            }
            finally
            {
                updateEnableButtonAndResetValueOfControl(ref btnSave);
            }
        }