示例#1
0
        private void ConfirmButton_Click(object sender, RoutedEventArgs e)
        {
            string lastname = _lastnameTextBox.Text;
            string surname  = _surnameTextBox.Text;
            string content  = _contentTextBox.Text;

            string[] validation = DataValidation.Note(lastname, surname, content);
            if (validation[0] != "valid")
            {
                error.Content    = validation[0];
                error.Foreground = new SolidColorBrush(Colors.Red);
            }

            DateTime currentDateTime = DateTime.Now;

            int studentId = int.Parse(validation[1]);

            int noteId = Database.Insert.Note.One(studentId, content);

            NoteDetails noteDetails = new NoteDetails()
            {
                ID           = noteId,
                CreationDate = currentDateTime.ToString("g", GlobalVariable.culture),
                Content      = content
            };

            NotesDetails.noteCollection.Add(noteDetails);
        }
示例#2
0
 // Update is called once per frame
 void Update()
 {
     if (run)
     {
         NoteDetails change = new NoteDetails();
         change.gridPosition = new Vector2(0, 1);
         change.inverted     = true;
         change.timeToSpawn  = 2.375f;
         MiniMap.AddNoteChange(change);
         run = false;
     }
 }
示例#3
0
 //GET: InReviewNotes
 public ActionResult inReviewNotes(int id)
 {
     using (NMEntities DBobj = new NMEntities())
     {
         NoteDetails note = DBobj.NoteDetails.FirstOrDefault(x => x.NoteID == id);
         if (note != null)
         {
             note.Status        = 5;
             note.PublishedDate = DateTime.Now;
             note.ActionBy      = (int)Session["UserID"];
             note.ModifiedBy    = (int)Session["UserID"];
             note.ModifiedDate  = DateTime.Now;
             DBobj.SaveChanges();
         }
         return(RedirectToAction("notesUnderReview", "Admin"));
     }
 }
示例#4
0
 //GET: DeleteAdmin
 public ActionResult unpublishNote(int id, string adminRemarks)
 {
     using (NMEntities DBobj = new NMEntities())
     {
         NoteDetails note = DBobj.NoteDetails.FirstOrDefault(x => x.NoteID == id);
         Users       u    = DBobj.Users.Where(x => x.UserID == note.SellerID).FirstOrDefault();
         if (note != null)
         {
             note.Status        = 1005;
             note.AdminRemarks  = adminRemarks;
             note.PublishedDate = DateTime.Now;
             note.ActionBy      = (int)Session["UserID"];
             note.ModifiedBy    = (int)Session["UserID"];
             note.ModifiedDate  = DateTime.Now;
             DBobj.SaveChanges();
             unpublishSellerNote.unpublishNote(u.FirstName, u.EmailID, adminRemarks);
         }
         return(RedirectToAction("dashboard", "Admin"));
     }
 }
