Tuesday, 6 January 2015

Dialog : Conditional update in to DB

When you modify  vehicle status , dialog box should appear and when we click yes, log should be entered in to table , if no the value  should remain unchanged and record should not be entered in to table

public boolean modified()
{
    boolean ret;
    DialogButton diagBut;
     str strMessage,strTitle;
    NQ_ServiceObjectStatusLog nQ_ServiceObjectStatusLog;
     strMessage = "Do you Want to Change Vehicle Status";
     strTitle = "Status Change Confirmation";

    diagBut = Box::yesNoCancel(
        strMessage,
        DialogButton::No, // Initial focus is on the No button.
        strTitle);
    if (diagBut == DialogButton::No)
        {
            ret = false;
        }
    else
        {
            ret =true;
             ret = super();
            nQ_ServiceObjectStatusLog.ServiceObjectId = SMAObjectTable.ServiceObjectId;
            nQ_ServiceObjectStatusLog.NQ_VehicleStatus = SMAObjectTable.NQ_VehicleStatus;
            nQ_ServiceObjectStatusLog.UserId = curUserId();
            nQ_ServiceObjectStatusLog.StatusChangeTime = DateTimeUtil::getSystemDateTime();
            nQ_ServiceObjectStatusLog.insert();

        }
   //super();  Super - is mandatory commented super because, its opening 2 times  the dialog box, even after  entering  Yes. 

If  not commented , when you click "No" we are getting newly selected value not , previous value before selection . which is wrong.
    return ret;
}

No comments:

Post a Comment