public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode) { base.initForm(Mode); fillCulture(); switch (_action) { case "NEW": this.Text = this.Text + " - " + SynapseForm.GetLabel("Label.Create"); _user.ID = 0; txUserid.Text = ""; txFirstName.Text = ""; txLastName.Text = ""; cbCulture.SelectedIndex = -1; break; case "EDIT": this.Text = this.Text + " - " + SynapseForm.GetLabel("Label.Edit"); txUserid.Text = _user.UserID; txFirstName.Text = _user.FIRSTNAME; txLastName.Text = _user.LASTNAME; if (_user.CULTURE != null) { cbCulture.SelectedValue = _user.CULTURE; } else { cbCulture.SelectedIndex = -1; } break; } }
private Boolean checkFields() { Boolean check = true; synapseErrorProvider1.SetError(txCode, ""); synapseErrorProvider1.SetError(txName, ""); synapseErrorProvider1.SetError(cbEntity, ""); if (cbEntity.SelectedIndex == -1) { GlobalFunctions.addError("RoomPicker.Err.0003"); synapseErrorProvider1.SetError(cbEntity, SynapseForm.GetLabel("RoomPicker.Err.0003")); check = false; } if (txCode.Text == "") { GlobalFunctions.addError("RoomPicker.Err.0004"); synapseErrorProvider1.SetError(txCode, SynapseForm.GetLabel("RoomPicker.Err.0004")); check = false; } if (txName.Text == "") { GlobalFunctions.addError("RoomPicker.Err.0005"); synapseErrorProvider1.SetError(txName, SynapseForm.GetLabel("RoomPicker.Err.0005")); check = false; } return(check); }
private void frmSecurityOverView_Load(object sender, EventArgs e) { treeListView1.Columns[0].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_GROUP"); treeListView1.Columns[1].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_VISIBLE"); treeListView1.Columns[2].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_ACTIVE"); treeListView1.Columns[3].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_Text"); treeListView1.Columns[4].Text = SynapseForm.GetLabel("frmSecurityOverView.olvc_Comment"); ModuleCollection = SynapseModule.Load(); myControls = (from c in ControlSecurityOverview.Load() where c.GROUP != "Everybody" select c).ToList(); myProfiles = SynapseProfile.Load(); myModules = SynapseModule.Load(); fillModules(); foreach (SynapseModule mod in myModules) { HashMod.Add(mod.TECHNICALNAME, mod.ID); } List <E_module> modules = new List <E_module>(); foreach (string str in (from m in myControls select m.MODULE).Distinct()) { modules.Add((E_module)str); } treeListView1.SetObjects(modules); }
public static void showError(String CODE = "", String PARAM1 = "", String PARAM2 = "") { String _message = ""; if (CODE != "") { _message = SynapseForm.GetLabel(CODE); if (PARAM1 != "") { _message = _message.Replace("#1", PARAM1); } if (PARAM2 != "") { _message = _message.Replace("#2", PARAM2); } } else { foreach (string line in _errorList) { _message = _message + line.Replace("$tab$", " ") + "\n"; } } MessageBox.Show(_message, SynapseForm.GetLabel("Dialog.Error"), MessageBoxButtons.OK, MessageBoxIcon.Error); }
private void olv_Data_CellEditStarting(object sender, SynapseAdvancedControls.CellEditEventArgs e) { if (((o_GasEmission)e.RowObject).Valid == true) { e.Cancel = true; } if (((o_GasEmission)e.RowObject).Date > lastdata.AddDays(1)) { MessageBox.Show(SynapseForm.GetLabel("messages.errorcannotedit")); e.Cancel = true; } if (e.Value != null && e.Value.ToString() == (0).ToString("0.000E+00")) { e.Control.Text = ""; } if (((e.Column == col_GazVolume) || (e.Column == col_GazDischarge) || (e.Column == col_Remarque)) && ((o_GasEmission)e.RowObject).HS == true) { if (MessageBox.Show(SynapseForm.GetLabel("messages.errorcannotediths"), SynapseForm.GetLabel("messages.errorcannotedithstitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == System.Windows.Forms.DialogResult.No) { e.Cancel = true; } } }
public static System.Windows.Forms.DialogResult showMessage(String TYPE, String CODE = "", String PARAM1 = "", String PARAM2 = "") { String _message = ""; if (CODE != "") { _message = SynapseForm.GetLabel(CODE); if (PARAM1 != "") { _message = _message.Replace("#1", PARAM1); } if (PARAM2 != "") { _message = _message.Replace("#2", PARAM2); } } switch (TYPE) { case "WARN": return(MessageBox.Show(_message, SynapseForm.GetLabel("Dialog.Warning"), MessageBoxButtons.OK, MessageBoxIcon.Warning)); case "ERR": return(MessageBox.Show(_message, SynapseForm.GetLabel("Dialog.Error"), MessageBoxButtons.OK, MessageBoxIcon.Error)); case "INFO": return(MessageBox.Show(_message, SynapseForm.GetLabel("Dialog.Info"), MessageBoxButtons.OK, MessageBoxIcon.Information)); case "QUEST": return(MessageBox.Show(_message, SynapseForm.GetLabel("Dialog.Question"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)); default: return(MessageBox.Show(_message, SynapseForm.GetLabel("Dialog.Info"), MessageBoxButtons.OK, MessageBoxIcon.Information)); } }
private void btn_Validate_Click(object sender, EventArgs e) { if (UnvalidatedConstant != null && UnvalidatedConstant.DetectionLimit != 0 && UnvalidatedConstant.BackgroundNoise != 0) { if (UnvalidatedConstant.EncodedBy.ToUpper() != SynapseForm.FormUser.UserID.ToUpper()) { o_Constant LastValidConstant = o_Constant.Load("where ChainID=" + cb_Chaine.SelectedValue + " and DateTo='" + DateTime.MaxValue.ToString("yyyy-MM-dd") + "' AND DateFrom<>'" + DateTime.MaxValue.ToString("yyyy-MM-dd") + "'").FirstOrDefault(); if (LastValidConstant != null) { if (LastValidConstant.DateFrom >= dtp_ValidFrom.Value.AddDays(-1)) { MessageBox.Show(SynapseForm.GetLabel("messages.errorconstantdateerror"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } LastValidConstant.DateTo = dtp_ValidFrom.Value.AddDays(-1); LastValidConstant.save(); } UnvalidatedConstant.ValidationBy = SynapseForm.FormUser.UserID; UnvalidatedConstant.ValidationDate = DateTime.Now; UnvalidatedConstant.DateFrom = dtp_ValidFrom.Value; UnvalidatedConstant.save(); cb_Chaine_SelectedIndexChanged(this, e); } else { MessageBox.Show(SynapseForm.GetLabel("messages.errordoublevalidation"), SynapseForm.GetLabel("messages.errordoublevalidationtitle"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("no constant to validate"); } }
public frm_GasEmissions() { InitializeComponent(); col_Day.AspectGetter = delegate(object x) { return(SynapseForm.GetLabel("labels." + ((o_GasEmission)x).Date.DayOfWeek.ToString()) + " " + ((o_GasEmission)x).Date.ToString("dd/MM/yyyy")); }; col_Date.AspectGetter = delegate(object x) { return(((o_GasEmission)x).Date.AddDays(1).ToString("dd/MM/yyyy")); }; col_Dirty.AspectGetter = delegate(object x) { return("");// (((o_GasEmission)x).GasVolume != 0 || ((o_GasEmission)x).GasEmission != 0) ? ((o_GasEmission)x).IsDirty : false; }; col_Dirty.ImageGetter = delegate(object x) { o_GasEmission item = (o_GasEmission)x; string state = "st_empty"; if (item.GasEmission != 0 || item.GasEmission != 0) { state = "st_data"; if (item.Valid) { state = "st_valid"; } if (item.IsDirty) { state = "st_edit"; } } return(state); }; col_GazDischarge.AspectGetter = delegate(object x) { return(((o_GasEmission)x).GasEmission.ToString("0.000E+00")); }; col_GazDischarge.AspectPutter = delegate(object x, object newval) { double t; if (double.TryParse(newval.ToString(), out t)) { ((o_GasEmission)x).GasEmission = t; } }; col_GazVolume.AspectGetter = delegate(object x) { return(((o_GasEmission)x).GasVolume.ToString("0.000E+00")); }; col_GazVolume.AspectPutter = delegate(object x, object newval) { double t; if (double.TryParse(newval.ToString(), out t)) { ((o_GasEmission)x).GasVolume = t; } }; }
private void InitializeControl() { DataSet _data = new DataSet(); DataTable _tbl = new DataTable("COMPARE"); _tbl.Columns.Add("VALUE", System.Type.GetType("System.String")); _tbl.Columns.Add("DISPLAY", System.Type.GetType("System.String")); _data.Tables.Add(_tbl); DataRow _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = ""; _row["DISPLAY"] = "*"; _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = "="; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.Equal"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = "<"; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.Before"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = ">"; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.After"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = "<="; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.BeforeOrEqual"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = ">="; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.AfterOrEqual"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = "BETWEEN"; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.Between"); _data.Tables["COMPARE"].Rows.Add(_row); ComboBox.DataSource = _data; ComboBox.ValueMember = "COMPARE.VALUE"; ComboBox.DisplayMember = "COMPARE.DISPLAY"; ComboBox.SelectedIndex = 0; lbl2.Text = SynapseForm.GetLabel("FilterDate.And"); ckNull.Text = SynapseForm.GetLabel("FilterDate.Null"); }
public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode) { base.initForm(Mode); switch (_action) { case "NEW": this.Text = this.Text + " - " + SynapseForm.GetLabel("global.Create"); _category.ID = 0; _category.LABEL = new LabelBag(); _category.LABEL.Labels = new List <SynapseLabel>(); foreach (SynapseLanguage lang in languages) { SynapseLabel newlabel = new SynapseLabel(); newlabel.LABELID = 0; newlabel.LANGUAGE = lang.CODE; newlabel.TEXT = ""; _category.LABEL.Labels.Add(newlabel); } break; case "EDIT": this.Text = this.Text + " - " + SynapseForm.GetLabel("global.Edit"); _category = Category.LoadByID(_categoryID); if (_category.LABEL.Labels.Count < languages.Count) { foreach (SynapseLanguage lang in languages) { if (_category.LABEL.GetLabel(lang.CODE) == null) { SynapseLabel newlabel = new SynapseLabel(); newlabel.LABELID = _category.LABEL.GetLabelID(); newlabel.LANGUAGE = lang.CODE; newlabel.TEXT = ""; newlabel.save(); _category.LABEL.Labels.Add(newlabel); } } } break; } bag.FieldName = GetLabel("frmCategory.lblBag"); bag.LblBag = _category.LABEL; bag.Visible = true; bag.Dock = DockStyle.Fill; flowLayoutPanel1.Controls.Add(bag); }
void LoadData() { //MessageBox.Show("Event:Load data"); currentweeknr = Helper.GetWeekNr(monthCalendar1.SelectionStart); zg_Graph.MasterPane.PaneList.Clear(); if (IsCollectionModified() && MessageBox.Show(SynapseForm.GetLabel("messages.savebefore"), SynapseForm.GetLabel("messages.savebeforetitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == System.Windows.Forms.DialogResult.Yes) { SaveWeek(); } gb_Data.Text = string.Format(SynapseForm.GetLabel("frm_GasEmissions.gbweekformat"), Helper.GetWeekNr(monthCalendar1.SelectionStart), monthCalendar1.SelectionStart.Year); int Year = monthCalendar1.SelectionStart.Year; int WeekNr = Helper.GetWeekNr(monthCalendar1.SelectionStart); DateTime firstdate = Helper.FirstDateOfWeek(Year, WeekNr); WeekEmissions = o_GasEmission.Load("where ChainID=" + cb_Chain.SelectedValue + " AND Date BETWEEN '" + firstdate.ToString("yyyy/MM/dd") + "' AND '" + firstdate.AddDays(6).ToString("yyyy/MM/dd") + "'"); lastdata = Helper.GetLastDate((Int64)cb_Chain.SelectedValue); for (int shift = 0; shift <= 6; shift++) { if (WeekEmissions.Where(We => We.Date == firstdate.AddDays(shift)).Count() == 0) { WeekEmissions.Add(new o_GasEmission() { Date = firstdate.AddDays(shift), ChainID = (Int64)cb_Chain.SelectedValue }); } } SynapseGraph SG = new SynapseGraph(); SG.AddTace("", (from w in WeekEmissions select new SynapseGraphPoint() { label = SynapseForm.GetLabel("labels." + w.Date.DayOfWeek.ToString()), y = (float)w.EmissionDecl }).ToList(), TraceType.Curve, Color.Blue); SG.XAxisType = XAxisType.Labels; SG.Title = gb_Data.Text; SG.DrawGraph(ref zg_Graph); zg_Graph.MasterPane.PaneList.ForEach(p => p.XAxis.Scale.FontSpec.Size = 20); zg_Graph.MasterPane.PaneList.ForEach(p => p.Title.FontSpec.Size = 20); zg_Graph.MasterPane.PaneList.ForEach(p => p.YAxis.Scale.FontSpec.Size = 20); zg_Graph.MasterPane.PaneList.ForEach(p => p.YAxis.Title.FontSpec.Size = 20); zg_Graph.MasterPane.PaneList.ForEach(p => p.YAxis.Title.Text = "Bq"); zg_Graph.AxisChange(); zg_Graph.Refresh(); olv_Data.SetObjects(WeekEmissions.OrderBy(W => W.Date)); ComputeSums(); }
//------------------------------------------------------------------- // Initialize the Control with the Site Code & fill the Entities List //------------------------------------------------------------------- public void Initialize(string SiteCode = "") { if (SiteCode != "") { _SiteCode = SiteCode; } lbEntity.Text = SynapseForm.GetLabel("RoomPicker.Entity"); lbBuilding.Text = SynapseForm.GetLabel("RoomPicker.Building"); lbRoom.Text = SynapseForm.GetLabel("RoomPicker.Room"); fillEntity(); }
void SaveWeek() { //MessageBox.Show("Event:Save changed"); try { WeekEmissions.Where(e => ((e.GasVolume != 0 || e.GasEmission != 0) && e.IsDirty)).ToList().ForEach(e => e.save()); } catch (Exception ex) { MessageBox.Show(ex.Message, SynapseForm.GetLabel("messages.errorsave")); } LoadData(); }
private void cb_Chaine_SelectedIndexChanged(object sender, EventArgs e) { Constant = o_Constant.Load("where ChainID=" + cb_Chaine.SelectedValue + " AND DateFrom<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' AND DateTo>='" + DateTime.Now.ToString("yyyy-MM-dd") + "'").FirstOrDefault(); if (Constant == null) { Constant = new o_Constant(); } lb_DateFrom.Text = "Actif depuis le " + Constant.DateFrom.ToString("dd/MM/yyyy"); txt_OldBackNoise.Text = Constant.BackgroundNoise.ToString("0.000E+00"); txt_OldDetectionLimit.Text = Constant.DetectionLimit.ToString("0.000E+00"); string olduserencode = "inconnu"; string olduservalid = "inconnu"; try { olduserencode = SynapseCore.Entities.SynapseUser.LoadByUserID(Constant.EncodedBy).ToString(); } catch (Exception) { } try { olduservalid = SynapseCore.Entities.SynapseUser.LoadByUserID(Constant.ValidationBy).ToString(); } catch (Exception) { } lb_oldvalid.Text = string.Format(SynapseForm.GetLabel("messages.encodedmessage"), Constant.EncodedDate.ToString("dd/MM/yyyy HH:mm"), olduserencode, Constant.ValidationDate.ToString("dd/MM/yyyy HH:mm"), olduservalid); UnvalidatedConstant = o_Constant.Load("where ChainID=" + cb_Chaine.SelectedValue + " AND DateFrom='" + DateTime.MaxValue.ToString("yyyy-MM-dd") + "' AND DateTo='" + DateTime.MaxValue.ToString("yyyy-MM-dd") + "'").FirstOrDefault(); if (UnvalidatedConstant != null) { txt_NewBackNoise.Text = UnvalidatedConstant.BackgroundNoise.ToString("0.000E+00"); txt_NewDetectionLimit.Text = UnvalidatedConstant.DetectionLimit.ToString("0.000E+00"); gb_Validate.Enabled = true; pnl_waitingvalidation.Visible = true; btn_ApplyC.Enabled = false; string newuserencode = ""; try { newuserencode = SynapseCore.Entities.SynapseUser.LoadByUserID(UnvalidatedConstant.EncodedBy).ToString(); } catch (Exception) { } lb_newvalid.Text = string.Format(SynapseForm.GetLabel("messages.encodedmessage"), UnvalidatedConstant.EncodedDate.ToString("dd/MM/yyyy HH:mm"), newuserencode, "", ""); } else { txt_NewBackNoise.Text = ""; txt_NewDetectionLimit.Text = ""; gb_Validate.Enabled = false; pnl_waitingvalidation.Visible = false; lb_newvalid.Text = ""; btn_ApplyC.Enabled = true; } }
public void InitializeSearcher() { ParentToolStrip = (ToolStrip)this.Parent; if (ParentToolStrip.Items.Contains(txtToSearch)) { ParentToolStrip.Items.Remove(txtToSearch); } if (ParentToolStrip.Items.Contains(btEraseSearch)) { ParentToolStrip.Items.Remove(btEraseSearch); } txtToSearch = new ToolStripTextBox(); txtToSearch.BorderStyle = BorderStyle.FixedSingle; txtToSearch.KeyUp += new KeyEventHandler(txtToSearch_KeyUp); ParentToolStrip.Items.Insert(ParentToolStrip.Items.IndexOf(this) + 1, txtToSearch); btEraseSearch = new ToolStripButton(); btEraseSearch.Click += new EventHandler(btEraseSearch_Click); btEraseSearch.Text = _EraseButtonText; btEraseSearch.Image = Properties.Resources.Eraser; btEraseSearch.DisplayStyle = ToolStripItemDisplayStyle.Image; ParentToolStrip.Items.Insert(ParentToolStrip.Items.IndexOf(this) + 2, btEraseSearch); CreateMenuList(); CreateColumnList(); if (_UseFrameworkGetLabel) { this.Text = SynapseForm.GetLabel(_SearchButtonText); btEraseSearch.Text = SynapseForm.GetLabel(_EraseButtonText); mnuSelectAll.Text = SynapseForm.GetLabel(_SelectAllText); mnuUnselectAll.Text = SynapseForm.GetLabel(_UnselectAllText); mnuHighlight.Text = SynapseForm.GetLabel(_HilightResultText); } else { this.Text = _SearchButtonText; btEraseSearch.Text = _EraseButtonText; mnuSelectAll.Text = _SelectAllText; mnuUnselectAll.Text = _UnselectAllText; mnuHighlight.Text = _HilightResultText; } this.DropDown.Closing += new ToolStripDropDownClosingEventHandler(DropDown_Closing); }
public static void addError(String code, String param = "") { String _msg; _msg = SynapseForm.GetLabel(code); if (_msg == null) { _msg = code; } if (param != "") { _msg = _msg.Replace("#1", param); } _errorList.Add(_msg); }
private void ckBoolean_CheckStateChanged(object sender, EventArgs e) { switch (ckBoolean.CheckState) { case CheckState.Checked: ckBoolean.Text = SynapseForm.GetLabel("FilterBool.Yes"); ckBoolean.ImageKey = "True"; break; case CheckState.Unchecked: ckBoolean.Text = SynapseForm.GetLabel("FilterBool.No"); ckBoolean.ImageKey = "False"; break; case CheckState.Indeterminate: ckBoolean.Text = SynapseForm.GetLabel("FilterBool.Indeterminate"); ckBoolean.ImageKey = ""; break; } }
private Boolean checkFields() { Boolean check = true; synapseErrorProvider1.SetError(txCode, ""); synapseErrorProvider1.SetError(txName, ""); if (txCode.Text == "") { GlobalFunctions.addError("RoomPicker.Err.0001"); synapseErrorProvider1.SetError(txCode, SynapseForm.GetLabel("RoomPicker.Err.0001")); check = false; } if (txName.Text == "") { GlobalFunctions.addError("RoomPicker.Err.0002"); synapseErrorProvider1.SetError(txName, SynapseForm.GetLabel("RoomPicker.Err.0002")); check = false; } return(check); }
private void olv_Data_CellEditFinishing(object sender, SynapseAdvancedControls.CellEditEventArgs e) { try { if (e.Column == col_GazVolume && (double)e.NewValue.AsScientific() != 0) { if (((o_GasEmission)e.RowObject).Date > lastdata) { lastdata = ((o_GasEmission)e.RowObject).Date; } } if (e.Column == col_GazDischarge && (double)e.NewValue.AsScientific() != 0) { if (((o_GasEmission)e.RowObject).Date > lastdata) { lastdata = ((o_GasEmission)e.RowObject).Date; } } ////ici // if (((e.Column == col_GazVolume && e.Value.AsScientific() != e.NewValue.AsScientific()) || // (e.Column == col_GazDischarge && e.Value.AsScientific() != e.NewValue.AsScientific()) || // (e.Column == col_Remarque && e.Value != e.NewValue)) && ((o_GasEmission)e.RowObject).HS == true) // { // if (MessageBox.Show(SynapseForm.GetLabel("messages.errorcannotediths"), SynapseForm.GetLabel("messages.errorcannotedithstitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == System.Windows.Forms.DialogResult.No) // e.Cancel = true; // } if (e.Column == col_GazDischarge && e.Value.AsScientific() != e.NewValue.AsScientific()) { double EmissionAvg = Helper.LastDaysEmissionAvg(((o_GasEmission)e.RowObject).Date, ((o_GasEmission)e.RowObject).ChainID); double prc = (Math.Abs(e.NewValue.AsScientific() - EmissionAvg) / EmissionAvg); if (prc > Helper.ToleranceWarning) { MessageBox.Show(SynapseForm.GetLabel("messages.farfromavg") + " " + (prc).ToString("0.00 %")); } UpdateEncoder(e.RowObject); } if (e.Column == col_GazVolume && e.Value.AsScientific() != e.NewValue.AsScientific()) { double VolumeAvg = Helper.LastDaysVolumeAvg(((o_GasEmission)e.RowObject).Date, ((o_GasEmission)e.RowObject).ChainID); double prc = (Math.Abs(e.NewValue.AsScientific() - VolumeAvg) / VolumeAvg); if (prc > Helper.ToleranceWarning) { MessageBox.Show(SynapseForm.GetLabel("messages.farfromavg") + " " + (prc).ToString("0.00 %")); } UpdateEncoder(e.RowObject); } if (e.Column == col_Remarque && e.Value != e.NewValue) { UpdateEncoder(e.RowObject); } if (e.Column == col_OtherChainHS && e.Value != e.NewValue) { UpdateEncoder(e.RowObject); } } catch (InvalidScienitficException) { MessageBox.Show(SynapseForm.GetLabel("messages.errorinvalidformat")); e.Cancel = true; } //MessageBox.Show("cell edit finishing"); //e.ListViewItem }
private void olv_Data_SubItemChecking(object sender, SynapseAdvancedControls.SubItemCheckingEventArgs e) { if (((o_GasEmission)e.RowObject).Valid == true && e.Column != col_Approved) { e.Canceled = true; return; } //MessageBox.Show("subitem checking"); if (((o_GasEmission)e.RowObject).Date > lastdata.AddDays(1)) { MessageBox.Show(SynapseForm.GetLabel("messages.errorcannotedit")); e.Canceled = true; } if (e.Column == col_OtherChainHS && e.CurrentValue != e.NewValue) { UpdateEncoder(e.RowObject); } if (e.Column == col_OtherChainHS && e.CurrentValue == CheckState.Checked && e.NewValue == CheckState.Unchecked) { if (MessageBox.Show(SynapseForm.GetLabel("messages.errorcannotediths"), SynapseForm.GetLabel("messages.errorcannotedithstitle"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.Yes) { ((o_GasEmission)e.RowObject).Remarque = ""; ((o_GasEmission)e.RowObject).HSChainID = 0; ((o_GasEmission)e.RowObject).GasVolume = 0; ((o_GasEmission)e.RowObject).GasEmission = 0; } else { e.Canceled = true; } } if (e.Column == col_Approved && e.CurrentValue != e.NewValue) { if ((e.NewValue) == CheckState.Checked) { if (SynapseForm.FormUser.UserID.ToUpper() == ((o_GasEmission)e.RowObject).EncodedBy.ToUpper()) { e.Canceled = true; MessageBox.Show(SynapseForm.GetLabel("messages.errordoublevalidation"), SynapseForm.GetLabel("messages.errordoublevalidationtitle"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { UpdateValidator(e.RowObject); } } else { if (((o_GasEmission)e.RowObject).ValidationBy.ToUpper() == SynapseForm.FormUser.UserID.ToUpper()) { ((o_GasEmission)e.RowObject).ValidationBy = ""; ((o_GasEmission)e.RowObject).ValidationDate = DateTime.MaxValue; } else { e.Canceled = true; } } } olv_Data.RefreshObject(e.RowObject); //olv_Data.Refresh(); }
public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode) { base.initForm(Mode); switch (_action) { case "NEW": this.Text = this.Text + " - " + SynapseForm.GetLabel("Label.Create"); _module.ID = 0; txPath.Text = ""; txTechnicalName.Text = ""; txVersion.Text = ""; txVersionDate.Text = ""; txCategory.Text = ""; txDevSources.Text = ""; txProdSources.Text = ""; ckActive.Checked = true; ckRequestable.Checked = false; _module.FriendlyName = new LabelBag(); _module.FriendlyName.Labels = new List <SynapseLabel>(); _module.Description = new LabelBag(); _module.Description.Labels = new List <SynapseLabel>(); foreach (SynapseLanguage lang in languages) { SynapseLabel newFriendlyName = new SynapseLabel(); newFriendlyName.LABELID = 0; newFriendlyName.LANGUAGE = lang.CODE; newFriendlyName.TEXT = ""; _module.FriendlyName.Labels.Add(newFriendlyName); SynapseLabel newDescription = new SynapseLabel(); newDescription.LABELID = 0; newDescription.LANGUAGE = lang.CODE; newDescription.TEXT = ""; _module.Description.Labels.Add(newDescription); } break; case "EDIT": this.Text = this.Text + " - " + SynapseForm.GetLabel("Label.Edit"); _module = SynapseModule.LoadByID(_moduleID); txPath.Text = _module.PATH; txTechnicalName.Text = _module.TECHNICALNAME; txVersion.Text = _module.VERSION; txVersionDate.Text = _module.VERSIONDATE; txCategory.Text = _module.MODULECATEGORY; txDevSources.Text = _module.DEVSOURCE; txProdSources.Text = _module.PRODSOURCE; ckActive.Checked = _module.IS_ACTIVE; ckRequestable.Checked = _module.IS_REQUESTABLE; if (_module.FriendlyName.Labels.Count < languages.Count) { foreach (SynapseLanguage lang in languages) { if (_module.FriendlyName.GetLabel(lang.CODE) == null) { SynapseLabel newlabel = new SynapseLabel(); newlabel.LABELID = _module.FriendlyName.GetLabelID(); newlabel.LANGUAGE = lang.CODE; newlabel.TEXT = ""; newlabel.save(); _module.FriendlyName.Labels.Add(newlabel); } } } if (_module.Description.Labels.Count < languages.Count) { foreach (SynapseLanguage lang in languages) { if (_module.Description.GetLabel(lang.CODE) == null) { SynapseLabel newlabel = new SynapseLabel(); newlabel.LABELID = _module.Description.GetLabelID(); newlabel.LANGUAGE = lang.CODE; newlabel.TEXT = ""; newlabel.save(); _module.Description.Labels.Add(newlabel); } } } break; } bagName.FieldName = GetLabel("frmModule.gbFiendlyName"); bagName.LblBag = _module.FriendlyName; bagName.Visible = true; bagName.Dock = DockStyle.Fill; flowLayoutPanel1.Controls.Add(bagName); bagDescription.FieldName = GetLabel("frmModule.gbDescription"); bagDescription.LblBag = _module.Description; bagDescription.Visible = true; bagDescription.Dock = DockStyle.Fill; flowLayoutPanel1.Controls.Add(bagDescription); }
public static void ObjectToForm(this SynapseForm form, object obj) { IList <SynapseControl> FormControls = SynapseForm.FormUser.UserControls.Values.Cast <SynapseControl>().Where(ctrl => ctrl.CTRL_NAME.Length > 0).ToList(); IList <PropertyInfo> properties = (obj.GetType()).GetProperties(); var c = GetAll(form, typeof(TextBox)); }
private void InitializeControl() { ckBoolean.CheckState = CheckState.Indeterminate; ckBoolean.Text = SynapseForm.GetLabel("FilterBool.Indeterminate"); }
public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode) { base.initForm(Mode); ckOwner.Text = SynapseForm.GetLabel("frmGroup.ckOwner"); fillModule(); switch (_action) { case "NEW": this.Text = this.Text + " - " + SynapseForm.GetLabel("Label.Create"); _profile.ID = 0; cbModule.SelectedIndex = -1; txTechnicalName.Text = ""; txLevel.Text = ""; ckOwner.Checked = false; _profile.Description = new LabelBag(); _profile.Description.Labels = new List <SynapseLabel>(); foreach (SynapseLanguage lang in languages) { SynapseLabel newDescription = new SynapseLabel(); newDescription.LABELID = 0; newDescription.LANGUAGE = lang.CODE; newDescription.TEXT = ""; _profile.Description.Labels.Add(newDescription); } break; case "EDIT": this.Text = this.Text + " - " + SynapseForm.GetLabel("Label.Edit"); if (_profile.FK_ModuleID != null) { cbModule.SelectedValue = _profile.FK_ModuleID; } else { cbModule.SelectedIndex = -1; } txTechnicalName.Text = _profile.TECHNICALNAME; txLevel.Text = _profile.LEVEL.ToString(); ckOwner.Checked = _profile.IS_OWNER; if (_profile.Description.Labels.Count < languages.Count) { foreach (SynapseLanguage lang in languages) { if (_profile.Description.GetLabel(lang.CODE) == null) { SynapseLabel newlabel = new SynapseLabel(); newlabel.LABELID = _profile.Description.GetLabelID(); newlabel.LANGUAGE = lang.CODE; newlabel.TEXT = ""; newlabel.save(); _profile.Description.Labels.Add(newlabel); } } } break; } bagDescription.FieldName = GetLabel("frmGroup.gbDescription"); bagDescription.LblBag = _profile.Description; bagDescription.Visible = true; bagDescription.Dock = DockStyle.Fill; flowLayoutPanel1.Controls.Add(bagDescription); }
private void InitializeControl() { DataSet _data = new DataSet(); DataTable _tbl = new DataTable("COMPARE"); DataSet _dsYearFrom = new DataSet(); DataSet _dsYearTo = new DataSet(); DataTable _tblYear = new DataTable("YEAR"); DataSet _dsMonthFrom = new DataSet(); DataSet _dsMonthTo = new DataSet(); DataTable _tblMonth = new DataTable("MONTH"); _tbl.Columns.Add("VALUE", System.Type.GetType("System.String")); _tbl.Columns.Add("DISPLAY", System.Type.GetType("System.String")); _data.Tables.Add(_tbl); _tblYear.Columns.Add("VALUE", System.Type.GetType("System.String")); _tblYear.Columns.Add("DISPLAY", System.Type.GetType("System.String")); _data.Tables.Add(_tblYear); _tblMonth.Columns.Add("VALUE", System.Type.GetType("System.String")); _tblMonth.Columns.Add("DISPLAY", System.Type.GetType("System.String")); _data.Tables.Add(_tblMonth); DataRow _row = _data.Tables["COMPARE"].NewRow(); DataRow _rowYear = _data.Tables["YEAR"].NewRow(); DataRow _rowMonth = _data.Tables["MONTH"].NewRow(); _row["VALUE"] = ""; _row["DISPLAY"] = "*"; _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = "="; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.Equal"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = "<"; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.Before"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = ">"; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.After"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = "<="; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.BeforeOrEqual"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = ">="; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.AfterOrEqual"); _data.Tables["COMPARE"].Rows.Add(_row); _row = _data.Tables["COMPARE"].NewRow(); _row["VALUE"] = "BETWEEN"; _row["DISPLAY"] = SynapseForm.GetLabel("FilterDate.Between"); _data.Tables["COMPARE"].Rows.Add(_row); ComboBox.DataSource = _data.Tables["COMPARE"]; ComboBox.ValueMember = "VALUE"; ComboBox.DisplayMember = "DISPLAY"; for (int x = 0; x > -11; x--) { string year = DateTime.Now.AddYears(x).Year.ToString(); _rowYear = _data.Tables["YEAR"].NewRow(); _rowYear["VALUE"] = year; _rowYear["DISPLAY"] = year; _data.Tables["YEAR"].Rows.Add(_rowYear); } yearFrom.DataSource = _data.Tables["YEAR"]; yearFrom.ValueMember = "VALUE"; yearFrom.DisplayMember = "DISPLAY"; //_dsYearTo = _dsYearFrom.Copy(); yearTo.DataSource = _data.Tables["YEAR"].Copy(); yearTo.ValueMember = "VALUE"; yearTo.DisplayMember = "DISPLAY"; for (int x = 1; x < 13; x++) { string month = x.ToString().PadLeft(2, '0'); _rowMonth = _data.Tables["MONTH"].NewRow(); _rowMonth["VALUE"] = month; _rowMonth["DISPLAY"] = month; _data.Tables["MONTH"].Rows.Add(_rowMonth); } monthFrom.DataSource = _data.Tables["MONTH"]; monthFrom.ValueMember = "VALUE"; monthFrom.DisplayMember = "DISPLAY"; //_dsMonthTo = _dsMonthFrom.Copy(); monthTo.DataSource = _data.Tables["MONTH"].Copy(); monthTo.ValueMember = "VALUE"; monthTo.DisplayMember = "DISPLAY"; lbl2.Text = SynapseForm.GetLabel("FilterDate.And"); }