private void TxtPosition_Validating(object sender, CancelEventArgs e) { if (!string.IsNullOrEmpty(_Tag.ToString())) { if (string.IsNullOrEmpty(TxtPosition.Text)) { MessageBox.Show("Field Name Cannot Left Blank", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); e.Cancel = true; TxtPosition.Focus(); return; } else if (_Tag == "NEW") { if (_objUdfMaster.CheckDuplicatePosition(TxtPosition.Text, GridModule.Rows[Convert.ToInt32(GridModule.CurrentRow.Index)].Cells[0].Value.ToString()) == 1) { MessageBox.Show("Udf Position for the UDF Module ___[" + GridModule.Rows[Convert.ToInt32(GridModule.CurrentRow.Index)].Cells[0].Value.ToString() + "]___ cannot be duplicate", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); e.Cancel = true; TxtPosition.SelectAll(); TxtPosition.Focus(); return; } } } }
private void _Check() { List <Word> lbw; if ((!isSCInit) || (_ftb == null) || (string.IsNullOrWhiteSpace(_ftb.Text))) { return; } try { lbw = _spc.CheckTextSpell(_ftb.Text); if (lbw.Count == 0) { FCBTWordSelector.DataSource = new string[] { Properties.Resources.txtSpellMwnuNoMiss, Properties.Resources.txtSpellMwnuClose }; FLSpellWorCount.Text = string.Format( Properties.Resources.fmtSpellCount, 0 ); _SpellReset(); } else if ((lbw[0] != null) && (!string.IsNullOrWhiteSpace(lbw[0].Text))) { _bw = lbw[0]; int i = 0; SpellSuggestion[] suggest = _spc.SuggestCorrectedWords(_bw.Text, true); List <string> dtsrc = suggest.Select(s => s.Text).ToList <string>(); dtsrc.Insert(i++, Properties.Resources.txtSpellMwnuReplace); dtsrc.Insert(i++, Properties.Resources.txtSpellMwnuRestore); dtsrc.Insert(i++, Properties.Resources.txtSpellMwnuAddDictionary + _bw.Text + "'"); dtsrc.Insert(i++, Properties.Resources.txtSpellMwnuCancel); dtsrc.Insert(i++, Properties.Resources.txtSpellMwnuClose); dtsrc.Insert(i++, Properties.Resources.txtSpellMwnuUnderline); FCBTWordSelector.DataSource = dtsrc.ToArray(); FLSpellWorCount.Text = string.Format( Properties.Resources.fmtSpellCount, lbw.Count ); List <TxtPosition> ltp = new List <TxtPosition>(); foreach (Word w in lbw) { TxtPosition tp = new TxtPosition(w.StartIndex, w.EndIndex, w.Length); ltp.Add(tp); } _ftb.SpellMark = ltp; _ftb.Select(_bw.StartIndex, _bw.Length); _ftb.Invalidate(); _ftb.Focus(); _iLog.Line( Properties.Resources.txtStatusBadWord + String.Join(", ", lbw.Select(s => s.Text).ToArray()) ); } } catch (Exception ex) { _iLog.LogError(ex.Message); } }
public void Clear() { TxtPosition.Clear(); }
private void BtnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TxtDescription.Text.Trim())) { MessageBox.Show("Please Enter Description !", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtDescription.Focus(); return; } if (string.IsNullOrEmpty(TxtPosition.Text.Trim())) { MessageBox.Show("Please Enter Schedule !", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtPosition.Focus(); return; } if (string.IsNullOrEmpty(TxtFieldWidth.Text.Trim())) { MessageBox.Show("Please Enter Total Width !", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtFieldWidth.Focus(); return; } if (CmbFieldType.Text == "List") { if (GridList.Rows.Count <= 0) { MessageBox.Show("Please Enter Description !", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); GridList.Focus(); return; } if (GridList.Rows.Count == 1 && GridList.Rows[0].Cells["Description"].Value == null && GridList.Visible == true) { MessageBox.Show("Please Enter Description !", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); GridList.Focus(); return; } } _objUdfMaster.Model.Tag = _Tag; _objUdfMaster.Model.UDFCode = this._UDFCode; if ((_Tag == "EDIT" || _Tag == "DELETE") && _UDFCode == 0) { ClearFld(); return; } _objUdfMaster.Model.EntryModule = GridModule.Rows[Convert.ToInt32(GridModule.CurrentRow.Index)].Cells[0].Value.ToString(); _objUdfMaster.Model.FieldName = TxtDescription.Text; _objUdfMaster.Model.FieldType = CmbFieldType.Text; _objUdfMaster.Model.FieldWidth = TxtFieldWidth.Text; _objUdfMaster.Model.MandotaryOpt = ChkMandatoryOption.Checked == true ? "Y" : "N"; if (TxtDateFormat.Visible == true) { _objUdfMaster.Model.DateFormat = TxtDateFormat.SelectedItem.ToString(); } else { _objUdfMaster.Model.DateFormat = "YYYY"; } _objUdfMaster.Model.FieldDecimal = TxtFieldDecimal.Text; _objUdfMaster.Model.UdfPosition = Convert.ToInt32(TxtPosition.Text); _objUdfMaster.Model.AllowDuplicate = ChkAllowDuplicate.Checked == true ? "Y" : "N"; if (CmbFieldType.Text == "List") { UDFDetailsEntryViewModel UDFEntryDetails = null; foreach (DataGridViewRow ro in GridList.Rows) { if (ro.Cells["Description"].Value != null) { UDFEntryDetails = new UDFDetailsEntryViewModel(); if (ro.Cells["Description"].Value != null) { UDFEntryDetails.ListName = ro.Cells["Description"].Value.ToString(); } _objUdfMaster.ModelUDFDetailsEntry.Add(UDFEntryDetails); } } } _objUdfMaster.Model.EnterBy = ClsGlobal.LoginUserCode; _objUdfMaster.Model.Gadget = "Desktop"; if (_Tag == "NEW") { if (ClsGlobal.ConfirmSave == 1) { var dialogResult = MessageBox.Show("Are you sure want to Save New Record..??", "Close Form", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (dialogResult == DialogResult.Yes) { result = _objUdfMaster.SaveUdfMaster(); } else { return; } } else { result = _objUdfMaster.SaveUdfMaster(); } } else { result = _objUdfMaster.SaveUdfMaster(); } if (!string.IsNullOrEmpty(result)) { MessageBox.Show("Data submit successfully", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearFld(); } else { MessageBox.Show("Error occured during data submit", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); } }