示例#5
0
文件: Ext116.cs 项目: billy84/Xamarin
        public async Task <DownloadDataChangesResult> CheckForDataDownloadChangesAsync(
            string v_sCompanyName,
            string v_sPurpose,
            ObservableCollection <DownloadDataChange> v_cSubProjects,
            bool v_bCheckForNewSubProjects,
            string v_sAuthID,
            string v_sToken)
        {
            m_wcfClient = new WcfExt116.ServiceClient();
            DownloadDataChangesResult result = new DownloadDataChangesResult();

            try
            {
                ObservableCollection <WcfExt116.DownloadDataChange> cSubProjects = new ObservableCollection <WcfExt116.DownloadDataChange>();
                foreach (DownloadDataChange o in v_cSubProjects)
                {
                    WcfExt116.DownloadDataChange oND = new WcfExt116.DownloadDataChange();
                    oND.ActivitiesTable_ModDate = o.ActivitiesTable_ModDate;
                    oND.Delivery_ModDate        = o.Delivery_ModDate;
                    oND.ProjTable_ModDate       = o.ProjTable_ModDate;
                    oND.sProjectNo    = o.sProjectNo;
                    oND.sSubProjectNo = o.sSubProjectNo;
                    oND.Notes         = new ObservableCollection <WcfExt116.clsRealtimeNoteKeyValues>();
                    oND.Units         = new ObservableCollection <WcfExt116.UnitDetails>();
                    cSubProjects.Add(oND);
                }
                WcfExt116.DownloadDataChangesResult sResult = await m_wcfClient.CheckForDataDownloadChangesAsync(
                    v_sCompanyName,
                    v_sPurpose,
                    cSubProjects,
                    v_bCheckForNewSubProjects,
                    v_sAuthID,
                    v_sToken);

                if (sResult.bSuccessfull == true)
                {
                    result.bSuccessfull = sResult.bSuccessfull;
                    result.pdChanged    = new ObservableCollection <SubProjectData>();
                    result.sDeleted     = new ObservableCollection <string>();
                    foreach (WcfExt116.SubProjectData o in sResult.pdChanged)
                    {
                        SubProjectData oSPD = new SubProjectData();

                        oSPD.ABPAWORDERCOMPLETEDDATE                 = o.ABPAWORDERCOMPLETEDDATE;
                        oSPD.ABPAWORIGINALSUBPROJECTID               = o.ABPAWORIGINALSUBPROJECTID;
                        oSPD.ABPAXACCESSEQUIPMENT                    = o.ABPAXACCESSEQUIPMENT;
                        oSPD.ABPAXASBESTOSPRESUMED                   = o.ABPAXASBESTOSPRESUMED;
                        oSPD.ABPAXFLOORLEVEL                         = o.ABPAXFLOORLEVEL;
                        oSPD.ABPAXHealthSaferyIncompleteUploadedBy   = o.ABPAXHealthSaferyIncompleteUploadedBy;
                        oSPD.ABPAXHealthSafetyIncomplete             = o.ABPAXHealthSafetyIncomplete;
                        oSPD.ABPAXHealthSafetyIncompleteDateUploaded = o.ABPAXHealthSafetyIncompleteDateUploaded;
                        oSPD.ABPAXINSTALLATIONTEAM                   = o.ABPAXINSTALLATIONTEAM;
                        oSPD.ABPAXINSTALLATIONTYPE                   = o.ABPAXINSTALLATIONTYPE;
                        oSPD.ABPAXINSTALLLETTERREQUIRED              = o.ABPAXINSTALLLETTERREQUIRED;
                        oSPD.ABPAXINSTALLLETTERSENTDATE01            = o.ABPAXINSTALLLETTERSENTDATE01;
                        oSPD.ABPAXINSTALLLETTERSENTDATE02            = o.ABPAXINSTALLLETTERSENTDATE02;
                        oSPD.ABPAXINSTALLLETTERSENTDATE03            = o.ABPAXINSTALLLETTERSENTDATE03;
                        oSPD.ABPAXINSTALLNEXTDAYSMS                  = o.ABPAXINSTALLNEXTDAYSMS;
                        oSPD.ABPAXINSTALLSMSSENT                     = o.ABPAXINSTALLSMSSENT;
                        oSPD.ABPAXINTERNDAMAGE                       = o.ABPAXINTERNDAMAGE;
                        oSPD.ABPAXPERMANENTGASVENT                   = o.ABPAXPERMANENTGASVENT;
                        oSPD.ABPAXPUBLICPROTECT                      = o.ABPAXPUBLICPROTECT;
                        oSPD.ABPAXSERVICESTOMOVE                     = o.ABPAXSERVICESTOMOVE;
                        oSPD.ABPAXSTRUCTURALFAULTS                   = o.ABPAXSTRUCTURALFAULTS;
                        oSPD.ABPAXWINDOWBOARD                        = o.ABPAXWINDOWBOARD;
                        oSPD.ABPAXWRKACCRESTRICTIONS                 = o.ABPAXWRKACCRESTRICTIONS;
                        oSPD.DeliveryCity   = o.DeliveryCity;
                        oSPD.DeliveryStreet = o.DeliveryStreet;
                        oSPD.Delivery_ConfirmedAppointmentIndicator = o.Delivery_ConfirmedAppointmentIndicator;
                        oSPD.Delivery_EndDateTime      = o.Delivery_EndDateTime;
                        oSPD.Delivery_ModifiedDateTime = o.Delivery_ModifiedDateTime;
                        oSPD.Delivery_StartDateTime    = o.Delivery_StartDateTime;
                        oSPD.DlvState                         = o.DlvState;
                        oSPD.DlvZipCode                       = o.DlvZipCode;
                        oSPD.Email                            = o.Email;
                        oSPD.EndDateTime                      = o.EndDateTime;
                        oSPD.MODIFIEDDATETIME                 = o.MODIFIEDDATETIME;
                        oSPD.Mxm1002InstallStatus             = o.Mxm1002InstallStatus;
                        oSPD.Mxm1002ProgressStatus            = o.Mxm1002ProgressStatus;
                        oSPD.MXM1002SequenceNr                = o.MXM1002SequenceNr;
                        oSPD.MXM1002TrfDate                   = o.MXM1002TrfDate;
                        oSPD.MXMAlternativeContactMobileNo    = o.MXMAlternativeContactMobileNo;
                        oSPD.MXMAlternativeContactName        = o.MXMAlternativeContactName;
                        oSPD.MXMAlternativeContactTelNo       = o.MXMAlternativeContactTelNo;
                        oSPD.MXMConfirmedAppointmentIndicator = o.MXMConfirmedAppointmentIndicator;
                        oSPD.MXMContactBySMS                  = o.MXMContactBySMS;
                        oSPD.MXMDisabledAdaptionsRequired     = o.MXMDisabledAdaptionsRequired;
                        oSPD.MXMDoorChoiceFormReceived        = o.MXMDoorChoiceFormReceived;
                        oSPD.MXMNextDaySMS                    = o.MXMNextDaySMS;
                        oSPD.MxmProjDescription               = o.MxmProjDescription;
                        oSPD.MXMPropertyType                  = o.MXMPropertyType;
                        oSPD.MXMResidentMobileNo              = o.MXMResidentMobileNo;
                        oSPD.MXMResidentName                  = o.MXMResidentName;
                        oSPD.MXMSMSSent                       = o.MXMSMSSent;
                        oSPD.MXMSpecialResidentNote           = o.MXMSpecialResidentNote;
                        oSPD.MXMSurveyletterRequired          = o.MXMSurveyletterRequired;
                        oSPD.MXMSurveyLetterSentDate01        = o.MXMSurveyLetterSentDate01;
                        oSPD.MXMSurveyLetterSentDate02        = o.MXMSurveyLetterSentDate02;
                        oSPD.MXMSurveyLetterSentDate03        = o.MXMSurveyLetterSentDate03;
                        oSPD.MXMSurveyorName                  = o.MXMSurveyorName;
                        oSPD.MXMSurveyorPCTag                 = o.MXMSurveyorPCTag;
                        oSPD.MXMSurveyorProfile               = o.MXMSurveyorProfile;
                        oSPD.MXMTelephoneNo                   = o.MXMTelephoneNo;
                        oSPD.Name  = o.Name;
                        oSPD.Notes = new ObservableCollection <NoteDetails>();
                        if (o.Notes != null)
                        {
                            foreach (WcfExt116.NoteDetails vo in o.Notes)
                            {
                                NoteDetails oND = new NoteDetails();
                                oND.AXRecID     = vo.AXRecID;
                                oND.DeviceIDKey = vo.DeviceIDKey;
                                oND.InputDate   = vo.InputDate;
                                oND.NoteText    = vo.NoteText;
                                oND.NoteType    = vo.NoteType;
                                oND.ProjectNo   = vo.ProjectNo;
                                oND.Purpose     = vo.Purpose;
                                oND.UserName    = vo.UserName;
                                oND.UserProfile = vo.UserProfile;
                                oSPD.Notes.Add(oND);
                            }
                        }
                        oSPD.ParentID = o.ParentID;
                        oSPD.ProjId   = o.ProjId;
                        oSPD.Purpose  = o.Purpose;
                        oSPD.SMMActivities_MODIFIEDDATETIME = o.SMMActivities_MODIFIEDDATETIME;
                        oSPD.StartDateTime = o.StartDateTime;
                        oSPD.Status        = o.Status;
                        oSPD.Units         = new ObservableCollection <UnitDetails>();
                        if (o.Units != null)
                        {
                            foreach (WcfExt116.UnitDetails vo in o.Units)
                            {
                                UnitDetails oUD = new UnitDetails();
                                oUD.dInstalledDate   = vo.dInstalledDate;
                                oUD.iInstalledStatus = vo.iInstalledStatus;
                                oUD.iUNITNUMBER      = vo.iUNITNUMBER;
                                oUD.sITEMID          = vo.sITEMID;
                                oUD.sSTYLE           = vo.sSTYLE;
                                oUD.sUNITLOCATION    = vo.sUNITLOCATION;
                                oSPD.Units.Add(oUD);
                            }
                        }
                        oSPD.URL = o.URL;
                        result.pdChanged.Add(oSPD);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#6
0
        /// <summary>
        /// Upload changes to AX.
        /// </summary>
        public async Task <bool> UploadChanges(bool v_bBackgroundTask)
        {
            bool      bConnected     = false;
            WcfExt116 cAX            = null;
            bool      bErrorOccurred = false;
            bool      bReturnStatus  = true;

            //Create changes upload object for passing to WCF.
            ObservableCollection <AXDataUploadDataChange> cChanges = new ObservableCollection <AXDataUploadDataChange>();

            //v1.0.1 - OC for new notes.
            ObservableCollection <NoteDetails> cNotes = new ObservableCollection <NoteDetails>();

            //v1.0.1 - Processing new notes.
            List <cProjectNotesTable> pntNotes = new List <cProjectNotesTable>();

            ///v1.0.1
            NoteDetails ndNote;

            //
            AXDataUploadDataChange cChange = new AXDataUploadDataChange();

            UploadChangesResult uUploadResult = null;

            string sPurpose = Settings.ReturnPurposeType();

            int iSubProjectCount = 0;

            //v1.0.10 - Unit change upload variables.
            ObservableCollection <UnitDetails> ocUnitDetails = new ObservableCollection <UnitDetails>();
            UnitDetails udUnitDetail;
            DateTime    dInstallationDate;
            string      sInstallationTeam;

            List <cUnitsUpdateTable> cUnitUpdates;

            bool bUploadOK = false;


            try
            {
                if (v_bBackgroundTask == false)
                {
                    //Update screen.
                    if (Application.Current.MainPage.Navigation.NavigationStack.Count > 0)
                    {
                        this.UpdateMessage("Checking connection..");
                    }
                }


                //Check we are connected first
                bConnected = await this.m_cSetting.IsAXSystemAvailable(false);

                if (bConnected == false)
                {
                    if (v_bBackgroundTask == false)
                    {
                        //Update screen.
                        this.UpdateMessage("No connection...");
                    }

                    return(false);
                }

                List <cUpdatesTable> cSubProjectUpdates = null;

                //string sUserName = await DependencyService.Get<ISettings>().GetUserName();
                //string sMachineName = DependencyService.Get<ISettings>().GetMachineName();
                //string sUserFullName = await DependencyService.Get<ISettings>().GetUserDisplayName();
                string sUserName     = Session.CurrentUserName;
                string sMachineName  = Settings.GetMachineName();
                string sUserFullName = Session.CurrentUserName;

                //Create new instance of
                cAX = new WcfExt116();


                //Fetch list of sub project with updates to upload

                //Update screen.
                if (v_bBackgroundTask == false)
                {
                    this.UpdateMessage("Retrieving sub project with pending data uploads...");
                }
                ;

                List <SubProjectSync> cSubProjects = this.m_cData.FetchSubProjectsWithUploads();
                if (cSubProjects.Count > 0)
                {
                    //Loop through sub project and try and upload the changes for each.
                    foreach (SubProjectSync cSubProject in cSubProjects)
                    {
                        iSubProjectCount += 1;

                        bErrorOccurred = false;

                        //Update screen.
                        if (v_bBackgroundTask == false)
                        {
                            this.UpdateMessage("Uploading Sub project: (" + iSubProjectCount.ToString() + " of " + cSubProjects.Count.ToString() + ") - " + cSubProject.SubProjectNo);
                        }
                        ;

                        try
                        {
                            if (cSubProject.UpdateQty > 0)
                            {
                                //Clear out existing update.
                                cChanges.Clear();

                                //Fetch list of pending updates.
                                cSubProjectUpdates = this.m_cData.ReturnPendingUpdatesForSubProject(cSubProject.SubProjectNo);

                                //Add update to upload object.
                                foreach (cUpdatesTable cUpdate in cSubProjectUpdates)
                                {
                                    cChange            = new AXDataUploadDataChange();
                                    cChange.ProjectNo  = cUpdate.SubProjectNo;
                                    cChange.FieldName  = cUpdate.FieldName;
                                    cChange.FieldValue = cUpdate.FieldValue;

                                    cChanges.Add(cChange);
                                }

                                //Pass update to AX.
                                uUploadResult = await cAX.UploadSubProjectChanges(sUserName, sMachineName, cSubProject.SubProjectNo, cChanges);

                                //If OK then delete updates from local updates table.
                                if (uUploadResult != null && uUploadResult.bSuccessfull == true)
                                {
                                    //Remove changes from upload table.
                                    this.m_cData.RemoveChangesFromUploadTable(cSubProjectUpdates);

                                    //v1.0.10 - Do not update sub project dates as can stop latest data from syncing.
                                    //Update sub project modified dates.
                                    //this.m_cData.UpdateSubProjectUpdateDates(cSubProject.SubProjectNo, uUploadResult.ProjTable_ModDate, uUploadResult.ActivitiesTable_ModDate);
                                }
                                else
                                {
                                    //Update screen.
                                    if (v_bBackgroundTask == false)
                                    {
                                        this.UpdateMessage("Upload failed for sub project: " + cSubProject.SubProjectNo);
                                    }
                                    ;

                                    bErrorOccurred = true;
                                }
                            }

                            if (cSubProject.UnitUpdateQty > 0)
                            {
                                //v1.0.10 - Upload unit status changes if running contract manager mode.
                                if (DependencyService.Get <ISettings>().IsThisTheSurveyorApp() == false)
                                {
                                    //Fetch pending updates for unit.
                                    cUnitUpdates = this.m_cData.FetchUnitUpdatesForSubProject(cSubProject.SubProjectNo);
                                    if (cUnitUpdates.Count > 0)
                                    {
                                        //Fetch the most recent update date.
                                        dInstallationDate = this.m_cData.FetchMostRecentUnitInstallDateForSubProject(cSubProject.SubProjectNo);

                                        //Fetch installation team.
                                        sInstallationTeam = this.m_cData.FetchInstallationTeamForSubProject(cSubProject.SubProjectNo);

                                        //Make sure the collection is clean
                                        if (ocUnitDetails != null)
                                        {
                                            ocUnitDetails.Clear();
                                        }
                                        else
                                        {
                                            ocUnitDetails = new ObservableCollection <UnitDetails>();
                                        }

                                        //Update observable collection with unit updates.
                                        foreach (cUnitsUpdateTable cUpdate in cUnitUpdates)
                                        {
                                            udUnitDetail = new UnitDetails();
                                            udUnitDetail.dInstalledDate   = dInstallationDate;
                                            udUnitDetail.iInstalledStatus = cUpdate.InstalledStatus;
                                            udUnitDetail.iUNITNUMBER      = cUpdate.UnitNo;

                                            ocUnitDetails.Add(udUnitDetail);
                                        }

                                        //Pass up.
                                        bUploadOK = await cAX.UploadUnitStatusChanges(cSubProject.SubProjectNo, sUserName, sMachineName, dInstallationDate, sInstallationTeam, ocUnitDetails);

                                        //If OK then remove updates from table.
                                        if (bUploadOK == true)
                                        {
                                            this.m_cData.DeleteUnitUpdates(cSubProject.SubProjectNo);
                                        }
                                        else
                                        {
                                            //Update screen.
                                            if (v_bBackgroundTask == false)
                                            {
                                                this.UpdateMessage("Upload failed for sub project: " + cSubProject.SubProjectNo);
                                            }
                                            ;

                                            bErrorOccurred = true;
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            //cMain.ReportError(ex, cMain.GetCallerMethodName(), string.Empty);
                            bErrorOccurred = true;
                        }

                        //If error occurred check connection is OK, if not leave.
                        if (bErrorOccurred == true)
                        {
                            //Update screen.
                            if (v_bBackgroundTask == false)
                            {
                                this.UpdateMessage("Checking connection.");
                            }
                            ;

                            //Check we are connected first
                            bConnected = await this.m_cSetting.IsAXSystemAvailable(false);

                            if (bConnected == false)
                            {
                                //Update screen.
                                this.UpdateMessage("Checking Failed.");

                                bReturnStatus = false;
                                break;
                            }
                        }
                    }
                }

                //** Upload notes to AX **

                //Update screen.
                if (v_bBackgroundTask == false)
                {
                    this.UpdateMessage("Fetching sub projects with new notes");
                }
                ;

                iSubProjectCount = 0;

                cSubProjects = this.m_cData.FetchSubProjectsWithNewNotes();
                if (cSubProjects != null)
                {
                    //Loop through sub project and try and upload the changes for each.
                    foreach (SubProjectSync cSubProject in cSubProjects)
                    {
                        iSubProjectCount += 1;

                        bErrorOccurred = false;

                        //Update screen.
                        if (v_bBackgroundTask == false)
                        {
                            this.UpdateMessage("Uploading notes for Sub project: (" + iSubProjectCount.ToString() + " of " + cSubProjects.Count.ToString() + ") - " + cSubProject.SubProjectNo);
                        }
                        ;


                        try
                        {
                            cNotes.Clear();

                            pntNotes = this.m_cData.FetchNewNotes(cSubProject.SubProjectNo);
                            foreach (cProjectNotesTable cNote in pntNotes)
                            {
                                ndNote             = new NoteDetails();
                                ndNote.AXRecID     = cNote.AXRecID;
                                ndNote.DeviceIDKey = cNote.IDKey;
                                ndNote.InputDate   = cNote.InputDateTime;
                                ndNote.NoteText    = cNote.NoteText;
                                ndNote.NoteType    = cNote.NoteType;
                                ndNote.ProjectNo   = cNote.SubProjectNo;
                                ndNote.Purpose     = sPurpose;
                                ndNote.UserName    = sUserFullName;
                                ndNote.UserProfile = sUserName;

                                cNotes.Add(ndNote);
                            }

                            //Pass update to AX.
                            uUploadResult = await cAX.UploadSubProjectNotes(sUserName, sMachineName, cSubProject.SubProjectNo, cNotes);

                            //If OK then delete updates from local updates table.
                            if (uUploadResult != null && uUploadResult.bSuccessfull == true)
                            {
                                this.m_cData.UpdateNotesWithRecID(uUploadResult.NoteValues);
                            }
                            else
                            {
                                //Update screen.
                                if (v_bBackgroundTask == false)
                                {
                                    this.UpdateMessage("Notes upload failed for sub project: " + cSubProject.SubProjectNo);
                                }
                                ;

                                bErrorOccurred = true;
                            }
                        }
                        catch (Exception ex)
                        {
                            //cMain.ReportError(ex, cMain.GetCallerMethodName(), string.Empty);
                            bReturnStatus = true;
                        }
                    }
                }


                if (cAX != null)
                {
                    await DependencyService.Get <IWcfExt116>().CloseAXConnection();
                }

                return(bReturnStatus);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }