private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeView1.SelectedNode.Text == "")
            {
                MessageBox.Show("Please select a section.", "Insufficient Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DescTxt.Focus();
                return;
            }


            string StopNote = "N";

            if (StopNoteCB.Checked == true)
            {
                StopNote = "Y";
            }

            MWDataManager.clsDataAccess _dbMan1 = new MWDataManager.clsDataAccess();
            _dbMan1.ConnectionString = TConnections.GetConnectionString(_theSystemDBTag, _UserCurrentInfoConnection);
            _dbMan1.SqlStatement     = " select * from [dbo].[tbl_ExtendedBreakSetup]  where section = '" + treeView1.SelectedNode.Text + "' and [Description] = '" + DescTxt.Text + "' " +
                                       "  ";
            _dbMan1.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
            _dbMan1.queryReturnType    = MWDataManager.ReturnType.DataTable;
            _dbMan1.ExecuteInstruction();

            if (_dbMan1.ResultsDataTable.Rows.Count > 0)
            {
                MessageBox.Show("There is already data saved for this section.", "Section Already Exists", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //DescTxt.Focus();
                return;
            }

            else
            {
                MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess();
                _dbMan.ConnectionString = TConnections.GetConnectionString(_theSystemDBTag, _UserCurrentInfoConnection);
                _dbMan.SqlStatement     = " insert into [dbo].[tbl_ExtendedBreakSetup] VALUES ( '" + treeView1.SelectedNode.Text + "' , '" + String.Format("{0:yyyy-MM-dd}", StartDateDTP.Value.AddDays(-Convert.ToInt64(DefDaysTxt.Text))) + "', '" + DefDaysTxt.Text + "', '" + String.Format("{0:yyyy-MM-dd}", StartDateDTP.Value) + "', '" + String.Format("{0:yyyy-MM-dd}", EndDateDTP.Value) + "' " +
                                          " , '" + DescTxt.Text + "', '" + StopNote + "' ) ";
                _dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
                _dbMan.queryReturnType    = MWDataManager.ReturnType.DataTable;
                _dbMan.ExecuteInstruction();


                Global.sysNotification.TsysNotification.showNotification("Data Saved", "Extendead Break Added ", Color.CornflowerBlue);

                Close();

                //Valid = "Y";
                //SysAdminFrm.LoadExtendedBreaks();
            }
        }
Exemple #2
0
 private void pictureBox6_Click(object sender, EventArgs e)
 {
     DescTxt.Clear();
     NoteTitleTxt.Clear();
 }
 private void ClearPic_Click(object sender, EventArgs e)
 {
     ProjectCbx.SelectedIndex = -1;
     TaskTxt.Clear();
     DescTxt.Clear();
 }