private void ms_function_click(object sender, EventArgs e) { MyMenuItem item = sender as MyMenuItem; ModulInterface modul = this.modules[item.moduleId]; FunctionInterface function = modul.getFunctions()[item.functionId]; UIBuilderInterface builder = new UIBuilder(); function.buildUI(builder); EingabeManager em = new EingabeManager(); UserDataInterface data = em.getUserData(builder); if (data == null) { return; } try { lb_Ergebnis.Items.Add(function.calculate(data)); } catch (Exception err) { lb_Ergebnis.Items.Add(err.Message + err.StackTrace); Console.Write(err.StackTrace); } }
string FunctionInterface.calculate(UserDataInterface data) { double grundWert; double prozentWert; grundWert = Convert.ToDouble(data.getStringValue("baseVal")); prozentWert = Convert.ToDouble(data.getStringValue("percentVal")); double res = grundWert * (prozentWert / 100); return((prozentWert / 100) + " * " + grundWert + " = " + res); }
string FunctionInterface.calculate(UserDataInterface data) { double grundWert; double prozentWert; grundWert = Convert.ToDouble(data.getStringValue("baseVal")); prozentWert = Convert.ToDouble(data.getStringValue("percentVal")); double subVal = grundWert * (prozentWert / 100); return(grundWert + " - (" + prozentWert / 100 + " * " + grundWert + ") = " + (grundWert - subVal).ToString()); }
string FunctionInterface.calculate(UserDataInterface data) { double grundWert; String resStr = "(@NETTO@ * @MWST@) + @NETTO@"; grundWert = Convert.ToDouble(data.getStringValue("baseVal")); double mwst = 0.19; double res = (grundWert * mwst) + grundWert; resStr = resStr.Replace("@NETTO@", grundWert.ToString()).Replace("@MWST@", mwst.ToString()) + " = " + String.Format("{0:f}", res); return(resStr); }
string FunctionInterface.calculate(UserDataInterface data) { double grundWert; double prozentWert; String resStr = "(@GW@ / 100) * @PW@"; grundWert = Convert.ToDouble(data.getStringValue("baseVal")); prozentWert = Convert.ToDouble(data.getStringValue("percentVal")); double res = (grundWert / 100) * prozentWert; resStr = resStr.Replace("@GW@", grundWert.ToString()).Replace("@PW@", prozentWert.ToString()) + " = " + String.Format("{0:f}", res) + " %"; return(resStr); }
string FunctionInterface.calculate(UserDataInterface data) { int res = 0; return(res + data.getStringValue("s1")); }