vb.net - Issue saving custom DateEdit and TimeEdit fields using a custom AppointmentEdit form -
i have custom editappointment form contains 3 sets of start , end fields. 
the start , end fields in planning section default appointment fields bound start , end in scheduler mappings.
the start , end fields under published , actual read , same type of fields under planning (devexpress.xtraeditors.dateedit , devexpress.xtraeditors.timeedit), , save values customfields mapped in scheduler mappings.
the custom fields defined properties:
public class myappointmentformcontroller inherits appointmentformcontroller ... public property custompublishedstartdatetime() datetime return cdate(editedappointmentcopy.customfields("publishedstartdatetime")) end set(byval value datetime) editedappointmentcopy.customfields("publishedstartdatetime") = value end set end property public property custompublishedcompleteddatetime() datetime return cdate(editedappointmentcopy.customfields("publishedcompleteddatetime")) end set(byval value datetime) editedappointmentcopy.customfields("publishedcompleteddatetime") = value end set end property ... end class i change start , end dates under planning until things line on timeline , click publish copies data planning publish:
' copies planned data published private sub btnpublishjob_click(sender object, e eventargs) handles btnpublishjob.click txtcustompublishedpackagingline.text = appointmentresourceedit1.text txtcustompublishedrunratepershift.text = txtcustomplanningrunratepershift.text dtpublishedstart.editvalue = dtplanningstart.editvalue timepublishedstart.editvalue = new datetime(timeplanningstart.time.timeofday.ticks) dtpublishedend.editvalue = dtplanningend.editvalue timepublishedend.editvalue = new datetime(timeplanningend.time.timeofday.ticks) txtcustompublishedtotalunits.text = txtcustomplannedtotalunits.text end sub then click ok:
private sub btnok_click(byval sender object, byval e eventargs) handles btnok.click ' required check appointment conflicts. if (not controller.isconflictresolved()) return end if ' save planning controller.displaystart = me.dtplanningstart.datetime.date + me.timeplanningstart.time.timeofday controller.displayend = me.dtplanningend.datetime.date + me.timeplanningend.time.timeofday controller.customplannedrunratepershift = txtcustomplanningrunratepershift.text ' save published controller.custompublishedstartdatetime = me.dtpublishedstart.datetime.date + me.timepublishedstart.time.timeofday controller.custompublishedcompleteddatetime = me.dtpublishedend.datetime.date + me.timepublishedend.time.timeofday controller.custompublishedpackagingline = txtcustompublishedpackagingline.text controller.custompublishedrunratepershift = txtcustompublishedrunratepershift.text controller.description = rtbcustomjobnotes.text try ' save changes of editing appointment. controller.applychanges() catch ex exception messagebox.show(ex.message) end try end sub when code reaches controller.applychanges() following error:
formatexception occurred
input sting not in correct format.
troubleshooting tips:
when converting string datetime, parse string take date before putting each variable datetime object.
...
i've tried datetime.parse, datetime.parseexact, date.parse, date.parseexact, assigning date first adding time, , plenty of other things, can't past this.
how should save dates custom appointmentedit form sql database. hoping use custom appointment properties make simple.
i'm worried published start , end date , times.
Comments
Post a Comment