Checkbox question

10 posts, 1 answers
  1. Guy
    Guy avatar
    60 posts
    Member since:
    Sep 2010

    Posted 31 Jan 2011 Link to this post

    Afternoon,

    I'm working on a little idea and wondered if it would be the best way to go. Basically i'm working on a basic CRM system for a sales environment. The section i'm working on is based around recording quotes. As a helpful reporting tool i'm now going to try to record from when the quote was opened to when it was won as this will show turn around times.

    Now the problem I have is trying to record that difference. My current idea is for them to have a checkbox which they tick to indicate it has been won and then to record the datetime in another cell. This will then give me my start and finish dates. I've looked at both using a custom popup editor like the one here http://www.telerik.com/support/kb/winforms/gridview/create-pop-up-user-control-for-row-editing.aspx and using a checkbox column in the gridview. It is my feeling that the gridview checkbox would be the simplest way to go.

    What I'm stuck on is how to, when the checkbox is selected, set the value of another cell in the same row with the current datetime. I think I would also want it so that once the checkbox has been ticked, it cannot be unticked else the results would be modified for the reporting end of things.

    Is this the best way to go or is there a better solution? Any ideas or help would be greatly appreciated.

    Regards,

    Guy
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 01 Feb 2011 Link to this post

    Hello Guy,

    Personally, I would probably look at not involving the UI at all. If you are using a database to store your data, then you probably have a status for your quotes that records which status the record is on, E.g. Opened and Won etc.. If it were me I would simply record dates and times in the database when rows change from one status to another. The status can also dictate if the record can be edited or not 

    hope that helps, but let me know if you need more information
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Guy
    Guy avatar
    60 posts
    Member since:
    Sep 2010

    Posted 01 Feb 2011 Link to this post

    Hi Richard,

    Yes, there is a dropdown with different status'. How would you go about recording the datetime on a status change and what would be the best practice for disabling the dropdown? I'm assuming that I would capture the drop down event and if the value is "Won" then cancel the request, is that correct?

    Regards,

    Guy
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 01 Feb 2011 Link to this post

    Hello Guy,

    It depends if you are saving all the changes at once, or as the user goes. I prefer saving the changes at the end, and making all the required updates at the database level. If a user accidentally changes a status and it then no longer allows them to edit, it may become an issue. Once the changes are saved, you can easily make a cell read only depending on the status of another cell using the CellFormatting event.
    Hope that helps, but let me know if you have further questions
    Richard
  6. Guy
    Guy avatar
    60 posts
    Member since:
    Sep 2010

    Posted 01 Feb 2011 Link to this post

    Hi Richard,

    All changes are saved at once but they're done through a secondary popup form with the details then stored in a new row and displayed within a gridview. Typically what they would do is create a new quote, enter the creation date, set the status and save.

    Later they can then go back through their quotes for that customer. Obviously different quotes can be open at once.

    Do you perhaps think I should have a quote status and a quote result and have the quote result as a editible dropdown on the row within the gridview? Or is that now just sounding like a different way of doing the checkbox? Would still need to store the datetime some how and then there's the problem of them picking a different result from the dropdown.

    Regards,

    Guy
  7. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 01 Feb 2011 Link to this post

    Hello Guy,

    It's difficult to say to be honest without seeing your database model. So you don't have in-grid editing, you're editing and changing through a dialog form that the row data is passed, then I guess you're getting the row data and dialog status back from the edit form and updating the grid. Is that right?

    As long as the datetime stamp is written by the database, based on changes in the status, it sounds like you are doing the right things to me.
    Hope that helps
    Richard
  8. Guy
    Guy avatar
    60 posts
    Member since:
    Sep 2010

    Posted 01 Feb 2011 Link to this post

    Hi Richard,

    Thanks for your help so far, really greatful.

    The way I have my database structured is with a main parent table which contains a list of customers by their account number along with address details and a few other bits. This is displayed in a main gridview. Beneath it is a page view control with several different tabs (contacts, equipment, quotes and call log). There is also some controls tied into the main table to make some edits there.

    Each tab on the pageview contains a gridview showing the entries for the selected account (this is determined by using the customer account number as a hidden filter). To add entries to each of these sections the user opens a secondary form which has tab each for the relevant sections and controls for the users to fill out and save.

    Some of the child gridviews have edit options but the quote one currently does not and this is partly why I wanted to work on something a) because quote status' will change and b) to start logging some additional info for reports.

    I think what I need to do is have it so once a selection has been made/changed and depending on the one selected, the datetime is stored for that criteria in its own section so that way I can actually build up a more detailed history of what's happening.

    Now you suggest that the changes are written by the database and not the UI? Could you point me in the right direction of how I might go about that?

    Guy
  9. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Feb 2011 Link to this post

    Hello Guy,

    When you save back the data, you'll just need to use the SQL GetDate function to write the date to where ever you store it. If you are storing a table with dates and status changes in them, then I would imagine that you will write to that table based on the insert / update of your main tables based on SQL Triggers.

    Hope that helps
    Richard
  10. Guy
    Guy avatar
    60 posts
    Member since:
    Sep 2010

    Posted 03 Feb 2011 Link to this post

    Hi Richard,

    Thanks for all your help. I think i'm going to have to give a bit more thought onto this section and incorporate your advice. I'm going to mark as answer and you have given me more than enough to think about.

    If I have any further questions I will create a new thread.

    Thank again!

    Guy
  11. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 03 Feb 2011 Link to this post

    You're welcome Guy. it was difficut to be more specific, but if you have any other questions, and you think I might be able to help then do ley me know
    Regards,
    Richard
Back to Top
UI for WinForms is Visual Studio 2017 Ready