private void toolStripButtonEdit_Click(object sender, EventArgs e) { int ret = Errors.SUCCESS; log.Debug("-- toolStripButtonEdit_Click()"); this.actionBeforeStartDisableAllActions(); log.Debug("lpa: " + ProfileManagerBusinessLayer.listProfileViewToString(this.lpa)); log.Debug("lpd: " + ProfileManagerBusinessLayer.listProfileViewToString(this.lpd)); ProfileViewData pvd = getSelected(this.lpa, this.lpd); ProfileViewData newProf = new ProfileViewData(); FormProfileEditor editor = new FormProfileEditor(); editor.ShowDialog(); if (!editor.wasCancelled()) { newProf.name = editor.getName(); newProf.color = editor.getColor(); if (pvd != null) { string errMsg = ""; ret = this.managerBusinessLayer.action_updateProfile(newProf, pvd, out errMsg); this.analyzeReturn(ret, errMsg); } // * POST ACTION FORM UPDATE this.postActionUpdate(); this.updateToolStripButtons(); } else { log.Debug("** Edit process was CANCELLED!"); } }
private void toolStripButtonActivate_Click(object sender, EventArgs e) { this.actionBeforeStartDisableAllActions(); // * EXECUTE ACTION int ret = 0; string errMsg = ""; ProfileViewData pvd = getSelected(this.lpa, this.lpd); if (pvd != null) { if (pvd.state == ProfileType.INACTIVE) { FormProfileEditor editor = new FormProfileEditor(); editor.ShowDialog(); if (!editor.wasCancelled()) { ProfileViewData newProf = new ProfileViewData(); newProf.name = editor.getName(); newProf.color = editor.getColor(); string creatinDate = ""; try { creatinDate = DateTime.Now.ToString(this.managerBusinessLayer.dateFormat()); } catch (Exception ex) { log.Warn("EXCEPTION: Message:" + ex.Message + ", StackTrace:" + ex.StackTrace); log.Warn("Error on using dataFormat! dateFormat:<" + this.managerBusinessLayer.dateFormat() + ">"); creatinDate = DateTime.Now.ToString("yyyy/MM/dd"); } newProf.creatingDate = creatinDate; ret = this.managerBusinessLayer.action_activateInactive(newProf); this.analyzeReturn(ret, ""); } else { log.Debug("** EDIT ACTION WAS CANCELLED"); } } else // ProfileType.DESACTIVATED { ret = this.managerBusinessLayer.action_activateDesactivated(pvd, out errMsg); this.analyzeReturn(ret, errMsg); } } // * POST ACTION FORM UPDATE this.postActionUpdate(); this.updateToolStripButtons(); }